Commit 47af2ac3 authored by Jan Sikorski's avatar Jan Sikorski Committed by Alexandre Julliard

d3d11/tests: Add input layout alignment tests.

parent 51604792
......@@ -17879,6 +17879,98 @@ static void test_create_input_layout(void)
ok(!refcount, "Device has %u references left.\n", refcount);
}
static void test_input_layout_alignment(void)
{
ID3D11InputLayout *layout;
ID3D11Device *device;
unsigned int i;
ULONG refcount;
HRESULT hr;
static const DWORD vs_code[] =
{
#if 0
float4 main(float4 position : POSITION) : SV_POSITION
{
return position;
}
#endif
0x43425844, 0xa7a2f22d, 0x83ff2560, 0xe61638bd, 0x87e3ce90, 0x00000001, 0x000000d8, 0x00000003,
0x0000002c, 0x00000060, 0x00000094, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x49534f50, 0x4e4f4954, 0xababab00,
0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000001, 0x00000003,
0x00000000, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x52444853, 0x0000003c, 0x00010040,
0x0000000f, 0x0300005f, 0x001010f2, 0x00000000, 0x04000067, 0x001020f2, 0x00000000, 0x00000001,
0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000000, 0x0100003e,
};
static const struct
{
D3D11_INPUT_ELEMENT_DESC elements[2];
HRESULT hr;
}
test_data[] =
{
{{
{"POSITION", 0, DXGI_FORMAT_R8_UINT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
{"COLOR", 0, DXGI_FORMAT_R16_UINT, 0, 2, D3D11_INPUT_PER_VERTEX_DATA, 0},
}, S_OK},
{{
{"POSITION", 0, DXGI_FORMAT_R8_UINT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
{"COLOR", 0, DXGI_FORMAT_R16_UINT, 0, 1, D3D11_INPUT_PER_VERTEX_DATA, 0},
}, E_INVALIDARG},
{{
{"POSITION", 0, DXGI_FORMAT_R8_UINT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
{"COLOR", 0, DXGI_FORMAT_R8_UINT, 0, 1, D3D11_INPUT_PER_VERTEX_DATA, 0},
}, S_OK},
{{
{"POSITION", 0, DXGI_FORMAT_R16_UINT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
{"COLOR", 0, DXGI_FORMAT_R32_UINT, 0, 2, D3D11_INPUT_PER_VERTEX_DATA, 0},
}, E_INVALIDARG},
{{
{"POSITION", 0, DXGI_FORMAT_R16_UINT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
{"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 2, D3D11_INPUT_PER_VERTEX_DATA, 0},
}, E_INVALIDARG},
{{
{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
{"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 16, D3D11_INPUT_PER_VERTEX_DATA, 0},
}, S_OK},
{{
{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
{"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 17, D3D11_INPUT_PER_VERTEX_DATA, 0},
}, E_INVALIDARG},
{{
{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
{"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 18, D3D11_INPUT_PER_VERTEX_DATA, 0},
}, E_INVALIDARG},
{{
{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
{"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 19, D3D11_INPUT_PER_VERTEX_DATA, 0},
}, E_INVALIDARG},
{{
{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
{"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0},
}, S_OK},
};
if (!(device = create_device(NULL)))
{
skip("Failed to create device.\n");
return;
}
for (i = 0; i < ARRAY_SIZE(test_data); ++i)
{
hr = ID3D11Device_CreateInputLayout(device, test_data[i].elements, 2, vs_code, sizeof(vs_code), &layout);
ok(hr == test_data[i].hr, "Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, test_data[i].hr);
if (SUCCEEDED(hr))
ID3D11InputLayout_Release(layout);
}
refcount = ID3D11Device_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
}
static void test_input_assembler(void)
{
enum layout_id
......@@ -31759,6 +31851,7 @@ START_TEST(d3d11)
queue_test(test_sm4_discard_instruction);
queue_test(test_sm5_swapc_instruction);
queue_test(test_create_input_layout);
queue_test(test_input_layout_alignment);
queue_test(test_input_assembler);
queue_test(test_null_sampler);
queue_test(test_check_feature_support);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment