From: Sven Hesse Subject: d3d11/tests: Add test for the SM4 instruction continuec. Message-Id: <20170516154723.16988-1-drmccoy@drmccoy.de> Date: Tue, 16 May 2017 17:47:23 +0200 To get fxc to output continuec_z/continuec_nz instead of an if-block with a normal continue inside, the shaders have been compiled with the /Gfa flag. Signed-off-by: Sven Hesse --- dlls/d3d11/tests/d3d11.c | 114 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 5b8584530c..8c82abf983 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -10789,6 +10789,119 @@ static void test_sm4_breakc_instruction(void) release_test_context(&test_context); } +static void test_sm4_continuec_instruction(void) +{ + struct d3d11_test_context test_context; + ID3D11DeviceContext *context; + ID3D11PixelShader *ps; + ID3D11Device *device; + HRESULT hr; + + static const DWORD ps_continuec_nz_code[] = + { +#if 0 + float4 main() : SV_TARGET + { + uint counter = 0; + int i = -1; + + while (i < 255) { + ++i; + + if (i != 0) + continue; + + ++counter; + } + + if (counter == 1) + return float4(0.0f, 1.0f, 0.0f, 1.0f); + else + return float4(1.0f, 0.0f, 0.0f, 1.0f); + } +#endif + 0x43425844, 0xaadaac96, 0xbe00fdfb, 0x29356be0, 0x47e79bd6, 0x00000001, 0x00000208, 0x00000003, + 0x0000002c, 0x0000003c, 0x00000070, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054, 0x52444853, 0x00000190, 0x00000040, 0x00000064, + 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000003, 0x08000036, 0x00100032, 0x00000000, + 0x00004002, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x01000030, 0x07000021, 0x00100042, + 0x00000000, 0x0010001a, 0x00000000, 0x00004001, 0x000000ff, 0x03040003, 0x0010002a, 0x00000000, + 0x0700001e, 0x00100022, 0x00000001, 0x0010001a, 0x00000000, 0x00004001, 0x00000001, 0x09000037, + 0x00100022, 0x00000002, 0x0010001a, 0x00000001, 0x0010001a, 0x00000001, 0x00004001, 0x00000000, + 0x05000036, 0x00100012, 0x00000002, 0x0010000a, 0x00000000, 0x05000036, 0x00100032, 0x00000000, + 0x00100046, 0x00000002, 0x05000036, 0x00100042, 0x00000000, 0x0010001a, 0x00000001, 0x03040008, + 0x0010002a, 0x00000000, 0x0700001e, 0x00100012, 0x00000001, 0x0010000a, 0x00000000, 0x00004001, + 0x00000001, 0x05000036, 0x00100032, 0x00000000, 0x00100046, 0x00000001, 0x01000016, 0x07000020, + 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x00000001, 0x08000036, 0x001020f2, + 0x00000000, 0x00004002, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x0304003f, 0x0010000a, + 0x00000000, 0x08000036, 0x001020f2, 0x00000000, 0x00004002, 0x3f800000, 0x00000000, 0x00000000, + 0x3f800000, 0x0100003e, + + }; + static const DWORD ps_continuec_z_code[] = + { +#if 0 + float4 main() : SV_TARGET + { + uint counter = 0; + int i = -1; + + while (i < 255) { + ++i; + + if (i == 0) + continue; + + ++counter; + } + + if (counter == 255) + return float4(0.0f, 1.0f, 0.0f, 1.0f); + else + return float4(1.0f, 0.0f, 0.0f, 1.0f); + } +#endif + 0x43425844, 0x0322b23d, 0x52b25dc8, 0xa625f5f1, 0x271e3f46, 0x00000001, 0x000001d0, 0x00000003, + 0x0000002c, 0x0000003c, 0x00000070, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054, 0x52444853, 0x00000158, 0x00000040, 0x00000056, + 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x08000036, 0x00100032, 0x00000000, + 0x00004002, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x01000030, 0x07000021, 0x00100042, + 0x00000000, 0x0010001a, 0x00000000, 0x00004001, 0x000000ff, 0x03040003, 0x0010002a, 0x00000000, + 0x0700001e, 0x00100022, 0x00000001, 0x0010001a, 0x00000000, 0x00004001, 0x00000001, 0x05000036, + 0x00100042, 0x00000001, 0x0010000a, 0x00000000, 0x05000036, 0x00100072, 0x00000000, 0x00100966, + 0x00000001, 0x03000008, 0x0010002a, 0x00000000, 0x0700001e, 0x00100012, 0x00000001, 0x0010000a, + 0x00000000, 0x00004001, 0x00000001, 0x05000036, 0x00100032, 0x00000000, 0x00100046, 0x00000001, + 0x01000016, 0x07000020, 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x000000ff, + 0x08000036, 0x001020f2, 0x00000000, 0x00004002, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, + 0x0304003f, 0x0010000a, 0x00000000, 0x08000036, 0x001020f2, 0x00000000, 0x00004002, 0x3f800000, + 0x00000000, 0x00000000, 0x3f800000, 0x0100003e, + }; + + if (!init_test_context(&test_context, NULL)) + return; + + device = test_context.device; + context = test_context.immediate_context; + + hr = ID3D11Device_CreatePixelShader(device, ps_continuec_nz_code, sizeof(ps_continuec_nz_code), NULL, &ps); + ok(SUCCEEDED(hr), "Failed to create continuec_nz pixel shader, hr %#x.\n", hr); + ID3D11DeviceContext_PSSetShader(context, ps, NULL, 0); + draw_quad(&test_context); + check_texture_color(test_context.backbuffer, 0xff00ff00, 0); + ID3D11PixelShader_Release(ps); + + hr = ID3D11Device_CreatePixelShader(device, ps_continuec_z_code, sizeof(ps_continuec_z_code), NULL, &ps); + ok(SUCCEEDED(hr), "Failed to create continuec_z pixel shader, hr %#x.\n", hr); + ID3D11DeviceContext_PSSetShader(context, ps, NULL, 0); + draw_quad(&test_context); + check_texture_color(test_context.backbuffer, 0xff00ff00, 0); + ID3D11PixelShader_Release(ps); + + release_test_context(&test_context); +} + static void test_create_input_layout(void) { D3D11_INPUT_ELEMENT_DESC layout_desc[] = @@ -18316,6 +18429,7 @@ START_TEST(d3d11) test_shader_stage_input_output_matching(); test_sm4_if_instruction(); test_sm4_breakc_instruction(); + test_sm4_continuec_instruction(); test_create_input_layout(); test_input_assembler(); test_null_sampler(); -- 2.11.0