[PATCH 2/6] d3d10core/tests: Added test for unbound input streams.

Jan Sikorski jsikorski at codeweavers.com
Fri Apr 16 03:05:31 CDT 2021


With a fresh look I noticed where the crash on Vista was coming from.. I’ll send a v2 shortly.

> On 15 Apr 2021, at 18:39, Jan Sikorski <jsikorski at codeweavers.com> wrote:
> 
> Signed-off-by: Jan Sikorski <jsikorski at codeweavers.com>
> ---
> dlls/d3d10core/tests/d3d10core.c | 106 +++++++++++++++++++++++++++++++
> 1 file changed, 106 insertions(+)
> 
> diff --git a/dlls/d3d10core/tests/d3d10core.c b/dlls/d3d10core/tests/d3d10core.c
> index e0cb40de89b..2b0c82bfdd2 100644
> --- a/dlls/d3d10core/tests/d3d10core.c
> +++ b/dlls/d3d10core/tests/d3d10core.c
> @@ -1258,6 +1258,18 @@ static BOOL is_d3d11_interface_available(ID3D10Device *device)
>     return SUCCEEDED(hr);
> }
> 
> +static BOOL is_windows_7_or_greater(void)
> +{
> +    OSVERSIONINFOEXA version = { sizeof(version) };
> +    DWORDLONG mask = VerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL);
> +    mask = VerSetConditionMask(mask, VER_MINORVERSION, VER_GREATER_EQUAL);
> +
> +    version.dwMajorVersion = 6;
> +    version.dwMinorVersion = 1;
> +
> +    return VerifyVersionInfoA(&version, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, mask);
> +}
> +
> #define SWAPCHAIN_FLAG_SHADER_INPUT             0x1
> 
> struct swapchain_desc
> @@ -18822,6 +18834,99 @@ 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 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 (broken(!is_windows_7_or_greater()))
> +    {
> +        skip("Crashes on Windows Vista.\n");
> +        return;
> +    }
> +
> +    if (!init_test_context(&test_context))
> +        return;
> +
> +    device = test_context.device;
> +
> +    hr = ID3D10Device_CreatePixelShader(device, ps_code, sizeof(ps_code), &ps);
> +    ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr);
> +
> +    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_PSSetShader(device, ps);
> +    ID3D10Device_ClearRenderTargetView(device, test_context.backbuffer_rtv, white);
> +    draw_quad_vs(&test_context, vs_code, sizeof(vs_code));
> +    check_texture_color(test_context.backbuffer, 0xff000000, 1);
> +
> +    ID3D10PixelShader_Release(ps);
> +    ID3D10InputLayout_Release(test_context.input_layout);
> +    release_test_context(&test_context);
> +}
> +
> START_TEST(d3d10core)
> {
>     unsigned int argc, i;
> @@ -18946,6 +19051,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();
> 
> -- 
> 2.31.0
> 




More information about the wine-devel mailing list