mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 14:24:07 +00:00
d3dcompiler/tests: Test d3d12 interface in test_reflection_bound_resources().
Signed-off-by: Paul Gofman <pgofman@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
5d2596ad8a
commit
1690b6b475
|
@ -1084,10 +1084,11 @@ static void test_reflection_desc_ps_output(void)
|
|||
}
|
||||
|
||||
/*
|
||||
* fxc.exe /E PS /Tps_4_0 /Fx
|
||||
* fxc.exe /E PS /Tps_4_0 /Fo
|
||||
*/
|
||||
#if 0
|
||||
Texture2D tex1;
|
||||
Texture2D tex1[2];
|
||||
Texture2D tex2;
|
||||
SamplerState sam
|
||||
{
|
||||
Filter = MIN_MAG_MIP_LINEAR;
|
||||
|
@ -1107,7 +1108,7 @@ cbuffer c2
|
|||
|
||||
float4 PS(float2 uv : TEXCOORD0) : sv_target
|
||||
{
|
||||
float4 q = tex1.Sample(sam, uv);
|
||||
float4 q = tex1[0].Sample(sam, uv) + tex1[1].Sample(sam, uv) + tex2.Sample(sam, uv);
|
||||
q.x = q.x + x;
|
||||
q.w = q.w + y[0] + y[1] + t;
|
||||
return q;
|
||||
|
@ -1115,53 +1116,62 @@ float4 PS(float2 uv : TEXCOORD0) : sv_target
|
|||
#endif
|
||||
static const DWORD test_reflection_bound_resources_blob[] =
|
||||
{
|
||||
0x43425844, 0xe4af0279, 0x690268fc, 0x76bf6a72, 0xe5aff43b, 0x00000001, 0x000003f4, 0x00000005,
|
||||
0x00000034, 0x000001e8, 0x0000021c, 0x00000250, 0x00000378, 0x46454452, 0x000001ac, 0x00000002,
|
||||
0x000000ac, 0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x0000017a, 0x0000009c, 0x00000003,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x000000a0, 0x00000002,
|
||||
0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000c, 0x000000a5, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x000000a8, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x006d6173, 0x31786574,
|
||||
0x00316300, 0xab003263, 0x000000a5, 0x00000003, 0x000000dc, 0x00000030, 0x00000000, 0x00000000,
|
||||
0x000000a8, 0x00000001, 0x00000160, 0x00000010, 0x00000000, 0x00000000, 0x00000124, 0x00000000,
|
||||
0x00000004, 0x00000002, 0x00000128, 0x00000000, 0x00000138, 0x00000010, 0x00000014, 0x00000002,
|
||||
0x0000013c, 0x00000000, 0x0000014c, 0x00000024, 0x00000004, 0x00000000, 0x00000150, 0x00000000,
|
||||
0xabab0078, 0x00030000, 0x00010001, 0x00000000, 0x00000000, 0xabab0079, 0x00030000, 0x00010001,
|
||||
0x00000002, 0x00000000, 0xabab007a, 0x00020000, 0x00010001, 0x00000000, 0x00000000, 0x00000178,
|
||||
0x00000000, 0x00000004, 0x00000002, 0x00000128, 0x00000000, 0x694d0074, 0x736f7263, 0x2074666f,
|
||||
0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39,
|
||||
0x31332e32, 0xab003131, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000,
|
||||
0x00000000, 0x00000003, 0x00000000, 0x00000303, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f,
|
||||
0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
|
||||
0x0000000f, 0x745f7673, 0x65677261, 0xabab0074, 0x52444853, 0x00000120, 0x00000040, 0x00000048,
|
||||
0x04000059, 0x00208e46, 0x00000000, 0x00000003, 0x04000059, 0x00208e46, 0x00000001, 0x00000001,
|
||||
0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062,
|
||||
0x00101032, 0x00000000, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045,
|
||||
0x001000f2, 0x00000000, 0x00101046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000,
|
||||
0x08000000, 0x00100082, 0x00000000, 0x0010003a, 0x00000000, 0x0020800a, 0x00000000, 0x00000001,
|
||||
0x08000000, 0x00100082, 0x00000000, 0x0010003a, 0x00000000, 0x0020800a, 0x00000000, 0x00000002,
|
||||
0x08000000, 0x00102082, 0x00000000, 0x0010003a, 0x00000000, 0x0020800a, 0x00000001, 0x00000000,
|
||||
0x08000000, 0x00102012, 0x00000000, 0x0010000a, 0x00000000, 0x0020800a, 0x00000000, 0x00000000,
|
||||
0x05000036, 0x00102062, 0x00000000, 0x00100656, 0x00000000, 0x0100003e, 0x54415453, 0x00000074,
|
||||
0x00000007, 0x00000001, 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000000, 0x00000001,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x43425844, 0x003472ed, 0xe3436185, 0xcc1faad3, 0xfdac0a07, 0x00000001, 0x000004b0, 0x00000005,
|
||||
0x00000034, 0x00000204, 0x00000238, 0x0000026c, 0x00000434, 0x46454452, 0x000001c8, 0x00000002,
|
||||
0x000000d0, 0x00000005, 0x0000001c, 0xffff0400, 0x00000100, 0x0000019e, 0x000000bc, 0x00000003,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x000000c0, 0x00000002,
|
||||
0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000002, 0x0000000c, 0x000000c5, 0x00000002,
|
||||
0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000c, 0x000000ca, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x000000cd, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x006d6173, 0x31786574,
|
||||
0x78657400, 0x31630032, 0x00326300, 0x000000ca, 0x00000003, 0x00000100, 0x00000030, 0x00000000,
|
||||
0x00000000, 0x000000cd, 0x00000001, 0x00000184, 0x00000010, 0x00000000, 0x00000000, 0x00000148,
|
||||
0x00000000, 0x00000004, 0x00000002, 0x0000014c, 0x00000000, 0x0000015c, 0x00000010, 0x00000014,
|
||||
0x00000002, 0x00000160, 0x00000000, 0x00000170, 0x00000024, 0x00000004, 0x00000000, 0x00000174,
|
||||
0x00000000, 0xabab0078, 0x00030000, 0x00010001, 0x00000000, 0x00000000, 0xabab0079, 0x00030000,
|
||||
0x00010001, 0x00000002, 0x00000000, 0xabab007a, 0x00020000, 0x00010001, 0x00000000, 0x00000000,
|
||||
0x0000019c, 0x00000000, 0x00000004, 0x00000002, 0x0000014c, 0x00000000, 0x694d0074, 0x736f7263,
|
||||
0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, 0x72656c69, 0x2e303120,
|
||||
0xabab0031, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
|
||||
0x00000003, 0x00000000, 0x00000303, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c,
|
||||
0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f,
|
||||
0x745f7673, 0x65677261, 0xabab0074, 0x52444853, 0x000001c0, 0x00000040, 0x00000070, 0x04000059,
|
||||
0x00208e46, 0x00000000, 0x00000003, 0x04000059, 0x00208e46, 0x00000001, 0x00000001, 0x0300005a,
|
||||
0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000,
|
||||
0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555, 0x03001062, 0x00101032,
|
||||
0x00000000, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2,
|
||||
0x00000000, 0x00101046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045,
|
||||
0x001000f2, 0x00000001, 0x00101046, 0x00000000, 0x00107e46, 0x00000001, 0x00106000, 0x00000000,
|
||||
0x07000000, 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x09000045,
|
||||
0x001000f2, 0x00000001, 0x00101046, 0x00000000, 0x00107e46, 0x00000002, 0x00106000, 0x00000000,
|
||||
0x07000000, 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x08000000,
|
||||
0x00100082, 0x00000000, 0x0010003a, 0x00000000, 0x0020800a, 0x00000000, 0x00000001, 0x08000000,
|
||||
0x00100082, 0x00000000, 0x0010003a, 0x00000000, 0x0020800a, 0x00000000, 0x00000002, 0x08000000,
|
||||
0x00102082, 0x00000000, 0x0010003a, 0x00000000, 0x0020800a, 0x00000001, 0x00000000, 0x08000000,
|
||||
0x00102012, 0x00000000, 0x0010000a, 0x00000000, 0x0020800a, 0x00000000, 0x00000000, 0x05000036,
|
||||
0x00102062, 0x00000000, 0x00100656, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x0000000b,
|
||||
0x00000002, 0x00000000, 0x00000002, 0x00000006, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
};
|
||||
|
||||
static const D3D11_SHADER_INPUT_BIND_DESC test_reflection_bound_resources_result[] =
|
||||
static const D3D12_SHADER_INPUT_BIND_DESC test_reflection_bound_resources_result[] =
|
||||
{
|
||||
{"sam", D3D_SIT_SAMPLER, 0, 1, 0, 0, D3D_SRV_DIMENSION_UNKNOWN, 0},
|
||||
{"tex1", D3D_SIT_TEXTURE, 0, 1, 12, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, 0xffffffff},
|
||||
{"tex1", D3D_SIT_TEXTURE, 0, 2, 12, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, 0xffffffff},
|
||||
{"tex2", D3D_SIT_TEXTURE, 2, 1, 12, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, 0xffffffff, 0, 2},
|
||||
{"c1", D3D_SIT_CBUFFER, 0, 1, 0, 0, D3D_SRV_DIMENSION_UNKNOWN, 0},
|
||||
{"c2", D3D_SIT_CBUFFER, 1, 1, 0, 0, D3D_SRV_DIMENSION_UNKNOWN, 0},
|
||||
{"c2", D3D_SIT_CBUFFER, 1, 1, 0, 0, D3D_SRV_DIMENSION_UNKNOWN, 0, 0, 1},
|
||||
};
|
||||
|
||||
static void test_reflection_bound_resources(const DWORD *blob, const D3D11_SHADER_INPUT_BIND_DESC *result,
|
||||
static void test_reflection_bound_resources(const DWORD *blob, const D3D12_SHADER_INPUT_BIND_DESC *result,
|
||||
unsigned int result_count, unsigned int target_version)
|
||||
{
|
||||
const D3D11_SHADER_INPUT_BIND_DESC *pdesc;
|
||||
D3D11_SHADER_INPUT_BIND_DESC desc;
|
||||
ID3D12ShaderReflection *ref12 = NULL, *ref12_from_d3d11 = NULL, *ref11_from_d3d12 = NULL;
|
||||
const D3D12_SHADER_INPUT_BIND_DESC *pdesc;
|
||||
D3D12_SHADER_INPUT_BIND_DESC desc12;
|
||||
D3D11_SHADER_INPUT_BIND_DESC desc11;
|
||||
ID3D11ShaderReflection *ref11;
|
||||
HRESULT hr, expected_hr;
|
||||
unsigned int i;
|
||||
|
@ -1178,25 +1188,41 @@ static void test_reflection_bound_resources(const DWORD *blob, const D3D11_SHADE
|
|||
if (hr == E_INVALIDARG)
|
||||
return;
|
||||
|
||||
#if D3D_COMPILER_VERSION
|
||||
call_reflect(blob, blob[6], &IID_ID3D12ShaderReflection, (void **)&ref12);
|
||||
ref11->lpVtbl->QueryInterface(ref11, &IID_ID3D12ShaderReflection, (void **)&ref12_from_d3d11);
|
||||
ok((!ref12 && !ref12_from_d3d11) || (ref12 && ref12_from_d3d11), "Got unexpected interfaces %p, %p.\n",
|
||||
ref12, ref12_from_d3d11);
|
||||
|
||||
if (ref12)
|
||||
{
|
||||
ok(ref12 != (void *)ref11, "Got unexpected interfaces %p, %p.\n", ref11, ref12);
|
||||
ok(ref12_from_d3d11 == (void *)ref11, "Got unexpected interfaces %p, %p.\n",
|
||||
ref11, ref12_from_d3d11);
|
||||
ref12->lpVtbl->QueryInterface(ref12, &IID_ID3D11ShaderReflection, (void **)&ref11_from_d3d12);
|
||||
ok(!!ref11_from_d3d12, "Got zero interface.\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* check invalid cases */
|
||||
hr = ref11->lpVtbl->GetResourceBindingDesc(ref11, 0, NULL);
|
||||
ok(hr == E_INVALIDARG, "GetResourceBindingDesc failed, got %x, expected %x\n", hr, E_INVALIDARG);
|
||||
ok(hr == E_INVALIDARG, "Got unexpected hr %x.\n", hr);
|
||||
|
||||
hr = ref11->lpVtbl->GetResourceBindingDesc(ref11, 0xffffffff, &desc);
|
||||
ok(hr == E_INVALIDARG, "GetResourceBindingDesc failed, got %x, expected %x\n", hr, E_INVALIDARG);
|
||||
hr = ref11->lpVtbl->GetResourceBindingDesc(ref11, 0xffffffff, &desc11);
|
||||
ok(hr == E_INVALIDARG, "Got unexpected hr %x.\n", hr);
|
||||
|
||||
#if D3D_COMPILER_VERSION
|
||||
hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, NULL, &desc);
|
||||
ok(hr == E_INVALIDARG, "GetResourceBindingDescByName failed, got %x, expected %x\n", hr, E_INVALIDARG);
|
||||
hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, NULL, &desc11);
|
||||
ok(hr == E_INVALIDARG, "Got unexpected hr %x.\n", hr);
|
||||
|
||||
hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, "sam", NULL);
|
||||
ok(hr == E_INVALIDARG, "GetResourceBindingDescByName failed, got %x, expected %x\n", hr, E_INVALIDARG);
|
||||
ok(hr == E_INVALIDARG, "Got unexpected hr %x.\n", hr);
|
||||
|
||||
hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, "invalid", NULL);
|
||||
ok(hr == E_INVALIDARG, "GetResourceBindingDescByName failed, got %x, expected %x\n", hr, E_INVALIDARG);
|
||||
ok(hr == E_INVALIDARG, "Got unexpected hr %x.\n", hr);
|
||||
|
||||
hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, "invalid", &desc);
|
||||
ok(hr == E_INVALIDARG, "GetResourceBindingDescByName failed, got %x, expected %x\n", hr, E_INVALIDARG);
|
||||
hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, "invalid", &desc11);
|
||||
ok(hr == E_INVALIDARG, "Got unexpected hr %x.\n", hr);
|
||||
#endif
|
||||
|
||||
/* GetResourceBindingDesc */
|
||||
|
@ -1204,31 +1230,68 @@ static void test_reflection_bound_resources(const DWORD *blob, const D3D11_SHADE
|
|||
{
|
||||
pdesc = &result[i];
|
||||
|
||||
hr = ref11->lpVtbl->GetResourceBindingDesc(ref11, i, &desc);
|
||||
ok(hr == S_OK, "GetResourceBindingDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK);
|
||||
hr = ref11->lpVtbl->GetResourceBindingDesc(ref11, i, &desc11);
|
||||
ok(hr == S_OK, "Got unexpected hr %x, i %u.\n", hr, i);
|
||||
|
||||
ok(!strcmp(desc.Name, pdesc->Name), "GetResourceBindingDesc(%u) Name failed, got \"%s\", expected \"%s\"\n",
|
||||
i, desc.Name, pdesc->Name);
|
||||
ok(desc.Type == pdesc->Type, "GetResourceBindingDesc(%u) Type failed, got %x, expected %x\n",
|
||||
i, desc.Type, pdesc->Type);
|
||||
ok(desc.BindPoint == pdesc->BindPoint, "GetResourceBindingDesc(%u) BindPoint failed, got %u, expected %u\n",
|
||||
i, desc.BindPoint, pdesc->BindPoint);
|
||||
ok(desc.BindCount == pdesc->BindCount, "GetResourceBindingDesc(%u) BindCount failed, got %u, expected %u\n",
|
||||
i, desc.BindCount, pdesc->BindCount);
|
||||
ok(!strcmp(desc11.Name, pdesc->Name), "Got unexpected Name \"%s\", i %u.\n", desc11.Name, i);
|
||||
ok(desc11.Type == pdesc->Type, "Got unexpected Type %#x, i %u.\n", desc11.Type, i);
|
||||
ok(desc11.BindPoint == pdesc->BindPoint, "Got unexpected BindPoint %u, i %u.\n", desc11.BindPoint, i);
|
||||
ok(desc11.BindCount == pdesc->BindCount, "Got unexpected BindCount %u, i %u.\n", desc11.BindCount, i);
|
||||
#if D3D_COMPILER_VERSION
|
||||
expected = pdesc->uFlags;
|
||||
#else
|
||||
expected = 0;
|
||||
todo_wine_if(pdesc->uFlags)
|
||||
#endif
|
||||
ok(desc.uFlags == expected, "(%u): Got unexpected uFlags %#x, expected %#x.\n",
|
||||
i, desc.uFlags, expected);
|
||||
ok(desc.ReturnType == pdesc->ReturnType, "GetResourceBindingDesc(%u) ReturnType failed, got %x, expected %x\n",
|
||||
i, desc.ReturnType, pdesc->ReturnType);
|
||||
ok(desc.Dimension == pdesc->Dimension, "GetResourceBindingDesc(%u) Dimension failed, got %x, expected %x\n",
|
||||
i, desc.Dimension, pdesc->Dimension);
|
||||
ok(desc.NumSamples == pdesc->NumSamples, "GetResourceBindingDesc(%u) NumSamples failed, got %u, expected %u\n",
|
||||
i, desc.NumSamples, pdesc->NumSamples);
|
||||
ok(desc11.uFlags == expected, "Got unexpected uFlags %#x, i %u.\n", desc11.uFlags, i);
|
||||
ok(desc11.ReturnType == pdesc->ReturnType, "Got unexpected ReturnType %#x, i %u.\n", desc11.ReturnType, i);
|
||||
ok(desc11.Dimension == pdesc->Dimension, "Got unexpected Dimenstion %#x, i %u.\n", desc11.Dimension, i);
|
||||
ok(desc11.NumSamples == pdesc->NumSamples, "Got unexpected NumSamples %u, i %u.\n", desc11.NumSamples, i);
|
||||
|
||||
if (ref12)
|
||||
{
|
||||
memset(&desc12, 0, sizeof(desc12));
|
||||
desc12.Space = 0xdeadbeef;
|
||||
desc12.uID = 0xdeadbeef;
|
||||
|
||||
hr = ref12->lpVtbl->GetResourceBindingDesc(ref12, i, &desc12);
|
||||
ok(hr == S_OK, "Got unexpected hr %x, i %u.\n", hr, i);
|
||||
|
||||
ok(!strcmp(desc12.Name, pdesc->Name), "Got unexpected Name \"%s\", i %u.\n", desc12.Name, i);
|
||||
ok(!memcmp(&desc12.Type, &desc11.Type, sizeof(desc11) - offsetof(D3D11_SHADER_INPUT_BIND_DESC, Type)),
|
||||
"D3D11 and D3D12 descs do not match.\n");
|
||||
ok(desc12.Space == pdesc->Space, "Got unexpected Space %u, i %u.\n", desc12.Space, i);
|
||||
ok(desc12.uID == pdesc->uID, "Got unexpected uID %#x, i %u.\n", desc12.uID, i);
|
||||
|
||||
memset(&desc12, 0, sizeof(desc12));
|
||||
desc12.Space = 0xdeadbeef;
|
||||
desc12.uID = 0xdeadbeef;
|
||||
hr = ref12_from_d3d11->lpVtbl->GetResourceBindingDesc(ref12_from_d3d11, i, &desc12);
|
||||
ok(hr == S_OK, "Got unexpected hr %x, i %u.\n", hr, i);
|
||||
|
||||
ok(!strcmp(desc12.Name, pdesc->Name), "Got unexpected Name \"%s\", i %u.\n", desc12.Name, i);
|
||||
ok(!memcmp(&desc12.Type, &desc11.Type, sizeof(desc11) - offsetof(D3D11_SHADER_INPUT_BIND_DESC, Type)),
|
||||
"D3D11 and D3D12 descs do not match.\n");
|
||||
/* Native d3dcompiler_47 returns the same interface pointer when queried for ID3D12ShaderReflection
|
||||
* from ID3D11ShaderReflection. Space field still gets the correct value on x64 due to
|
||||
* D3D11_SHADER_INPUT_BIND_DESC padding. */
|
||||
expected = offsetof(D3D12_SHADER_INPUT_BIND_DESC, Space) < sizeof(D3D11_SHADER_INPUT_BIND_DESC)
|
||||
? pdesc->Space : 0xdeadbeef;
|
||||
ok(desc12.Space == expected, "Got unexpected Space %u, i %u.\n",
|
||||
desc12.Space, i);
|
||||
ok(desc12.uID == 0xdeadbeef, "Got unexpected uID %#x, i %u.\n", desc12.uID, i);
|
||||
|
||||
memset(&desc12, 0, sizeof(desc12));
|
||||
desc12.Space = 0xdeadbeef;
|
||||
desc12.uID = 0xdeadbeef;
|
||||
hr = ref11_from_d3d12->lpVtbl->GetResourceBindingDesc(ref11_from_d3d12, i, &desc12);
|
||||
ok(hr == S_OK, "Got unexpected hr %x, i %u.\n", hr, i);
|
||||
ok(!strcmp(desc12.Name, pdesc->Name), "Got unexpected Name \"%s\", i %u.\n", desc12.Name, i);
|
||||
ok(!memcmp(&desc12.Type, &desc11.Type, sizeof(desc11) - offsetof(D3D11_SHADER_INPUT_BIND_DESC, Type)),
|
||||
"D3D11 and D3D12 descs do not match.\n");
|
||||
ok(desc12.Space == pdesc->Space, "Got unexpected Space %u, i %u.\n", desc12.Space, i);
|
||||
ok(desc12.uID == pdesc->uID, "Got unexpected uID %#x, i %u.\n", desc12.uID, i);
|
||||
}
|
||||
}
|
||||
|
||||
#if D3D_COMPILER_VERSION
|
||||
|
@ -1237,30 +1300,76 @@ static void test_reflection_bound_resources(const DWORD *blob, const D3D11_SHADE
|
|||
{
|
||||
pdesc = &result[i];
|
||||
|
||||
hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, pdesc->Name, &desc);
|
||||
ok(hr == S_OK, "GetResourceBindingDescByName(%u) failed, got %x, expected %x\n", i, hr, S_OK);
|
||||
hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, pdesc->Name, &desc11);
|
||||
ok(hr == S_OK, "Got unexpected hr %x, i %u.\n", hr, i);
|
||||
|
||||
ok(!strcmp(desc.Name, pdesc->Name), "GetResourceBindingDescByName(%u) Name failed, got \"%s\", expected \"%s\"\n",
|
||||
i, desc.Name, pdesc->Name);
|
||||
ok(desc.Type == pdesc->Type, "GetResourceBindingDescByName(%u) Type failed, got %x, expected %x\n",
|
||||
i, desc.Type, pdesc->Type);
|
||||
ok(desc.BindPoint == pdesc->BindPoint, "GetResourceBindingDescByName(%u) BindPoint failed, got %u, expected %u\n",
|
||||
i, desc.BindPoint, pdesc->BindPoint);
|
||||
ok(desc.BindCount == pdesc->BindCount, "GetResourceBindingDescByName(%u) BindCount failed, got %u, expected %u\n",
|
||||
i, desc.BindCount, pdesc->BindCount);
|
||||
ok(desc.uFlags == pdesc->uFlags, "GetResourceBindingDescByName(%u) uFlags failed, got %u, expected %u\n",
|
||||
i, desc.uFlags, pdesc->uFlags);
|
||||
ok(desc.ReturnType == pdesc->ReturnType, "GetResourceBindingDescByName(%u) ReturnType failed, got %x, expected %x\n",
|
||||
i, desc.ReturnType, pdesc->ReturnType);
|
||||
ok(desc.Dimension == pdesc->Dimension, "GetResourceBindingDescByName(%u) Dimension failed, got %x, expected %x\n",
|
||||
i, desc.Dimension, pdesc->Dimension);
|
||||
ok(desc.NumSamples == pdesc->NumSamples, "GetResourceBindingDescByName(%u) NumSamples failed, got %u, expected %u\n",
|
||||
i, desc.NumSamples, pdesc->NumSamples);
|
||||
ok(!strcmp(desc11.Name, pdesc->Name), "Got unexpected Name \"%s\", i %u.\n", desc11.Name, i);
|
||||
ok(desc11.Type == pdesc->Type, "Got unexpected Type %#x, i %u.\n", desc11.Type, i);
|
||||
ok(desc11.BindPoint == pdesc->BindPoint, "Got unexpected BindPoint %u, i %u.\n", desc11.BindPoint, i);
|
||||
ok(desc11.BindCount == pdesc->BindCount, "Got unexpected BindCount failed %u, i %u.\n", desc11.BindCount, i);
|
||||
ok(desc11.uFlags == pdesc->uFlags, "Got unexpected uFlags %#x, i %u.\n", desc11.uFlags, i);
|
||||
ok(desc11.ReturnType == pdesc->ReturnType, "Got unexpected ReturnType %#x, i %u.\n", desc11.ReturnType, i);
|
||||
ok(desc11.Dimension == pdesc->Dimension, "Got unexpected Dimenstion %#x, i %u.\n", desc11.Dimension, i);
|
||||
ok(desc11.NumSamples == pdesc->NumSamples, "Got unexpected NumSamples %u, i %u.\n", desc11.NumSamples, i);
|
||||
|
||||
if (ref12)
|
||||
{
|
||||
memset(&desc12, 0, sizeof(desc12));
|
||||
desc12.Space = 0xdeadbeef;
|
||||
desc12.uID = 0xdeadbeef;
|
||||
|
||||
hr = ref12->lpVtbl->GetResourceBindingDescByName(ref12, pdesc->Name, &desc12);
|
||||
ok(hr == S_OK, "Got unexpected hr %x, i %u.\n", hr, i);
|
||||
|
||||
ok(!strcmp(desc12.Name, pdesc->Name), "Got unexpected Name \"%s\", i %u.\n", desc12.Name, i);
|
||||
ok(!memcmp(&desc12.Type, &desc11.Type, sizeof(desc11) - offsetof(D3D11_SHADER_INPUT_BIND_DESC, Type)),
|
||||
"D3D11 and D3D12 descs do not match.\n");
|
||||
ok(desc12.Space == pdesc->Space, "Got unexpected Space %u, i %u.\n", desc12.Space, i);
|
||||
ok(desc12.uID == pdesc->uID, "Got unexpected uID %#x, i %u.\n", desc12.uID, i);
|
||||
|
||||
memset(&desc12, 0, sizeof(desc12));
|
||||
desc12.Space = 0xdeadbeef;
|
||||
desc12.uID = 0xdeadbeef;
|
||||
hr = ref12_from_d3d11->lpVtbl->GetResourceBindingDescByName(ref12_from_d3d11, pdesc->Name, &desc12);
|
||||
ok(hr == S_OK, "Got unexpected hr %x, i %u.\n", hr, i);
|
||||
|
||||
ok(!strcmp(desc12.Name, pdesc->Name), "Got unexpected Name \"%s\", i %u.\n", desc12.Name, i);
|
||||
ok(!memcmp(&desc12.Type, &desc11.Type, sizeof(desc11) - offsetof(D3D11_SHADER_INPUT_BIND_DESC, Type)),
|
||||
"D3D11 and D3D12 descs do not match.\n");
|
||||
expected = offsetof(D3D12_SHADER_INPUT_BIND_DESC, Space) < sizeof(D3D11_SHADER_INPUT_BIND_DESC)
|
||||
? pdesc->Space : 0xdeadbeef;
|
||||
ok(desc12.Space == expected, "Got unexpected Space %u, i %u.\n",
|
||||
desc12.Space, i);
|
||||
ok(desc12.uID == 0xdeadbeef, "Got unexpected uID %#x, i %u.\n", desc12.uID, i);
|
||||
|
||||
memset(&desc12, 0, sizeof(desc12));
|
||||
desc12.Space = 0xdeadbeef;
|
||||
desc12.uID = 0xdeadbeef;
|
||||
hr = ref11_from_d3d12->lpVtbl->GetResourceBindingDescByName(ref11_from_d3d12, pdesc->Name, &desc12);
|
||||
ok(hr == S_OK, "Got unexpected hr %x, i %u.\n", hr, i);
|
||||
ok(!strcmp(desc12.Name, pdesc->Name), "Got unexpected Name \"%s\", i %u.\n", desc12.Name, i);
|
||||
ok(!memcmp(&desc12.Type, &desc11.Type, sizeof(desc11) - offsetof(D3D11_SHADER_INPUT_BIND_DESC, Type)),
|
||||
"D3D11 and D3D12 descs do not match.\n");
|
||||
ok(desc12.Space == pdesc->Space, "Got unexpected Space %u, i %u.\n", desc12.Space, i);
|
||||
ok(desc12.uID == pdesc->uID, "Got unexpected uID %#x, i %u.\n", desc12.uID, i);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ref12)
|
||||
{
|
||||
count = ref11_from_d3d12->lpVtbl->Release(ref11_from_d3d12);
|
||||
ok(count == 1, "Got unexpected ref count %u.\n", count);
|
||||
|
||||
count = ref12->lpVtbl->Release(ref12);
|
||||
ok(!count, "Got unexpected ref count %u.\n", count);
|
||||
|
||||
count = ref12_from_d3d11->lpVtbl->Release(ref12_from_d3d11);
|
||||
ok(count == 1, "Got unexpected ref count %u.\n", count);
|
||||
}
|
||||
|
||||
count = ref11->lpVtbl->Release(ref11);
|
||||
ok(count == 0, "Release failed %u\n", count);
|
||||
ok(!count, "Got unexpected ref count %u.\n", count);
|
||||
}
|
||||
|
||||
#if D3D_COMPILER_VERSION
|
||||
|
@ -2006,12 +2115,12 @@ static const DWORD test_reflection_bound_resources_sm51_blob[] =
|
|||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
};
|
||||
|
||||
static const D3D11_SHADER_INPUT_BIND_DESC test_reflection_bound_resources_sm51_result[] =
|
||||
static const D3D12_SHADER_INPUT_BIND_DESC test_reflection_bound_resources_sm51_result[] =
|
||||
{
|
||||
{"sam", D3D_SIT_SAMPLER, 0, 1, 0, 0, D3D_SRV_DIMENSION_UNKNOWN, 0},
|
||||
{"tex1", D3D_SIT_TEXTURE, 1, 1, 12, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, 0xffffffff},
|
||||
{"tex1", D3D_SIT_TEXTURE, 1, 1, 12, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, 0xffffffff, 1, 0},
|
||||
{"c1", D3D_SIT_CBUFFER, 0, 1, D3D_SIF_USERPACKED, 0, D3D_SRV_DIMENSION_UNKNOWN, 0},
|
||||
{"c2", D3D_SIT_CBUFFER, 0, 1, D3D_SIF_USERPACKED, 0, D3D_SRV_DIMENSION_UNKNOWN, 0},
|
||||
{"c2", D3D_SIT_CBUFFER, 0, 1, D3D_SIF_USERPACKED, 0, D3D_SRV_DIMENSION_UNKNOWN, 0, 1, 1},
|
||||
};
|
||||
|
||||
static BOOL load_d3dreflect(void)
|
||||
|
|
Loading…
Reference in a new issue