Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d10core/tests/device.c | 80 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 73 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index 6982a4ed14b0..421512f40cc9 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -10583,6 +10583,7 @@ static void test_shader_interstage_interface(void) ID3D10Device *device; UINT stride, offset; ID3D10Buffer *vb; + unsigned int i; HRESULT hr;
static const DWORD vs_code[] = @@ -10655,6 +10656,56 @@ static void test_shader_interstage_interface(void) 0x0010000a, 0x00000000, 0x07000000, 0x00102012, 0x00000000, 0x0010101a, 0x00000001, 0x0010100a, 0x00000002, 0x05000036, 0x001020c2, 0x00000000, 0x001012a6, 0x00000001, 0x0100003e, }; + static const DWORD ps_partial_input_code[] = + { +#if 0 + void main(float4 position : SV_Position, float2 t0 : TEXCOORD0, + nointerpolation float t1 : TEXCOORD1, uint t2 : TEXCOORD2, + uint t3 : TEXCOORD3, out float4 o : SV_Target) + { + o.x = t0.y + t1; + o.y = t2 + t3; + o.z = 0.0f; + o.w = t0.x; + } +#endif + 0x43425844, 0x5b1db356, 0xaa5a5e9d, 0xb916a081, 0x61e6dcb1, 0x00000001, 0x000001cc, 0x00000003, + 0x0000002c, 0x000000cc, 0x00000100, 0x4e475349, 0x00000098, 0x00000005, 0x00000008, 0x00000080, + 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000008c, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000303, 0x0000008c, 0x00000001, 0x00000000, 0x00000003, 0x00000002, + 0x00000101, 0x0000008c, 0x00000002, 0x00000000, 0x00000001, 0x00000002, 0x00000202, 0x0000008c, + 0x00000003, 0x00000000, 0x00000001, 0x00000002, 0x00000404, 0x505f5653, 0x7469736f, 0x006e6f69, + 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, + 0x52444853, 0x000000c4, 0x00000040, 0x00000031, 0x03001062, 0x00101032, 0x00000001, 0x03000862, + 0x00101012, 0x00000002, 0x03000862, 0x00101022, 0x00000002, 0x03000862, 0x00101042, 0x00000002, + 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x0700001e, 0x00100012, 0x00000000, + 0x0010102a, 0x00000002, 0x0010101a, 0x00000002, 0x05000056, 0x00102022, 0x00000000, 0x0010000a, + 0x00000000, 0x07000000, 0x00102012, 0x00000000, 0x0010101a, 0x00000001, 0x0010100a, 0x00000002, + 0x05000036, 0x00102042, 0x00000000, 0x00004001, 0x00000000, 0x05000036, 0x00102082, 0x00000000, + 0x0010100a, 0x00000001, 0x0100003e, + }; + static const DWORD ps_single_input_code[] = + { +#if 0 + void main(float4 position : SV_Position, float2 t0 : TEXCOORD0, out float4 o : SV_Target) + { + o.x = t0.x; + o.y = t0.y; + o.z = 1.0f; + o.w = 2.0f; + } +#endif + 0x43425844, 0x7cc601b6, 0xc65b8bdb, 0x54d0f606, 0x9cc74d3d, 0x00000001, 0x00000118, 0x00000003, + 0x0000002c, 0x00000084, 0x000000b8, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, + 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000303, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, + 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000058, + 0x00000040, 0x00000016, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, + 0x05000036, 0x00102032, 0x00000000, 0x00101046, 0x00000001, 0x08000036, 0x001020c2, 0x00000000, + 0x00004002, 0x00000000, 0x00000000, 0x3f800000, 0x40000000, 0x0100003e, + }; static const D3D10_INPUT_ELEMENT_DESC layout_desc[] = { {"SV_POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0}, @@ -10681,7 +10732,18 @@ static void test_shader_interstage_interface(void) {{ 1.0f, 1.0f}, {3.0f, 5.0f}, 5.0f, 2, 6, 7.0f}, }; static const float white[] = {1.0f, 1.0f, 1.0f, 1.0f}; - static const struct vec4 expected_result = {10.0f, 8.0f, 7.0f, 3.0f}; + static const struct + { + const DWORD *ps_code; + size_t ps_size; + struct vec4 expected_result; + } + tests[] = + { + {ps_code, sizeof(ps_code), {10.0f, 8.0f, 7.0f, 3.0f}}, + {ps_partial_input_code, sizeof(ps_partial_input_code), {10.0f, 8.0f, 0.0f, 3.0f}}, + {ps_single_input_code, sizeof(ps_single_input_code), {3.0f, 5.0f, 1.0f, 2.0f}}, + };
if (!init_test_context(&test_context)) return; @@ -10690,8 +10752,6 @@ static void test_shader_interstage_interface(void)
hr = ID3D10Device_CreateVertexShader(device, vs_code, sizeof(vs_code), &vs); ok(SUCCEEDED(hr), "Failed to create vertex shader, hr %#x.\n", hr); - hr = ID3D10Device_CreatePixelShader(device, ps_code, sizeof(ps_code), &ps); - ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr);
ID3D10Texture2D_GetDesc(test_context.backbuffer, &texture_desc); texture_desc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; @@ -10711,20 +10771,26 @@ static void test_shader_interstage_interface(void)
ID3D10Device_OMSetRenderTargets(device, 1, &rtv, NULL);
- ID3D10Device_PSSetShader(device, ps); ID3D10Device_VSSetShader(device, vs); ID3D10Device_IASetInputLayout(device, input_layout); ID3D10Device_IASetPrimitiveTopology(device, D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); offset = 0; stride = sizeof(*quad); ID3D10Device_IASetVertexBuffers(device, 0, 1, &vb, &stride, &offset); - ID3D10Device_Draw(device, 4, 0); - check_texture_vec4(render_target, &expected_result, 0); + + for (i = 0; i < ARRAY_SIZE(tests); ++i) + { + hr = ID3D10Device_CreatePixelShader(device, tests[i].ps_code, tests[i].ps_size, &ps); + ok(hr == S_OK, "Failed to create pixel shader, hr %#x.\n", hr); + ID3D10Device_PSSetShader(device, ps); + ID3D10Device_Draw(device, 4, 0); + check_texture_vec4(render_target, &tests[i].expected_result, 0); + ID3D10PixelShader_Release(ps); + }
ID3D10InputLayout_Release(input_layout); ID3D10RenderTargetView_Release(rtv); ID3D10Texture2D_Release(render_target); - ID3D10PixelShader_Release(ps); ID3D10VertexShader_Release(vs); ID3D10Buffer_Release(vb); release_test_context(&test_context);