From: Józef Kucia Subject: [PATCH vkd3d 5/8] tests: Add tests for continue shader instructions. Message-Id: <20180924082524.18955-5-joseph.kucia@gmail.com> Date: Mon, 24 Sep 2018 10:25:21 +0200 From: Józef Kucia Signed-off-by: Józef Kucia --- tests/d3d12.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/tests/d3d12.c b/tests/d3d12.c index 9bb6861f7757..49e3b2371d4a 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -5632,6 +5632,84 @@ static void test_shader_instructions(void) 0x00004002, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x0100003e, 0x01000015, 0x0100003e, }; static const D3D12_SHADER_BYTECODE ps_breakc_z = {ps_breakc_z_code, sizeof(ps_breakc_z_code)}; + static const DWORD ps_continue_code[] = + { +#if 0 + float4 main() : SV_TARGET + { + uint counter = 0; + + for (uint i = 0; i < 255; ++i) + { + if (i == 10) + continue; + ++counter; + } + + return float4(counter, 0.0f, 0.0f, 0.0f); + } +#endif + 0x43425844, 0x8cab8e1f, 0x527560f9, 0x04eb888b, 0x20d89b05, 0x00000001, 0x000001c4, 0x00000003, + 0x0000002c, 0x0000003c, 0x00000070, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054, 0x58454853, 0x0000014c, 0x00000050, 0x00000053, + 0x0100086a, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x05000036, 0x00100022, + 0x00000000, 0x00004001, 0x0000000b, 0x08000036, 0x001000c2, 0x00000000, 0x00004002, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x01000030, 0x07000050, 0x00100012, 0x00000001, 0x0010002a, + 0x00000000, 0x00004001, 0x000000ff, 0x03040003, 0x0010000a, 0x00000001, 0x07000020, 0x00100012, + 0x00000001, 0x0010002a, 0x00000000, 0x00004001, 0x0000000a, 0x0304001f, 0x0010000a, 0x00000001, + 0x05000036, 0x00100012, 0x00000000, 0x0010003a, 0x00000000, 0x05000036, 0x001000c2, 0x00000000, + 0x00100156, 0x00000000, 0x01000007, 0x01000015, 0x0700001e, 0x00100082, 0x00000000, 0x0010003a, + 0x00000000, 0x00004001, 0x00000001, 0x0700001e, 0x00100042, 0x00000000, 0x0010002a, 0x00000000, + 0x00004001, 0x00000001, 0x01000016, 0x05000056, 0x00102012, 0x00000000, 0x0010003a, 0x00000000, + 0x08000036, 0x001020e2, 0x00000000, 0x00004002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x0100003e, + }; + static const D3D12_SHADER_BYTECODE ps_continue = {ps_continue_code, sizeof(ps_continue_code)}; + static const DWORD ps_continuec_nz_code[] = + { +#if 0 + float4 main() : SV_TARGET + { + uint counter = 0; + + for (uint i = 0; i < 255; ++i) + { + ++counter; + if (i % 2 == 0) + continue; + ++counter; + if (i != 0) + continue; + ++counter; + } + + return float4(counter, 0.0f, 0.0f, 0.0f); + } +#endif + /* compiled with /Gfa */ + 0x43425844, 0xf35d8ce6, 0x54988f56, 0x5848863e, 0xa1618498, 0x00000001, 0x00000278, 0x00000003, + 0x0000002c, 0x0000003c, 0x00000070, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054, 0x58454853, 0x00000200, 0x00000050, 0x00000080, + 0x0100086a, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x08000036, 0x00100032, + 0x00000000, 0x00004002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x01000030, 0x07000050, + 0x00100042, 0x00000000, 0x0010001a, 0x00000000, 0x00004001, 0x000000ff, 0x03040003, 0x0010002a, + 0x00000000, 0x0700001e, 0x00100042, 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x00000001, + 0x07000001, 0x00100082, 0x00000000, 0x0010001a, 0x00000000, 0x00004001, 0x00000001, 0x0700001e, + 0x00100012, 0x00000001, 0x0010001a, 0x00000000, 0x00004001, 0x00000001, 0x09000037, 0x00100022, + 0x00000001, 0x0010003a, 0x00000000, 0x0010001a, 0x00000000, 0x0010000a, 0x00000001, 0x05000036, + 0x00100012, 0x00000000, 0x0010002a, 0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010001a, + 0x00000001, 0x03000008, 0x0010003a, 0x00000000, 0x0700001e, 0x00100042, 0x00000000, 0x0010000a, + 0x00000000, 0x00004001, 0x00000002, 0x07000027, 0x00100082, 0x00000000, 0x0010001a, 0x00000000, + 0x00004001, 0x00000000, 0x09000037, 0x00100022, 0x00000000, 0x0010001a, 0x00000000, 0x0010000a, + 0x00000001, 0x00004001, 0x00000000, 0x05000036, 0x00100032, 0x00000000, 0x00100a66, 0x00000000, + 0x03040008, 0x0010003a, 0x00000000, 0x0700001e, 0x00100012, 0x00000000, 0x0010000a, 0x00000000, + 0x00004001, 0x00000003, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x01000016, + 0x05000056, 0x00102012, 0x00000000, 0x0010000a, 0x00000000, 0x08000036, 0x001020e2, 0x00000000, + 0x00004002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0100003e, + }; + static const D3D12_SHADER_BYTECODE ps_continuec_nz = {ps_continuec_nz_code, sizeof(ps_continuec_nz_code)}; static const DWORD ps_src_modifiers_code[] = { #if 0 @@ -6646,6 +6724,7 @@ static void test_shader_instructions(void) struct uvec4 u; struct ivec4 i; } output; + bool skip_on_warp; } tests[] = { @@ -6733,6 +6812,9 @@ static void test_shader_instructions(void) {&ps_breakc_nz, {}, {{0.0f, 1.0f, 0.0f, 1.0f}}}, {&ps_breakc_z, {}, {{0.0f, 1.0f, 0.0f, 1.0f}}}, + {&ps_continue, {}, {{254.0f}}, TRUE}, + {&ps_continuec_nz, {}, {{509.0f}}}, + {&ps_src_modifiers, {{ 1.0f, 1.0f, 1.0f, 2.0f}}, {{-1.0f, 1.0f, -1.0f, -2.0f}}}, {&ps_src_modifiers, {{-1.0f, -1.0f, -1.0f, -2.0f}}, {{ 1.0f, 1.0f, -1.0f, -2.0f}}}, @@ -7384,6 +7466,12 @@ static void test_shader_instructions(void) current_ps = NULL; for (i = 0; i < ARRAY_SIZE(tests); ++i) { + if (tests[i].skip_on_warp && use_warp_device) + { + skip("Skipping shader test on WARP.\n"); + continue; + } + if (current_ps != tests[i].ps) { if (context.pipeline_state) -- 2.16.4