Signed-off-by: Jan Sikorski jsikorski@codeweavers.com --- v3: also test inputs without a corresponding entry in the input layout --- dlls/d3d10core/tests/d3d10core.c | 98 ++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+)
diff --git a/dlls/d3d10core/tests/d3d10core.c b/dlls/d3d10core/tests/d3d10core.c index 927d79d90e9..a00ed87c706 100644 --- a/dlls/d3d10core/tests/d3d10core.c +++ b/dlls/d3d10core/tests/d3d10core.c @@ -18822,6 +18822,103 @@ static void test_dual_source_blend(void) release_test_context(&test_context); }
+static void test_unbound_streams(void) +{ + struct d3d10core_test_context test_context; + ID3D10PixelShader *ps; + ID3D10Device *device; + HRESULT hr; + + static const DWORD vs_code[] = + { +#if 0 + struct vs_ps + { + float4 position : SV_POSITION; + float4 color : COLOR0; + }; + + vs_ps vs_main(float4 position : POSITION, float4 color : COLOR0) + { + vs_ps result; + result.position = position; + result.color = color; + result.color.w = 1.0; + return result; + } +#endif + 0x43425844, 0x4a9efaec, 0xe2c6cdf5, 0x15dd28a7, 0xae68e320, 0x00000001, 0x00000154, 0x00000003, + 0x0000002c, 0x0000007c, 0x000000d0, 0x4e475349, 0x00000048, 0x00000002, 0x00000008, 0x00000038, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x00000041, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x0000070f, 0x49534f50, 0x4e4f4954, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000004c, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, 0x00000000, + 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000000f, 0x505f5653, + 0x5449534f, 0x004e4f49, 0x4f4c4f43, 0xabab0052, 0x52444853, 0x0000007c, 0x00010040, 0x0000001f, + 0x0300005f, 0x001010f2, 0x00000000, 0x0300005f, 0x00101072, 0x00000001, 0x04000067, 0x001020f2, + 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000001, 0x05000036, 0x001020f2, 0x00000000, + 0x00101e46, 0x00000000, 0x05000036, 0x00102072, 0x00000001, 0x00101246, 0x00000001, 0x05000036, + 0x00102082, 0x00000001, 0x00004001, 0x3f800000, 0x0100003e, + }; + + static const DWORD ps_code[] = + { +#if 0 + float4 ps_main(vs_ps input) : SV_TARGET + { + return input.color; + } +#endif + 0x43425844, 0xe2087fa6, 0xa35fbd95, 0x8e585b3f, 0x67890f54, 0x00000001, 0x000000f4, 0x00000003, + 0x0000002c, 0x00000080, 0x000000b4, 0x4e475349, 0x0000004c, 0x00000002, 0x00000008, 0x00000038, + 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x4f4c4f43, 0xabab0052, + 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054, 0x52444853, 0x00000038, 0x00000040, + 0x0000000e, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x05000036, + 0x001020f2, 0x00000000, 0x00101e46, 0x00000001, 0x0100003e, + }; + + static const float white[4] = {1.0f, 1.0f, 1.0f, 1.0f}; + static const struct vec4 black = {0}; + + static const D3D10_INPUT_ELEMENT_DESC layout_desc[] = + { + {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0}, + {"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 1, 16, D3D10_INPUT_PER_VERTEX_DATA, 0}, + }; + + if (!init_test_context(&test_context)) + return; + + device = test_context.device; + + /* Create default input layout */ + draw_color_quad(&test_context, &black); + + hr = ID3D10Device_CreatePixelShader(device, ps_code, sizeof(ps_code), &ps); + ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr); + + ID3D10Device_PSSetShader(device, ps); + ID3D10Device_ClearRenderTargetView(device, test_context.backbuffer_rtv, white); + + /* Draw with default input layout */ + draw_quad_vs(&test_context, vs_code, sizeof(vs_code)); + check_texture_color(test_context.backbuffer, 0xff000000, 1); + + ID3D10InputLayout_Release(test_context.input_layout); + hr = ID3D10Device_CreateInputLayout(device, layout_desc, ARRAY_SIZE(layout_desc), + vs_code, sizeof(vs_code), &test_context.input_layout); + ok(SUCCEEDED(hr), "Failed to create input layout, hr %#x.\n", hr); + + ID3D10Device_ClearRenderTargetView(device, test_context.backbuffer_rtv, white); + /* Draw with matching input layout */ + draw_quad_vs(&test_context, vs_code, sizeof(vs_code)); + check_texture_color(test_context.backbuffer, 0xff000000, 1); + + ID3D10PixelShader_Release(ps); + release_test_context(&test_context); +} + START_TEST(d3d10core) { unsigned int argc, i; @@ -18946,6 +19043,7 @@ START_TEST(d3d10core) queue_test(test_color_mask); queue_test(test_independent_blend); queue_test(test_dual_source_blend); + queue_test(test_unbound_streams);
run_queued_tests();