diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2021-06-04 17:41:46 +0300 |
---|---|---|
committer | Hans-Kristian Arntzen <post@arntzen-software.no> | 2021-06-04 19:44:52 +0300 |
commit | ede4d280ae0f9f605eb6efcb53c4e9b9a51d92db (patch) | |
tree | b2bee09f1ef76e1a3fc85cd209a82b5a422e2cc7 | |
parent | ec5b4ccecf799e7593dd3c6e8b13dc4f04e77228 (diff) |
tests: Test behavior of interpolating in non-uniform control flow.nonuniform-varying-test
D3D11 functional spec defines that implicit LOD is well-defined in
varying control flow as long as the input is either a constant or shader
input.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
-rw-r--r-- | tests/d3d12.c | 466 |
1 files changed, 466 insertions, 0 deletions
diff --git a/tests/d3d12.c b/tests/d3d12.c index 3b845d02..bfeaf360 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -50830,6 +50830,470 @@ static void test_mismatching_pso_stages(void) destroy_test_context(&context); } +static void test_interpolation_non_uniform_control_flow(bool use_dxil) +{ + const D3D12_VIEWPORT vp = { 0.0f, 0.0f, 2.0f, 2.0f, 0.0f, 1.0f }; + const float white[4] = { 1000.0f, 0.0f, 0.0f, 0.0f }; + D3D12_GRAPHICS_PIPELINE_STATE_DESC pso_desc; + const D3D12_RECT scissor = { 0, 0, 2, 2 }; + D3D12_STATIC_SAMPLER_DESC static_sampler; + D3D12_DESCRIPTOR_RANGE desc_range[2]; + ID3D12RootSignature *root_signature; + D3D12_ROOT_SIGNATURE_DESC root_desc; + D3D12_ROOT_PARAMETER root_param; + ID3D12DescriptorHeap *gpu_heap; + ID3D12DescriptorHeap *cpu_heap; + struct test_context_desc desc; + struct test_context context; + ID3D12Resource *textures[3]; + struct resource_readback rb; + ID3D12PipelineState *pso; + ID3D12Resource *cbv; + unsigned int i; + HRESULT hr; + +#if 0 + struct VOut { float4 uv : UV; float index : INDEX; float4 pos : SV_Position; }; + + VOut main(uint vid : SV_VertexID, uint iid : SV_InstanceID) + { + VOut vout; + vout.pos.zw = float2(0.0, 1.0); + vout.pos.x = -1.0 + 2.0 * float(vid & 1); + vout.pos.y = -1.0 + 1.0 * float(vid & 2); + vout.uv.xy = vout.pos.xy * 0.125; + vout.uv.zw = vout.uv.xy * 2.0; + vout.pos.xy *= 0.5; + vout.pos.xy -= 0.5; + vout.pos.xy += 1.0 / 16.0; + vout.pos.x += float(iid & 1); + vout.pos.y += 0.5 * float(iid & 2); + vout.index = float(iid); + // We ensure that the real sample point is between vid 1 and 2. Here we create a + // plane such that round(index) == iid, and for helper lanes, we get weirdness. + if (vid == 0) + vout.index += 3.0; + return vout; + } +#endif + static const DWORD vs_code_dxbc[] = + { + 0x43425844, 0x9815ace9, 0x823cf7be, 0xc4150ffb, 0x84726a5e, 0x00000001, 0x00000368, 0x00000003, + 0x0000002c, 0x00000088, 0x000000f8, 0x4e475349, 0x00000054, 0x00000002, 0x00000008, 0x00000038, + 0x00000000, 0x00000006, 0x00000001, 0x00000000, 0x00000101, 0x00000044, 0x00000000, 0x00000008, + 0x00000001, 0x00000001, 0x00000101, 0x565f5653, 0x65747265, 0x00444978, 0x495f5653, 0x6174736e, + 0x4965636e, 0xabab0044, 0x4e47534f, 0x00000068, 0x00000003, 0x00000008, 0x00000050, 0x00000000, + 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x00000053, 0x00000000, 0x00000000, 0x00000003, + 0x00000001, 0x00000e01, 0x00000059, 0x00000000, 0x00000001, 0x00000003, 0x00000002, 0x0000000f, + 0x49005655, 0x5845444e, 0x5f565300, 0x69736f50, 0x6e6f6974, 0xababab00, 0x58454853, 0x00000268, + 0x00010050, 0x0000009a, 0x0100086a, 0x04000060, 0x00101012, 0x00000000, 0x00000006, 0x04000060, + 0x00101012, 0x00000001, 0x00000008, 0x03000065, 0x001020f2, 0x00000000, 0x03000065, 0x00102012, + 0x00000001, 0x04000067, 0x001020f2, 0x00000002, 0x00000001, 0x02000068, 0x00000001, 0x0a000001, + 0x00100032, 0x00000000, 0x00101006, 0x00000000, 0x00004002, 0x00000001, 0x00000002, 0x00000000, + 0x00000000, 0x05000056, 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x0f000032, 0x001000c2, + 0x00000000, 0x00100406, 0x00000000, 0x00004002, 0x00000000, 0x00000000, 0x40000000, 0x3f800000, + 0x00004002, 0x00000000, 0x00000000, 0xbf800000, 0xbf800000, 0x0f000032, 0x00100032, 0x00000000, + 0x001000c6, 0x00000000, 0x00004002, 0x40000000, 0x3f800000, 0x00000000, 0x00000000, 0x00004002, + 0xbf800000, 0x00000000, 0x00000000, 0x00000000, 0x0a000038, 0x001020f2, 0x00000000, 0x001004e6, + 0x00000000, 0x00004002, 0x3e000000, 0x3e000000, 0x3e800000, 0x3e800000, 0x0f000032, 0x00100032, + 0x00000000, 0x00100046, 0x00000000, 0x00004002, 0x3f000000, 0x3f000000, 0x00000000, 0x00000000, + 0x00004002, 0xbee00000, 0xbee00000, 0x00000000, 0x00000000, 0x05000056, 0x00100042, 0x00000000, + 0x0010100a, 0x00000001, 0x07000000, 0x00100082, 0x00000000, 0x0010002a, 0x00000000, 0x00004001, + 0x40400000, 0x09000037, 0x00102012, 0x00000001, 0x0010100a, 0x00000000, 0x0010002a, 0x00000000, + 0x0010003a, 0x00000000, 0x0a000001, 0x001000c2, 0x00000000, 0x00101006, 0x00000001, 0x00004002, + 0x00000000, 0x00000000, 0x00000001, 0x00000002, 0x05000056, 0x001000c2, 0x00000000, 0x00100ea6, + 0x00000000, 0x07000000, 0x00102012, 0x00000002, 0x0010002a, 0x00000000, 0x0010000a, 0x00000000, + 0x09000032, 0x00102022, 0x00000002, 0x0010003a, 0x00000000, 0x00004001, 0x3f000000, 0x0010001a, + 0x00000000, 0x08000036, 0x001020c2, 0x00000002, 0x00004002, 0x00000000, 0x00000000, 0x00000000, + 0x3f800000, 0x0100003e, + }; + static const BYTE vs_code_dxil[] = + { + 0x44, 0x58, 0x42, 0x43, 0x1f, 0xbe, 0xd8, 0xf3, 0xa2, 0xe2, 0xca, 0x9b, 0x3b, 0xf2, 0x26, 0xb4, 0x54, 0x12, 0xfd, 0xb8, 0x01, 0x00, 0x00, 0x00, 0xdf, 0x07, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x34, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0xae, 0x00, 0x00, 0x00, 0x33, 0x01, 0x00, 0x00, 0xf3, 0x01, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, 0x62, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x56, 0x65, 0x72, 0x74, 0x65, 0x78, 0x49, 0x44, 0x00, + 0x53, 0x56, 0x5f, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x44, 0x00, 0x4f, 0x53, 0x47, 0x31, 0x7d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x56, + 0x00, 0x49, 0x4e, 0x44, 0x45, 0x58, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x50, 0x53, 0x56, 0x30, 0xb8, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x02, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x55, 0x56, 0x00, 0x49, 0x4e, 0x44, 0x45, 0x58, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x41, 0x02, 0x01, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x44, 0x00, 0x03, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x41, 0x00, 0x03, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x44, 0x03, 0x03, 0x04, 0x00, 0x00, 0x1f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0xe4, 0x05, 0x00, 0x00, 0x60, 0x00, 0x01, 0x00, 0x79, + 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xcc, 0x05, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x70, 0x01, 0x00, 0x00, 0x0b, + 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, + 0x04, 0x8b, 0x62, 0x80, 0x10, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0x84, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x42, 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, + 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x11, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, 0x21, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1b, + 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x01, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, + 0x82, 0x60, 0x42, 0x20, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x32, 0x22, 0x08, 0x09, 0x20, 0x64, 0x85, 0x04, 0x13, 0x22, 0xa4, 0x84, 0x04, 0x13, 0x22, 0xe3, 0x84, + 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x88, 0x8c, 0x0b, 0x84, 0x84, 0x4c, 0x10, 0x34, 0x23, 0x00, 0x25, 0x00, 0x8a, 0x39, 0x02, 0x30, 0x98, 0x23, 0x40, 0x8a, 0x31, 0x33, 0x43, 0x43, 0x35, 0x03, 0x50, + 0x0c, 0x98, 0x19, 0x3a, 0xc2, 0x81, 0x80, 0x3c, 0x98, 0x39, 0x82, 0x00, 0x00, 0x00, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, + 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, + 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, + 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, 0x05, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xc8, 0x02, 0x01, 0x0c, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x9a, 0x12, 0x18, 0x01, 0x28, 0x84, 0x62, 0x28, 0x02, 0xa2, + 0x52, 0x28, 0x81, 0x11, 0x80, 0x22, 0x28, 0x89, 0x42, 0x28, 0x03, 0xda, 0xb1, 0x8e, 0x82, 0xf9, 0x31, 0x00, 0x00, 0x60, 0x0c, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x1a, + 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0xc4, 0x88, 0x0c, 0x6f, 0xec, 0xed, 0x4d, 0x0c, 0x44, 0x06, 0x26, 0x26, 0xc7, 0x05, 0xa6, 0xc6, 0x05, 0x06, 0x66, 0x43, 0x10, 0x4c, 0x10, 0x86, 0x61, 0x82, + 0x30, 0x10, 0x1b, 0x84, 0x81, 0x98, 0x20, 0x0c, 0xc5, 0x06, 0x61, 0x30, 0x28, 0xd8, 0xcd, 0x4d, 0x10, 0x06, 0x63, 0xc3, 0x80, 0x24, 0xc4, 0x04, 0x41, 0x00, 0x36, 0x00, 0x1b, 0x06, 0x82, 0x61, + 0x36, 0x04, 0xcd, 0x86, 0x61, 0x58, 0x9c, 0x09, 0xc2, 0xf2, 0x6c, 0x08, 0x20, 0x12, 0x6d, 0x61, 0x69, 0x6e, 0x5c, 0xa6, 0xac, 0xbe, 0xac, 0xca, 0xe4, 0xe8, 0xca, 0xf0, 0x92, 0x88, 0x26, 0x08, + 0x04, 0x32, 0x41, 0x20, 0x92, 0x0d, 0x01, 0x31, 0x41, 0x20, 0x94, 0x0d, 0x0b, 0x31, 0x51, 0x95, 0x75, 0x0d, 0x15, 0x71, 0x01, 0x6c, 0xa6, 0xac, 0xbe, 0x92, 0xdc, 0xe6, 0xe8, 0xc2, 0xdc, 0xc6, + 0xca, 0x92, 0x88, 0x26, 0x08, 0xc4, 0xb2, 0x61, 0x19, 0x32, 0x4a, 0xb3, 0xae, 0xa1, 0x1a, 0x2e, 0x60, 0x83, 0x80, 0x6d, 0x14, 0xaa, 0xac, 0x26, 0x08, 0x04, 0x33, 0x41, 0x20, 0x9a, 0x0d, 0x0b, + 0xd1, 0x79, 0x97, 0xa5, 0x0d, 0x1f, 0x71, 0x01, 0x2c, 0x92, 0x9c, 0x88, 0x8a, 0xb0, 0x36, 0x2c, 0x43, 0x18, 0x78, 0x97, 0xa5, 0x0d, 0xd5, 0x70, 0x01, 0x13, 0x84, 0xe1, 0xe0, 0x32, 0x65, 0xf5, + 0x05, 0xf5, 0x36, 0x97, 0x46, 0x97, 0xf6, 0xe6, 0x36, 0x41, 0x20, 0x9c, 0x0d, 0xcb, 0x18, 0x90, 0x81, 0x57, 0x06, 0xd6, 0x37, 0x7c, 0x63, 0x70, 0x01, 0x1b, 0x06, 0x30, 0x10, 0x03, 0x33, 0xd8, + 0x30, 0x70, 0x67, 0x00, 0x6c, 0x28, 0x16, 0x09, 0x0d, 0x00, 0xa0, 0x0a, 0x1b, 0x9b, 0x5d, 0x9b, 0x4b, 0x1a, 0x59, 0x99, 0x1b, 0xdd, 0x94, 0x20, 0xa8, 0x42, 0x86, 0xe7, 0x62, 0x57, 0x26, 0x37, + 0x97, 0xf6, 0xe6, 0x36, 0x25, 0x20, 0x9a, 0x90, 0xe1, 0xb9, 0xd8, 0x85, 0xb1, 0xd9, 0x95, 0xc9, 0x4d, 0x09, 0x8c, 0x3a, 0x64, 0x78, 0x2e, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x6f, 0x64, + 0x65, 0x6c, 0x53, 0x82, 0xa4, 0x12, 0x19, 0x9e, 0x0b, 0x5d, 0x1e, 0x5c, 0x59, 0x90, 0x9b, 0xdb, 0x1b, 0x5d, 0x18, 0x5d, 0xda, 0x9b, 0xdb, 0xdc, 0x94, 0xc0, 0xa9, 0x43, 0x86, 0xe7, 0x62, 0x97, + 0x56, 0x76, 0x97, 0x44, 0x36, 0x45, 0x17, 0x46, 0x57, 0x36, 0x25, 0x80, 0xea, 0x90, 0xe1, 0xb9, 0x94, 0xb9, 0xd1, 0xc9, 0xe5, 0x41, 0xbd, 0xa5, 0xb9, 0xd1, 0xcd, 0x4d, 0x09, 0xd0, 0x00, 0x79, + 0x18, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, + 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, + 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, + 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, + 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, + 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, + 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, + 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, + 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0x03, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x16, 0x30, 0x0d, 0x97, 0xef, 0x3c, 0xfe, 0xe2, 0x00, + 0x83, 0xd8, 0x3c, 0xd4, 0xe4, 0x23, 0xb7, 0x6d, 0x02, 0xd5, 0x70, 0xf9, 0xce, 0xe3, 0x4b, 0x93, 0x13, 0x11, 0x28, 0x35, 0x3d, 0xd4, 0xe4, 0x17, 0xb7, 0x6d, 0x00, 0x04, 0x03, 0x20, 0x0d, 0x00, + 0x00, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x34, 0xa5, 0x30, 0x03, 0x40, 0x37, 0x46, 0x00, 0x82, + 0x20, 0x88, 0x7e, 0x63, 0x04, 0x20, 0x08, 0x82, 0xf0, 0x37, 0x46, 0x00, 0x82, 0x20, 0x88, 0xff, 0xc2, 0x18, 0x01, 0x08, 0x82, 0x20, 0xf8, 0x0b, 0x63, 0x04, 0x20, 0x08, 0x82, 0xe0, 0x37, 0x46, + 0x00, 0x82, 0x20, 0x88, 0xfe, 0xc2, 0x18, 0x01, 0x08, 0x82, 0xe0, 0xfd, 0x0b, 0x63, 0x04, 0x20, 0x08, 0x82, 0xee, 0x2f, 0x8c, 0x11, 0x80, 0x20, 0x08, 0x92, 0x60, 0x30, 0x02, 0x30, 0x46, 0x00, + 0x82, 0x20, 0x88, 0x7f, 0x00, 0x00, 0x00, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x50, 0x70, 0x98, 0x96, 0x4d, 0xcc, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x14, 0x5d, 0xa6, 0x69, 0x54, 0x53, 0x01, + 0xa7, 0x17, 0x5c, 0xd5, 0xa0, 0xe9, 0x05, 0x57, 0x16, 0x3c, 0xf0, 0x31, 0x42, 0x92, 0x8f, 0x05, 0x10, 0x7c, 0x6c, 0x80, 0xe4, 0x63, 0x07, 0x25, 0x1f, 0x0b, 0x22, 0xf8, 0x98, 0x71, 0xc9, 0xa7, + 0x9a, 0x33, 0xd0, 0x0b, 0xae, 0x2c, 0xa0, 0xe0, 0x63, 0x41, 0x03, 0x9f, 0x8a, 0xce, 0x40, 0x2f, 0xb8, 0xb2, 0x26, 0x80, 0x8f, 0x05, 0x9e, 0x7c, 0x2c, 0xc8, 0xe0, 0x73, 0xd6, 0xd5, 0x70, 0x83, + 0x05, 0x07, 0x60, 0x60, 0xc2, 0x06, 0x9f, 0xe9, 0x86, 0x60, 0x10, 0x46, 0x0c, 0x12, 0x00, 0x04, 0xc1, 0x00, 0xa9, 0x83, 0x33, 0x98, 0x83, 0x39, 0x68, 0x03, 0x69, 0xc4, 0x20, 0x01, 0x40, 0x10, + 0x0c, 0x90, 0x3a, 0x38, 0x83, 0x39, 0x98, 0x03, 0x37, 0x88, 0x46, 0x0c, 0x12, 0x00, 0x04, 0xc1, 0x00, 0xa9, 0x83, 0x33, 0x98, 0x83, 0x39, 0x60, 0x83, 0x67, 0xc4, 0x20, 0x01, 0x40, 0x10, 0x0c, + 0x90, 0x3a, 0x38, 0x83, 0x39, 0x98, 0x83, 0x34, 0x70, 0x46, 0x0c, 0x12, 0x00, 0x04, 0xc1, 0x00, 0xa9, 0x83, 0x33, 0xa0, 0x83, 0x39, 0x68, 0x83, 0x60, 0xc4, 0x20, 0x01, 0x40, 0x10, 0x0c, 0x90, + 0x3a, 0x38, 0x03, 0x38, 0x98, 0x83, 0x36, 0x50, 0x46, 0x0c, 0x12, 0x00, 0x04, 0xc1, 0x00, 0xa9, 0x83, 0x33, 0x80, 0x83, 0x39, 0x70, 0x83, 0x62, 0xc4, 0x20, 0x01, 0x40, 0x10, 0x0c, 0x90, 0x3a, + 0x38, 0x03, 0x38, 0x98, 0x03, 0x36, 0xe0, 0x46, 0x0c, 0x12, 0x00, 0x04, 0xc1, 0x00, 0xa9, 0x83, 0x33, 0x80, 0x83, 0x39, 0x48, 0x83, 0x0d, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }; +#if 0 + Texture2D<float> A : register(t0); + Texture2D<float> B : register(t1); + Texture2D<float> C : register(t2); + cbuffer cbuf : register(b0) + { + float2 constant_uv; + }; + SamplerState S : register(s0); + + float main(float4 uv : UV, float index : INDEX) : SV_Target + { + // This is valid according to D3D11 functional spec. + // Implicit LOD in varying control flow is allowed if texture coordinate is either: + // - Shader input + // - Statically indexed constant (LOD = 0.0). However, this is broken on AMD Windows, so it might not be a D3D12 requirement. + index = round(index); + [branch] + if (index > 3.5 || index < 0.0) // Should trigger in helper lanes + return B.SampleLevel(S, constant_uv, 3.0); + else if (index > 2.5) + return A.Sample(S, uv.xy); + else if (index > 1.5) + return B.Sample(S, constant_uv); + else + return C.Sample(S, uv.zw); + } +#endif + static const DWORD ps_code_dxbc[] = + { + 0x43425844, 0x0f5ddbda, 0x196ebe68, 0x2993c4b4, 0x3c2d0bc4, 0x00000001, 0x00000338, 0x00000003, + 0x0000002c, 0x00000078, 0x000000ac, 0x4e475349, 0x00000044, 0x00000002, 0x00000008, 0x00000038, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x0000003b, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000101, 0x49005655, 0x5845444e, 0xababab00, 0x4e47534f, 0x0000002c, + 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000e01, + 0x545f5653, 0x65677261, 0xabab0074, 0x58454853, 0x00000284, 0x00000050, 0x000000a1, 0x0100086a, + 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x0300005a, 0x00106000, 0x00000000, 0x04001858, + 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, + 0x00107000, 0x00000002, 0x00005555, 0x03001062, 0x001010f2, 0x00000000, 0x03001062, 0x00101012, + 0x00000001, 0x03000065, 0x00102012, 0x00000000, 0x02000068, 0x00000001, 0x05000040, 0x00100012, + 0x00000000, 0x0010100a, 0x00000001, 0x07000031, 0x00100022, 0x00000000, 0x00004001, 0x40600000, + 0x0010000a, 0x00000000, 0x07000031, 0x00100042, 0x00000000, 0x0010000a, 0x00000000, 0x00004001, + 0x00000000, 0x0700003c, 0x00100022, 0x00000000, 0x0010002a, 0x00000000, 0x0010001a, 0x00000000, + 0x0304001f, 0x0010001a, 0x00000000, 0x8e000048, 0x800000c2, 0x00155543, 0x00100022, 0x00000000, + 0x00208046, 0x00000000, 0x00000000, 0x00107e16, 0x00000001, 0x00106000, 0x00000000, 0x00004001, + 0x40400000, 0x05000036, 0x00102012, 0x00000000, 0x0010001a, 0x00000000, 0x0100003e, 0x01000012, + 0x07000031, 0x00100022, 0x00000000, 0x00004001, 0x40200000, 0x0010000a, 0x00000000, 0x0304001f, + 0x0010001a, 0x00000000, 0x8b000045, 0x800000c2, 0x00155543, 0x00100022, 0x00000000, 0x00101046, + 0x00000000, 0x00107e16, 0x00000000, 0x00106000, 0x00000000, 0x05000036, 0x00102012, 0x00000000, + 0x0010001a, 0x00000000, 0x0100003e, 0x01000012, 0x07000031, 0x00100012, 0x00000000, 0x00004001, + 0x3fc00000, 0x0010000a, 0x00000000, 0x0304001f, 0x0010000a, 0x00000000, 0x8c000045, 0x800000c2, + 0x00155543, 0x00100012, 0x00000000, 0x00208046, 0x00000000, 0x00000000, 0x00107e46, 0x00000001, + 0x00106000, 0x00000000, 0x05000036, 0x00102012, 0x00000000, 0x0010000a, 0x00000000, 0x0100003e, + 0x01000012, 0x8b000045, 0x800000c2, 0x00155543, 0x00100012, 0x00000000, 0x00101ae6, 0x00000000, + 0x00107e46, 0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00102012, 0x00000000, 0x0010000a, + 0x00000000, 0x0100003e, 0x01000015, 0x01000015, 0x01000015, 0x0100003e, + }; + static const BYTE ps_code_dxil[] = + { + 0x44, 0x58, 0x42, 0x43, 0x57, 0xe8, 0x78, 0x83, 0x9a, 0x18, 0xff, 0xb9, 0x3b, 0x57, 0xb0, 0xd1, 0x9c, 0x3a, 0xd3, 0xd2, 0x01, 0x00, 0x00, 0x00, 0x3f, 0x0a, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x34, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x9d, 0x00, 0x00, 0x00, 0xd7, 0x00, 0x00, 0x00, 0xcb, 0x01, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, 0x51, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x56, 0x00, 0x49, 0x4e, 0x44, 0x45, 0x58, 0x00, 0x4f, 0x53, 0x47, + 0x31, 0x32, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x00, 0x50, 0x53, 0x56, 0x30, 0xec, 0x00, 0x00, 0x00, 0x24, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x01, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0c, + 0x00, 0x00, 0x00, 0x00, 0x55, 0x56, 0x00, 0x49, 0x4e, 0x44, 0x45, 0x58, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x44, 0x00, 0x03, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x41, 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x10, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x6c, 0x08, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x1b, 0x02, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, + 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x54, 0x08, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x12, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, + 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x18, 0x45, 0x02, 0x42, + 0x92, 0x0b, 0x42, 0xc4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x62, 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x11, + 0x23, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, 0x31, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, + 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, + 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x32, 0x22, 0x88, 0x09, 0x20, 0x64, 0x85, 0x04, 0x13, 0x23, 0xa4, 0x84, 0x04, + 0x13, 0x23, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8c, 0x8c, 0x0b, 0x84, 0xc4, 0x4c, 0x10, 0x88, 0xc1, 0x08, 0x40, 0x09, 0x00, 0x0a, 0x66, 0x00, 0xe6, 0x08, 0xc0, 0x60, 0x8e, 0x00, 0x29, + 0xc6, 0x40, 0x10, 0x44, 0x41, 0x90, 0x51, 0x0c, 0x80, 0x20, 0x88, 0x62, 0x20, 0xe4, 0xa8, 0xe1, 0xf2, 0x27, 0xec, 0x21, 0x24, 0x9f, 0xdb, 0xa8, 0x62, 0x25, 0x26, 0xbf, 0xb8, 0x6d, 0x44, 0x0c, + 0xc3, 0x30, 0x50, 0x71, 0xcf, 0x70, 0xf9, 0x13, 0xf6, 0x10, 0x92, 0x1f, 0x02, 0xcd, 0xb0, 0x10, 0x28, 0x58, 0x0a, 0xa1, 0x10, 0x0c, 0x41, 0x4d, 0x19, 0x06, 0x62, 0xa0, 0xe7, 0xa6, 0xe1, 0xf2, + 0x27, 0xec, 0x21, 0x24, 0x7f, 0x25, 0xa4, 0x95, 0x98, 0xfc, 0xe2, 0xb6, 0x51, 0x31, 0x0c, 0xc3, 0x40, 0x14, 0x26, 0x22, 0x18, 0x66, 0x18, 0x86, 0x81, 0x20, 0x88, 0x81, 0xa4, 0x39, 0x82, 0xa0, + 0x18, 0x0c, 0x51, 0x10, 0x04, 0x45, 0xd5, 0x40, 0xc0, 0x4c, 0x61, 0x30, 0x0e, 0xec, 0x10, 0x0e, 0xf3, 0x30, 0x0f, 0x6e, 0x40, 0x0b, 0xe5, 0x80, 0x0f, 0xf4, 0x50, 0x0f, 0xf2, 0x50, 0x0e, 0x72, + 0x40, 0x0a, 0x7c, 0x60, 0x0e, 0xec, 0xf0, 0x0e, 0xe1, 0x40, 0x0f, 0x7e, 0xa0, 0x07, 0x7a, 0xd0, 0x0e, 0xe9, 0x00, 0x0f, 0xf3, 0xf0, 0x0b, 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x28, 0x20, 0x66, + 0xb2, 0xc6, 0x81, 0x1d, 0xc2, 0x61, 0x1e, 0xe6, 0xc1, 0x0d, 0x68, 0xa1, 0x1c, 0xf0, 0x81, 0x1e, 0xea, 0x41, 0x1e, 0xca, 0x41, 0x0e, 0x48, 0x81, 0x0f, 0xcc, 0x81, 0x1d, 0xde, 0x21, 0x1c, 0xe8, + 0xc1, 0x0f, 0x90, 0x30, 0x60, 0x94, 0x0d, 0x23, 0x08, 0xc3, 0x11, 0x42, 0x40, 0x15, 0x28, 0xd8, 0x88, 0xbb, 0x49, 0x9a, 0x22, 0x4a, 0x98, 0x7c, 0x16, 0x60, 0x9e, 0x85, 0x88, 0xd8, 0x09, 0x98, + 0x08, 0x14, 0x10, 0xe4, 0xe5, 0x01, 0x31, 0x05, 0x00, 0x00, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, + 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, + 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x86, 0x3c, 0x06, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xf2, 0x34, 0x40, + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xe4, 0x79, 0x80, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0x23, 0x01, 0x01, 0x30, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xc0, 0x90, 0x47, 0x02, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0x4f, 0x05, 0x04, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x20, + 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x22, 0x4a, 0x60, 0x04, 0xa0, 0x10, 0x8a, 0xa1, 0x08, 0x4a, + 0xa2, 0x20, 0xa8, 0x28, 0x89, 0x11, 0x80, 0x22, 0x28, 0x84, 0x12, 0x28, 0x10, 0xd2, 0x66, 0x00, 0xa8, 0x9b, 0x01, 0xa0, 0x6f, 0x06, 0x80, 0xc0, 0xb1, 0x8e, 0x22, 0x08, 0x82, 0x20, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0xc4, 0x88, 0x0c, 0x6f, 0xec, 0xed, 0x4d, 0x0c, 0x44, 0x06, 0x26, 0x26, 0xc7, 0x05, + 0xa6, 0xc6, 0x05, 0x06, 0x66, 0x43, 0x10, 0x4c, 0x10, 0x08, 0x64, 0x82, 0x40, 0x24, 0x1b, 0x84, 0x81, 0x98, 0x20, 0x10, 0xca, 0x06, 0x61, 0x30, 0x28, 0xc0, 0xcd, 0x4d, 0x10, 0x88, 0x65, 0xc3, + 0x80, 0x24, 0xc4, 0x04, 0x41, 0xab, 0x08, 0x4c, 0x10, 0x08, 0x66, 0x82, 0x40, 0x34, 0x1b, 0x04, 0xc2, 0xd9, 0x90, 0x10, 0x0b, 0x43, 0x10, 0x43, 0x43, 0x3c, 0x1b, 0x92, 0x61, 0x61, 0x88, 0x61, + 0x68, 0x88, 0x67, 0x43, 0xd2, 0x2c, 0x0c, 0xd1, 0x0c, 0x0d, 0xf1, 0x6c, 0x18, 0xa0, 0x48, 0x9a, 0x20, 0x74, 0xd6, 0x04, 0x81, 0x70, 0x36, 0x20, 0x04, 0xc5, 0x10, 0xc4, 0x50, 0x01, 0x1b, 0x02, + 0x6b, 0x82, 0xf0, 0x5d, 0x1b, 0x10, 0x02, 0x63, 0x08, 0x62, 0x20, 0x80, 0x0d, 0x41, 0xb6, 0x81, 0x98, 0x80, 0x4b, 0x9b, 0x20, 0x08, 0xc0, 0x06, 0x60, 0xc3, 0x40, 0x74, 0xdd, 0x86, 0xc0, 0xdb, + 0x30, 0x0c, 0xdc, 0x37, 0x41, 0x00, 0x03, 0x6c, 0x43, 0x10, 0x06, 0x24, 0xda, 0xc2, 0xd2, 0xdc, 0x28, 0x54, 0x59, 0x4d, 0x10, 0x8a, 0x67, 0x82, 0x50, 0x40, 0x1b, 0x02, 0x62, 0x82, 0x50, 0x44, + 0x13, 0x84, 0x42, 0xda, 0xb0, 0x10, 0x64, 0x50, 0x06, 0x66, 0x70, 0x06, 0x68, 0x30, 0xa4, 0x01, 0x61, 0x06, 0x00, 0x8b, 0x24, 0x27, 0xa2, 0x22, 0xac, 0x09, 0x42, 0x31, 0x6d, 0x58, 0x86, 0x35, + 0x28, 0x03, 0x33, 0x38, 0x03, 0x34, 0x18, 0xd8, 0x60, 0x30, 0x03, 0x60, 0x83, 0xa0, 0x06, 0x6d, 0xc0, 0x64, 0xca, 0xea, 0x8b, 0x2a, 0x4c, 0xee, 0xac, 0x8c, 0x6e, 0x82, 0x50, 0x50, 0x1b, 0x16, + 0xe2, 0x0d, 0xca, 0x00, 0x0e, 0xce, 0xc0, 0x0c, 0x06, 0x36, 0x20, 0xcc, 0x00, 0xd8, 0x10, 0xc4, 0xc1, 0x86, 0xc1, 0x0d, 0xe4, 0x00, 0xd8, 0x50, 0x70, 0x63, 0x30, 0x07, 0x1b, 0x40, 0x8a, 0x0c, + 0xcf, 0x65, 0xec, 0xcd, 0x8d, 0x4e, 0xee, 0x8d, 0xcd, 0x8c, 0xed, 0xed, 0xce, 0x05, 0x2d, 0xcd, 0x8d, 0x6e, 0x6e, 0xc5, 0x60, 0x07, 0x75, 0x30, 0x54, 0x61, 0x63, 0xb3, 0x6b, 0x73, 0x49, 0x23, + 0x2b, 0x73, 0xa3, 0x9b, 0x12, 0x04, 0x55, 0xc8, 0xf0, 0x5c, 0xec, 0xca, 0xe4, 0xe6, 0xd2, 0xde, 0xdc, 0xa6, 0x04, 0x44, 0x13, 0x32, 0x3c, 0x17, 0xbb, 0x30, 0x36, 0xbb, 0x32, 0xb9, 0x29, 0x81, + 0x51, 0x87, 0x0c, 0xcf, 0x65, 0x0e, 0x2d, 0x8c, 0xac, 0x4c, 0xae, 0xe9, 0x8d, 0xac, 0x8c, 0x6d, 0x4a, 0x90, 0x94, 0x21, 0xc3, 0x73, 0x91, 0x2b, 0x9b, 0x7b, 0xab, 0x93, 0x1b, 0x2b, 0x9b, 0x9b, + 0x12, 0x68, 0x95, 0xc8, 0xf0, 0x5c, 0xe8, 0xf2, 0xe0, 0xca, 0x82, 0xdc, 0xdc, 0xde, 0xe8, 0xc2, 0xe8, 0xd2, 0xde, 0xdc, 0xe6, 0xa6, 0x04, 0x5f, 0x1d, 0x32, 0x3c, 0x17, 0xbb, 0xb4, 0xb2, 0xbb, + 0x24, 0xb2, 0x29, 0xba, 0x30, 0xba, 0xb2, 0x29, 0x41, 0x18, 0xd4, 0x21, 0xc3, 0x73, 0x29, 0x73, 0xa3, 0x93, 0xcb, 0x83, 0x7a, 0x4b, 0x73, 0xa3, 0x9b, 0x9b, 0x12, 0xcc, 0x01, 0x00, 0x00, 0x79, + 0x18, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, + 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, + 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, + 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, + 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, + 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, + 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, + 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, + 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x8c, 0xca, 0x21, 0x07, 0x7c, 0x70, 0x83, 0x71, 0x78, 0x07, 0x77, 0xa0, 0x07, 0x79, 0x78, 0x07, 0x76, 0x30, 0x07, + 0x76, 0x78, 0x87, 0x7b, 0x70, 0x03, 0x74, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x79, 0x98, 0x91, 0x3d, 0xe4, 0x80, 0x0f, 0x6e, 0x80, 0x0e, 0xec, 0xe0, 0x06, 0xf2, 0x50, 0x0e, 0xf3, 0xf0, 0x0e, 0xf5, + 0x20, 0x0f, 0xe3, 0x50, 0x0e, 0x6e, 0x10, 0x0e, 0xf4, 0x40, 0x0f, 0xf2, 0x90, 0x0e, 0xe2, 0x50, 0x0f, 0xf4, 0x50, 0x0e, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x36, + 0xb0, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x10, 0x50, 0x45, 0x41, 0x44, 0xa5, 0x03, 0x0c, 0x25, 0x61, 0x00, 0x02, 0xe6, 0x17, 0xb7, 0x6d, 0x07, 0xd2, 0x70, 0xf9, 0xce, 0xe3, 0x0b, 0x11, 0x01, 0x4c, + 0x44, 0x08, 0x34, 0xc3, 0x42, 0x58, 0xc0, 0x34, 0x5c, 0xbe, 0xf3, 0xf8, 0x8b, 0x03, 0x0c, 0x62, 0xf3, 0x50, 0x93, 0x5f, 0xdc, 0xb6, 0x19, 0x40, 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, 0x01, 0xcc, 0xb3, + 0x10, 0x7e, 0x71, 0xdb, 0x56, 0x50, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x04, 0x30, 0xcf, 0x42, 0x94, 0x44, 0x45, 0x2c, 0x7e, 0x71, 0xdb, 0x26, 0x50, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x34, 0x39, 0x11, + 0x81, 0x52, 0xd3, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x46, 0xf0, 0x0c, 0x97, 0xef, 0x3c, 0x3e, 0xd5, 0x00, 0x11, 0xe6, 0x17, 0xb7, 0x6d, 0x00, 0x04, 0x03, 0x20, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x61, + 0x20, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x13, 0x04, 0x48, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x44, 0x8d, 0x00, 0x50, 0x51, 0x06, 0x44, 0x94, 0x42, 0xf1, 0x15, 0x4d, 0xd9, + 0xcd, 0x00, 0x94, 0x5c, 0xe1, 0xd1, 0x30, 0x46, 0x00, 0x82, 0x20, 0xc8, 0x7f, 0x63, 0x04, 0x20, 0x08, 0x82, 0x22, 0x18, 0x8c, 0x11, 0x80, 0x20, 0x08, 0x92, 0x60, 0x30, 0x02, 0x30, 0x46, 0x00, + 0x82, 0x20, 0x68, 0x82, 0xc1, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x50, 0x85, 0x01, 0x82, 0x71, 0xdc, 0x33, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x95, 0x18, + 0x24, 0x59, 0x18, 0x84, 0x01, 0x34, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0xd5, 0x18, 0x28, 0x5a, 0x18, 0x84, 0x41, 0x34, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x15, 0x19, 0x2c, 0x91, 0x18, 0x88, + 0x81, 0x34, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x55, 0x19, 0x30, 0xdb, 0x18, 0x8c, 0xc1, 0x34, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x06, 0x1b, 0x8c, 0x41, 0x19, 0x90, 0x41, 0xe7, 0x8c, 0x18, + 0x24, 0x00, 0x08, 0x82, 0x81, 0xd1, 0x06, 0x64, 0x50, 0x06, 0x65, 0xe0, 0x3d, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0xb8, 0x41, 0x19, 0x98, 0x81, 0x19, 0x70, 0xd0, 0x88, 0x41, 0x02, 0x80, + 0x20, 0x18, 0x18, 0x6f, 0x60, 0x06, 0x67, 0x70, 0x06, 0x5f, 0x34, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x06, 0x1c, 0x9c, 0x01, 0x1a, 0xa0, 0xc1, 0x25, 0x8d, 0x18, 0x18, 0x00, 0x08, 0x82, 0xc1, + 0xe3, 0x06, 0x55, 0x31, 0x1c, 0x11, 0x34, 0xc2, 0x37, 0x1c, 0x21, 0x3c, 0xc4, 0x57, 0x42, 0xb0, 0xb3, 0x0c, 0x81, 0x10, 0x8c, 0x18, 0x1c, 0x00, 0x08, 0x82, 0x41, 0x33, 0x07, 0x98, 0xd2, 0x06, + 0xa3, 0x09, 0x01, 0x30, 0x9a, 0x20, 0x04, 0x23, 0x06, 0x0f, 0x00, 0x82, 0x60, 0x20, 0xd1, 0x41, 0x07, 0x39, 0x42, 0x20, 0x49, 0x9a, 0xa6, 0x55, 0xa3, 0x09, 0x01, 0x30, 0x4b, 0x70, 0x0c, 0x47, + 0x24, 0x98, 0xf0, 0xcd, 0x32, 0x0c, 0x44, 0x30, 0x62, 0xf0, 0x00, 0x20, 0x08, 0x06, 0x92, 0x1d, 0x6c, 0x52, 0xe4, 0x34, 0x55, 0xd5, 0x75, 0x5d, 0x35, 0x9a, 0x10, 0x00, 0xb3, 0x04, 0xc7, 0x70, + 0x04, 0xc3, 0x09, 0xdf, 0x2c, 0x43, 0x61, 0x04, 0x23, 0x06, 0x07, 0x00, 0x82, 0x60, 0xd0, 0xf0, 0x41, 0x18, 0x4c, 0x76, 0x30, 0x9a, 0x10, 0x00, 0xa3, 0x09, 0x42, 0x30, 0x62, 0xf0, 0x00, 0x20, + 0x08, 0x06, 0x12, 0x1f, 0x84, 0x41, 0x76, 0x09, 0xc1, 0xb6, 0x8d, 0xc1, 0x18, 0x8c, 0xc1, 0x36, 0x9a, 0x10, 0x00, 0xb3, 0x04, 0xc7, 0x88, 0xc1, 0x03, 0x80, 0x20, 0x18, 0x48, 0x7e, 0x30, 0x06, + 0x5c, 0x46, 0x4d, 0x5d, 0x57, 0x06, 0x65, 0x50, 0x06, 0xdd, 0x68, 0x42, 0x00, 0xcc, 0x12, 0x1c, 0x03, 0x25, 0x03, 0x16, 0x48, 0x83, 0x51, 0x08, 0xc6, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x20, + 0xa5, 0xc0, 0x06, 0x7e, 0xe0, 0x07, 0x77, 0x10, 0x60, 0x40, 0x0c, 0x02, 0x00, 0x00, 0x00, 0x5b, 0x06, 0xc7, 0xa9, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }; + + const D3D12_SHADER_BYTECODE vs = { + use_dxil ? (const void *)vs_code_dxil : (const void *)vs_code_dxbc, + use_dxil ? sizeof(vs_code_dxil) : sizeof(vs_code_dxbc), + }; + + const D3D12_SHADER_BYTECODE ps = { + use_dxil ? (const void *)ps_code_dxil : (const void *)ps_code_dxbc, + use_dxil ? sizeof(ps_code_dxil) : sizeof(ps_code_dxbc), + }; + + memset(&desc, 0, sizeof(desc)); + desc.rt_width = 2; + desc.rt_height = 2; + desc.rt_descriptor_count = 1; + desc.no_root_signature = true; + desc.rt_format = DXGI_FORMAT_R32_FLOAT; + if (!init_test_context(&context, &desc)) + return; + + if (use_dxil && !context_supports_dxil(&context)) + { + destroy_test_context(&context); + return; + } + + memset(&root_desc, 0, sizeof(root_desc)); + root_desc.NumParameters = 1; + root_desc.pParameters = &root_param; + root_desc.NumStaticSamplers = 1; + root_desc.pStaticSamplers = &static_sampler; + + memset(&static_sampler, 0, sizeof(static_sampler)); + static_sampler.AddressU = D3D12_TEXTURE_ADDRESS_MODE_CLAMP; + static_sampler.AddressV = D3D12_TEXTURE_ADDRESS_MODE_CLAMP; + static_sampler.AddressW = D3D12_TEXTURE_ADDRESS_MODE_CLAMP; + static_sampler.Filter = D3D12_FILTER_MIN_MAG_MIP_POINT; + static_sampler.MaxLOD = 32.0f; + static_sampler.ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL; + + root_param.ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL; + root_param.ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; + root_param.DescriptorTable.NumDescriptorRanges = ARRAY_SIZE(desc_range); + root_param.DescriptorTable.pDescriptorRanges = &desc_range[0]; + + memset(desc_range, 0, sizeof(desc_range)); + desc_range[0].NumDescriptors = 3; + desc_range[0].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV; + desc_range[0].OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND; + desc_range[1].NumDescriptors = 1; + desc_range[1].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_CBV; + desc_range[1].OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND; + + create_root_signature(context.device, &root_desc, &root_signature); + init_pipeline_state_desc(&pso_desc, root_signature, 0, &vs, &ps, NULL); + pso_desc.NumRenderTargets = 1; + pso_desc.RTVFormats[0] = DXGI_FORMAT_R32_FLOAT; + pso_desc.RasterizerState.CullMode = D3D12_CULL_MODE_NONE; + hr = ID3D12Device_CreateGraphicsPipelineState(context.device, &pso_desc, &IID_ID3D12PipelineState, (void **)&pso); + ok(SUCCEEDED(hr), "Failed to create pipeline hr #%x.\n", hr); + + gpu_heap = create_gpu_descriptor_heap(context.device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 32); + cpu_heap = create_cpu_descriptor_heap(context.device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 32); + + { + static float constant_uv[64] = { 59.0f, 61.0f }; + D3D12_CONSTANT_BUFFER_VIEW_DESC cbv_desc; + D3D12_CPU_DESCRIPTOR_HANDLE h; + cbv = create_upload_buffer(context.device, sizeof(constant_uv), constant_uv); + + cbv_desc.BufferLocation = ID3D12Resource_GetGPUVirtualAddress(cbv); + cbv_desc.SizeInBytes = sizeof(constant_uv); + + h = ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(gpu_heap); + h.ptr += ARRAY_SIZE(textures) * ID3D12Device_GetDescriptorHandleIncrementSize(context.device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); + ID3D12Device_CreateConstantBufferView(context.device, &cbv_desc, h); + + } + + for (i = 0; i < ARRAY_SIZE(textures); i++) + { + D3D12_SHADER_RESOURCE_VIEW_DESC srv_desc; + D3D12_UNORDERED_ACCESS_VIEW_DESC uav_desc; + D3D12_CPU_DESCRIPTOR_HANDLE gpu_h, cpu_h; + unsigned int j; + + textures[i] = create_default_texture2d(context.device, 8, 8, 1, 4, + DXGI_FORMAT_R32_FLOAT, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, + D3D12_RESOURCE_STATE_UNORDERED_ACCESS); + + gpu_h = ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(gpu_heap); + + srv_desc.Format = DXGI_FORMAT_R32_FLOAT; + srv_desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; + srv_desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D; + srv_desc.Texture2D.MipLevels = 4; + srv_desc.Texture2D.MostDetailedMip = 0; + srv_desc.Texture2D.ResourceMinLODClamp = 0.0f; + srv_desc.Texture2D.PlaneSlice = 0; + + gpu_h.ptr += i * ID3D12Device_GetDescriptorHandleIncrementSize(context.device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); + ID3D12Device_CreateShaderResourceView(context.device, textures[i], &srv_desc, gpu_h); + + uav_desc.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2D; + uav_desc.Format = DXGI_FORMAT_R32_FLOAT; + uav_desc.Texture2D.PlaneSlice = 0; + for (j = 0; j < 4; j++) + { + uav_desc.Texture2D.MipSlice = j; + gpu_h = ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(gpu_heap); + cpu_h = ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(cpu_heap); + gpu_h.ptr += (4 + 4 * i + j) * ID3D12Device_GetDescriptorHandleIncrementSize(context.device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); + cpu_h.ptr += (4 + 4 * i + j) * ID3D12Device_GetDescriptorHandleIncrementSize(context.device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); + ID3D12Device_CreateUnorderedAccessView(context.device, textures[i], NULL, &uav_desc, gpu_h); + ID3D12Device_CreateUnorderedAccessView(context.device, textures[i], NULL, &uav_desc, cpu_h); + } + } + + for (i = 0; i < 4 * ARRAY_SIZE(textures); i++) + { + D3D12_GPU_DESCRIPTOR_HANDLE gpu_h; + D3D12_CPU_DESCRIPTOR_HANDLE cpu_h; + const float values[4] = { (float)(i + 100), 0.0f, 0.0f, 0.0f }; + gpu_h = ID3D12DescriptorHeap_GetGPUDescriptorHandleForHeapStart(gpu_heap); + cpu_h = ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(cpu_heap); + gpu_h.ptr += (4 + i) * ID3D12Device_GetDescriptorHandleIncrementSize(context.device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); + cpu_h.ptr += (4 + i) * ID3D12Device_GetDescriptorHandleIncrementSize(context.device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); + ID3D12GraphicsCommandList_ClearUnorderedAccessViewFloat(context.list, gpu_h, cpu_h, textures[i / 4], values, 0, NULL); + } + + for (i = 0; i < ARRAY_SIZE(textures); i++) + transition_resource_state(context.list, textures[i], D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); + + ID3D12GraphicsCommandList_ClearRenderTargetView(context.list, context.rtv, white, 0, NULL); + ID3D12GraphicsCommandList_OMSetRenderTargets(context.list, 1, &context.rtv, TRUE, NULL); + ID3D12GraphicsCommandList_SetGraphicsRootSignature(context.list, root_signature); + ID3D12GraphicsCommandList_SetPipelineState(context.list, pso); + ID3D12GraphicsCommandList_SetDescriptorHeaps(context.list, 1, &gpu_heap); + ID3D12GraphicsCommandList_SetGraphicsRootDescriptorTable(context.list, 0, ID3D12DescriptorHeap_GetGPUDescriptorHandleForHeapStart(gpu_heap)); + ID3D12GraphicsCommandList_IASetPrimitiveTopology(context.list, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + ID3D12GraphicsCommandList_RSSetViewports(context.list, 1, &vp); + ID3D12GraphicsCommandList_RSSetScissorRects(context.list, 1, &scissor); + ID3D12GraphicsCommandList_DrawInstanced(context.list, 3, 4, 0, 0); + + transition_resource_state(context.list, context.render_target, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE); + get_texture_readback_with_command_list(context.render_target, 0, &rb, context.queue, context.list); + + for (i = 0; i < 4; i++) + { + static const float expected[4] = { 104.0f, 101.0f, 110.0f, 110.0f }; + unsigned int y = i >> 1; + unsigned int x = i & 1; + float value = get_readback_float(&rb, x, y); + /* i == 0 fails on AMD D3D12 and amdgpu-pro, so it might be okay to just ignore the D3D11 constant UV requirement ... */ + bug_if(i == 0) ok(value == expected[i], "Value at (%u, %u) has mismatch %f != %f\n", x, y, value, expected[i]); + } + + release_resource_readback(&rb); + + ID3D12RootSignature_Release(root_signature); + ID3D12Resource_Release(cbv); + for (i = 0; i < ARRAY_SIZE(textures); i++) + ID3D12Resource_Release(textures[i]); + ID3D12DescriptorHeap_Release(gpu_heap); + ID3D12DescriptorHeap_Release(cpu_heap); + ID3D12PipelineState_Release(pso); + destroy_test_context(&context); +} + +static void test_interpolation_non_uniform_control_flow_dxbc(void) +{ + test_interpolation_non_uniform_control_flow(false); +} + +static void test_interpolation_non_uniform_control_flow_dxil(void) +{ + test_interpolation_non_uniform_control_flow(true); +} + START_TEST(d3d12) { pfn_D3D12CreateDevice = get_d3d12_pfn(D3D12CreateDevice); @@ -51083,4 +51547,6 @@ START_TEST(d3d12) run_test(test_root_signature_priority); run_test(test_missing_bindings_root_signature); run_test(test_mismatching_pso_stages); + run_test(test_interpolation_non_uniform_control_flow_dxbc); + run_test(test_interpolation_non_uniform_control_flow_dxil); } |