tests: Add signature reflection test with structs.

This commit is contained in:
Francisco Casas 2024-10-19 03:24:34 -03:00 committed by Henri Verbeet
parent fb2b974466
commit d9b631182e
Notes: Henri Verbeet 2024-10-22 20:54:15 +02:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1193
2 changed files with 23 additions and 1 deletions

View File

@ -30,7 +30,8 @@ shader model < 6.0
// 1. Arrays always start on .x
// 2. When placing a scalar or vector, search through the allocated slots for space *vertically*
// (So check if you can place at o1.y, then o2.y, o3.y before o1.z, o2.z, etc.)
// 3. Elements with different interpolation cannot share a slot
// 3. Elements with different interpolation cannot share a slot.
// 4. The first field of a struct is always aligned.
struct data
{
float4 position : SV_Position; // Should be placed in o0

View File

@ -2356,6 +2356,26 @@ static void test_signature_reflection(void)
{"TEXCOORD", 2, 3, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0x1},
};
/* Only the first element of structs is aligned. */
static const char ps12_source[] =
"struct apple\n"
"{\n"
" float b : SEM_B; // Only this one is aligned.\n"
" float c : SEM_C;\n"
"};\n"
"\n"
" float4 main(float a : SEM_A, apple ap) : sv_target\n"
"{\n"
" return 0;\n"
"}\n";
static const D3D12_SIGNATURE_PARAMETER_DESC ps12_inputs[] =
{
{"SEM_A", 0, 0, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0x1},
{"SEM_C", 0, 0, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0x2},
{"SEM_B", 0, 1, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0x1},
};
static const char vs4_source[] =
"struct st\n"
"{\n"
@ -2678,6 +2698,7 @@ static void test_signature_reflection(void)
{vs3_source, "vs_4_0", false, vs3_inputs, ARRAY_SIZE(vs3_inputs), vs3_outputs, ARRAY_SIZE(vs3_outputs), NULL, 0, true},
{ps10_source, "ps_4_0", false, ps10_inputs, ARRAY_SIZE(ps10_inputs), ps_outputs_simple, ARRAY_SIZE(ps_outputs_simple), NULL, 0, true},
{ps11_source, "ps_4_0", false, ps11_inputs, ARRAY_SIZE(ps11_inputs), ps_outputs_simple, ARRAY_SIZE(ps_outputs_simple), NULL, 0, true},
{ps12_source, "ps_4_0", false, ps12_inputs, ARRAY_SIZE(ps12_inputs), ps_outputs_simple, ARRAY_SIZE(ps_outputs_simple), NULL, 0, true},
{vs4_source, "vs_4_0", false, vs4_inputs, ARRAY_SIZE(vs4_inputs), vs4_outputs, ARRAY_SIZE(vs4_outputs), NULL, 0, true},
{vs5_source, "vs_4_0", false, vs5_inputs, ARRAY_SIZE(vs5_inputs), vs5_outputs, ARRAY_SIZE(vs5_outputs), NULL, 0, true},
{hs1_source, "hs_5_0", false, NULL, 0, hs1_outputs, ARRAY_SIZE(hs1_outputs), hs1_patch_constants, ARRAY_SIZE(hs1_patch_constants)},