From 79ab945f7463d79a637460e6854d895a18c6c52e Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Wed, 24 May 2017 12:58:50 +0200 Subject: [PATCH] d3d10core/tests: Port SM4 continuec instruction test from d3d11. Signed-off-by: Sven Hesse Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d10core/tests/device.c | 115 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index 6abc79a7a44..b63ba872aff 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -9187,6 +9187,120 @@ static void test_sm4_breakc_instruction(void) release_test_context(&test_context); } +static void test_sm4_continuec_instruction(void) +{ + struct d3d10core_test_context test_context; + ID3D10PixelShader *ps; + ID3D10Device *device; + HRESULT hr; + + /* 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. */ + 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)) + return; + + device = test_context.device; + + hr = ID3D10Device_CreatePixelShader(device, ps_continuec_nz_code, sizeof(ps_continuec_nz_code), &ps); + ok(SUCCEEDED(hr), "Failed to create continuec_nz pixel shader, hr %#x.\n", hr); + ID3D10Device_PSSetShader(device, ps); + draw_quad(&test_context); + check_texture_color(test_context.backbuffer, 0xff00ff00, 0); + ID3D10PixelShader_Release(ps); + + hr = ID3D10Device_CreatePixelShader(device, ps_continuec_z_code, sizeof(ps_continuec_z_code), &ps); + ok(SUCCEEDED(hr), "Failed to create continuec_z pixel shader, hr %#x.\n", hr); + ID3D10Device_PSSetShader(device, ps); + draw_quad(&test_context); + check_texture_color(test_context.backbuffer, 0xff00ff00, 0); + ID3D10PixelShader_Release(ps); + + release_test_context(&test_context); +} + static void test_create_input_layout(void) { D3D10_INPUT_ELEMENT_DESC layout_desc[] = @@ -12447,6 +12561,7 @@ START_TEST(device) 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.4.GIT