Signed-off-by: Paul Gofman pgofman@codeweavers.com --- Supersedes 190599 - 190603.
dlls/d3dcompiler_43/reflection.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index a081b20d68f..3b451615103 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -93,6 +93,13 @@ struct d3dcompiler_shader_reflection_constant_buffer struct d3dcompiler_shader_reflection_variable *variables; };
+enum D3DCOMPILER_REFLECTION_VERSION +{ + D3DCOMPILER_REFLECTION_VERSION_D3D10, + D3DCOMPILER_REFLECTION_VERSION_D3D11, + D3DCOMPILER_REFLECTION_VERSION_D3D12, +}; + /* ID3D11ShaderReflection */ struct d3dcompiler_shader_reflection { @@ -100,6 +107,8 @@ struct d3dcompiler_shader_reflection ID3D10ShaderReflection ID3D10ShaderReflection_iface; LONG refcount;
+ enum D3DCOMPILER_REFLECTION_VERSION interface_version; + DWORD target; char *creator; UINT flags; @@ -332,7 +341,8 @@ static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_QueryInterface(ID TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
if (IsEqualGUID(riid, &IID_ID3D11ShaderReflection) - || IsEqualGUID(riid, &IID_IUnknown)) + || IsEqualGUID(riid, &IID_IUnknown) + || (D3D_COMPILER_VERSION >= 47 && IsEqualGUID(riid, &IID_ID3D12ShaderReflection))) { IUnknown_AddRef(iface); *object = iface; @@ -486,7 +496,9 @@ static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetResourceBindin return E_INVALIDARG; }
- memcpy(desc, &reflection->bound_resources[index], sizeof(*desc)); + memcpy(desc, &reflection->bound_resources[index], + reflection->interface_version == D3DCOMPILER_REFLECTION_VERSION_D3D12 + ? sizeof(D3D12_SHADER_INPUT_BIND_DESC) : sizeof(D3D11_SHADER_INPUT_BIND_DESC));
return S_OK; } @@ -583,7 +595,7 @@ static struct ID3D11ShaderReflectionVariable * STDMETHODCALLTYPE d3dcompiler_sha static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetResourceBindingDescByName( ID3D11ShaderReflection *iface, const char *name, D3D11_SHADER_INPUT_BIND_DESC *desc) { - struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface); + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D11ShaderReflection(iface); unsigned int i;
TRACE("iface %p, name %s, desc %p\n", iface, debugstr_a(name), desc); @@ -594,14 +606,15 @@ static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetResourceBindin return E_INVALIDARG; }
- for (i = 0; i < This->bound_resource_count; ++i) + for (i = 0; i < reflection->bound_resource_count; ++i) { - D3D12_SHADER_INPUT_BIND_DESC *d = &This->bound_resources[i]; + D3D12_SHADER_INPUT_BIND_DESC *d = &reflection->bound_resources[i];
if (!strcmp(d->Name, name)) { TRACE("Returning D3D11_SHADER_INPUT_BIND_DESC %p.\n", d); - memcpy(desc, d, sizeof(*desc)); + memcpy(desc, d, reflection->interface_version == D3DCOMPILER_REFLECTION_VERSION_D3D12 + ? sizeof(D3D12_SHADER_INPUT_BIND_DESC) : sizeof(D3D11_SHADER_INPUT_BIND_DESC)); return S_OK; } } @@ -2308,6 +2321,7 @@ HRESULT WINAPI D3D10ReflectShader(const void *data, SIZE_T data_size, ID3D10Shad }
object->ID3D10ShaderReflection_iface.lpVtbl = &d3d10_shader_reflection_vtbl; + object->interface_version = D3DCOMPILER_REFLECTION_VERSION_D3D10; object->refcount = 1;
hr = d3dcompiler_shader_reflection_init(object, data, data_size); @@ -2350,7 +2364,8 @@ HRESULT WINAPI D3DReflect(const void *data, SIZE_T data_size, REFIID riid, void #endif }
- if (!IsEqualGUID(riid, &IID_ID3D11ShaderReflection)) + if (!IsEqualGUID(riid, &IID_ID3D11ShaderReflection) + && (D3D_COMPILER_VERSION < 47 || !IsEqualGUID(riid, &IID_ID3D12ShaderReflection))) { WARN("Wrong riid %s, accept only %s!\n", debugstr_guid(riid), debugstr_guid(&IID_ID3D11ShaderReflection)); #if D3D_COMPILER_VERSION >= 46 @@ -2366,6 +2381,8 @@ HRESULT WINAPI D3DReflect(const void *data, SIZE_T data_size, REFIID riid, void
object->ID3D11ShaderReflection_iface.lpVtbl = &d3dcompiler_shader_reflection_vtbl; object->refcount = 1; + object->interface_version = IsEqualGUID(riid, &IID_ID3D12ShaderReflection) + ? D3DCOMPILER_REFLECTION_VERSION_D3D12 : D3DCOMPILER_REFLECTION_VERSION_D3D11;
hr = d3dcompiler_shader_reflection_init(object, data, data_size); if (FAILED(hr))
Signed-off-by: Paul Gofman pgofman@codeweavers.com --- dlls/d3dcompiler_43/tests/reflection.c | 61 ++++++++++++++++++++++++++ 1 file changed, 61 insertions(+)
diff --git a/dlls/d3dcompiler_43/tests/reflection.c b/dlls/d3dcompiler_43/tests/reflection.c index dee88776fa3..1fc02d82bb7 100644 --- a/dlls/d3dcompiler_43/tests/reflection.c +++ b/dlls/d3dcompiler_43/tests/reflection.c @@ -157,6 +157,66 @@ static void test_reflection_references(void) } #endif
+#if D3D_COMPILER_VERSION +static void test_reflection_interfaces(void) +{ + ID3D12ShaderReflection *ref12 = NULL; + ID3D11ShaderReflection *ref11; + HRESULT hr, expected_hr; + IUnknown *iface, *iunk; + ULONG count; + + expected_hr = D3D_COMPILER_VERSION < 46 ? E_NOINTERFACE : D3D_COMPILER_VERSION == 46 ? E_INVALIDARG : S_OK; + hr = call_reflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D12ShaderReflection, (void **)&ref12); + /* Broken with older d3dcompiler_47. */ + ok(hr == expected_hr || broken(expected_hr == S_OK && hr == E_NOINTERFACE), "Got unexpected hr %#x.\n", hr); + + if (hr != S_OK) + return; + + hr = call_reflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + hr = ref12->lpVtbl->QueryInterface(ref12, &IID_ID3D11ShaderReflection, (void **)&iface); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(iface == (void *)ref12, "Got unexpected interfaces %p, %p.\n", iface, ref12); + hr = iface->lpVtbl->QueryInterface(iface, &IID_IUnknown, (void **)&iunk); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(iface == iunk, "Got unexpected iface %p.\n", iface); + iface->lpVtbl->Release(iunk); + iface->lpVtbl->Release(iface); + + hr = ref12->lpVtbl->QueryInterface(ref12, &IID_IUnknown, (void **)&iface); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(iface == (IUnknown *)ref12, "Got unexpected iface %p.\n", iface); + iface->lpVtbl->Release(iface); + + hr = ref11->lpVtbl->QueryInterface(ref11, &IID_ID3D12ShaderReflection, (void **)&iface); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(iface == (void *)ref11, "Got unexpected interfaces %p, %p.\n", iface, ref11); + hr = iface->lpVtbl->QueryInterface(iface, &IID_IUnknown, (void **)&iunk); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(iface == iunk, "Got unexpected iface %p.\n", iface); + iface->lpVtbl->Release(iunk); + iface->lpVtbl->Release(iface); + + hr = ref11->lpVtbl->QueryInterface(ref11, &IID_IUnknown, (void **)&iface); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(iface == (IUnknown *)ref11, "Got unexpected iface %p.\n", iface); + iface->lpVtbl->Release(iface); + + hr = ref11->lpVtbl->QueryInterface(ref11, &IID_ID3D10ShaderReflection, (void **)&iface); + ok(hr == E_NOINTERFACE, "Got unexpected hr %#x.\n", hr); + hr = ref12->lpVtbl->QueryInterface(ref12, &IID_ID3D10ShaderReflection, (void **)&iface); + ok(hr == E_NOINTERFACE, "Got unexpected hr %#x.\n", hr); + + count = ref12->lpVtbl->Release(ref12); + ok(!count, "Got unexpected ref count %u.\n", count); + count = ref11->lpVtbl->Release(ref11); + ok(!count, "Got unexpected ref count %u.\n", count); +} +#endif + /* * fxc.exe /E VS /Tvs_4_1 /Fx */ @@ -1802,6 +1862,7 @@ START_TEST(reflection)
#if D3D_COMPILER_VERSION test_reflection_references(); + test_reflection_interfaces(); #endif test_reflection_desc_vs(); test_reflection_desc_ps();
Signed-off-by: Matteo Bruni mbruni@codeweavers.com
Signed-off-by: Paul Gofman pgofman@codeweavers.com --- dlls/d3dcompiler_43/tests/reflection.c | 140 +++++++++++++++++-------- 1 file changed, 94 insertions(+), 46 deletions(-)
diff --git a/dlls/d3dcompiler_43/tests/reflection.c b/dlls/d3dcompiler_43/tests/reflection.c index 1fc02d82bb7..6327d68af32 100644 --- a/dlls/d3dcompiler_43/tests/reflection.c +++ b/dlls/d3dcompiler_43/tests/reflection.c @@ -388,10 +388,13 @@ static void test_reflection_desc_vs(void) { struct D3D11_SIGNATURE_PARAMETER_DESC_46 desc_46 = {0}; const D3D11_SIGNATURE_PARAMETER_DESC *pdesc; - D3D11_SIGNATURE_PARAMETER_DESC desc = {0}; + D3D11_SIGNATURE_PARAMETER_DESC desc11 = {0}; + D3D12_SIGNATURE_PARAMETER_DESC desc12 = {0}; D3D_MIN_PRECISION expected_min_prec; D3D11_SHADER_DESC sdesc11 = {0}; + D3D12_SHADER_DESC sdesc12 = {0}; ID3D11ShaderReflection *ref11; + ID3D12ShaderReflection *ref12; unsigned int i; ULONG count; HRESULT hr; @@ -402,6 +405,8 @@ static void test_reflection_desc_vs(void) hr = call_reflect(test_reflection_desc_vs_blob, test_reflection_desc_vs_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11); ok(hr == S_OK, "D3DReflect failed %x\n", hr);
+ ref11->lpVtbl->QueryInterface(ref11, &IID_ID3D12ShaderReflection, (void **)&ref12); + hr = ref11->lpVtbl->GetDesc(ref11, NULL); ok(hr == E_FAIL, "GetDesc failed %x\n", hr);
@@ -447,18 +452,40 @@ static void test_reflection_desc_vs(void) ok(sdesc11.cInterlockedInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cInterlockedInstructions, 0); ok(sdesc11.cTextureStoreInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cTextureStoreInstructions, 0);
+ if (ref12) + { + hr = ref12->lpVtbl->GetDesc(ref12, &sdesc12); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(!memcmp(&sdesc11, &sdesc12, sizeof(sdesc12)), "D3D11 and D3D12 descs do not match.\n"); + } + #if D3D_COMPILER_VERSION ret = ref11->lpVtbl->GetBitwiseInstructionCount(ref11); - ok(ret == 0, "GetBitwiseInstructionCount failed, got %u, expected %u\n", ret, 0); + ok(ret == 0, "Got unexpected ret %u.\n", ret);
ret = ref11->lpVtbl->GetConversionInstructionCount(ref11); - ok(ret == 2, "GetConversionInstructionCount failed, got %u, expected %u\n", ret, 2); + ok(ret == 2, "Got unexpected ret %u.\n", ret);
ret = ref11->lpVtbl->GetMovInstructionCount(ref11); - ok(ret == 10, "GetMovInstructionCount failed, got %u, expected %u\n", ret, 10); + ok(ret == 10, "Got unexpected ret %u.\n", ret);
ret = ref11->lpVtbl->GetMovcInstructionCount(ref11); - ok(ret == 0, "GetMovcInstructionCount failed, got %u, expected %u\n", ret, 0); + ok(ret == 0, "Got unexpected ret %u.\n", ret); + + if (ref12) + { + ret = ref12->lpVtbl->GetBitwiseInstructionCount(ref12); + ok(ret == 0, "Got unexpected ret %u.\n", ret); + + ret = ref12->lpVtbl->GetConversionInstructionCount(ref12); + ok(ret == 2, "Got unexpected ret %u.\n", ret); + + ret = ref12->lpVtbl->GetMovInstructionCount(ref12); + ok(ret == 10, "Got unexpected ret %u.\n", ret); + + ret = ref12->lpVtbl->GetMovcInstructionCount(ref12); + ok(ret == 0, "Got unexpected ret %u.\n", ret); + } #endif
/* GetIn/OutputParameterDesc */ @@ -476,63 +503,84 @@ static void test_reflection_desc_vs(void) { pdesc = &test_reflection_desc_vs_resultin[i];
- hr = ref11->lpVtbl->GetInputParameterDesc(ref11, i, &desc); - ok(hr == S_OK, "GetInputParameterDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK); - - ok(!strcmp(desc.SemanticName, pdesc->SemanticName), "GetInputParameterDesc(%u) SemanticName failed, got "%s", expected "%s"\n", - i, desc.SemanticName, pdesc->SemanticName); - ok(desc.SemanticIndex == pdesc->SemanticIndex, "GetInputParameterDesc(%u) SemanticIndex failed, got %u, expected %u\n", - i, desc.SemanticIndex, pdesc->SemanticIndex); - ok(desc.Register == pdesc->Register, "GetInputParameterDesc(%u) Register failed, got %u, expected %u\n", - i, desc.Register, pdesc->Register); - ok(desc.SystemValueType == pdesc->SystemValueType, "GetInputParameterDesc(%u) SystemValueType failed, got %x, expected %x\n", - i, desc.SystemValueType, pdesc->SystemValueType); - ok(desc.ComponentType == pdesc->ComponentType, "GetInputParameterDesc(%u) ComponentType failed, got %x, expected %x\n", - i, desc.ComponentType, pdesc->ComponentType); - ok(desc.Mask == pdesc->Mask, "GetInputParameterDesc(%u) Mask failed, got %x, expected %x\n", - i, desc.Mask, pdesc->Mask); - ok(desc.ReadWriteMask == pdesc->ReadWriteMask, "GetInputParameterDesc(%u) ReadWriteMask failed, got %x, expected %x\n", - i, desc.ReadWriteMask, pdesc->ReadWriteMask); + hr = ref11->lpVtbl->GetInputParameterDesc(ref11, i, &desc11); + ok(hr == S_OK, "Got unexpected hr %#x, i %u.\n", hr, i); + + ok(!strcmp(desc11.SemanticName, pdesc->SemanticName), "Got unexpected SemanticName "%s", i %u.\n", + desc11.SemanticName, i); + ok(desc11.SemanticIndex == pdesc->SemanticIndex, "Got unexpected SemanticIndex %u, i %u.\n", + desc11.SemanticIndex, i); + ok(desc11.Register == pdesc->Register, "Got unexpected Register %u, i %u.\n", desc11.Register, i); + ok(desc11.SystemValueType == pdesc->SystemValueType, "Got unexpected SystemValueType %u, i %u.\n", + desc11.SystemValueType, i); + ok(desc11.ComponentType == pdesc->ComponentType, "Got unexpected ComponentType %u, i %u.\n", + desc11.ComponentType, i); + ok(desc11.Mask == pdesc->Mask, "Got unexpected SystemValueType %#x, i %u.\n", desc11.Mask, i); + ok(desc11.ReadWriteMask == pdesc->ReadWriteMask, "Got unexpected ReadWriteMask %#x, i %u.\n", + desc11.ReadWriteMask, i); /* The Stream field of D3D11_SIGNATURE_PARAMETER_DESC is in the * trailing padding of the D3D10_SIGNATURE_PARAMETER_DESC struct on * 64-bits and thus undefined. Don't test it. */ if (D3D_COMPILER_VERSION) - ok(desc.Stream == pdesc->Stream, "(%u): got unexpected Stream %u, expected %u.\n", - i, desc.Stream, pdesc->Stream); + ok(desc11.Stream == pdesc->Stream, "Got unexpected Stream %u, i %u.\n", + desc11.Stream, i); else if (sizeof(void *) == 4) - ok(!desc.Stream, "(%u): got unexpected Stream %u.\n", i, desc.Stream); + ok(!desc11.Stream, "Got unexpected Stream %u, i %u.\n", desc11.Stream, i); + + if (ref12) + { + hr = ref12->lpVtbl->GetInputParameterDesc(ref12, i, &desc12); + ok(hr == S_OK, "Got unexpected hr %#x, i %u.\n", hr, i); + + ok(!memcmp(&desc12, &desc11, sizeof(desc11)), "D3D11 and D3D12 descs do not match.\n"); + } }
for (i = 0; i < ARRAY_SIZE(test_reflection_desc_vs_resultout); ++i) { pdesc = &test_reflection_desc_vs_resultout[i];
- hr = ref11->lpVtbl->GetOutputParameterDesc(ref11, i, &desc); - ok(hr == S_OK, "GetOutputParameterDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK); - - ok(!strcmp(desc.SemanticName, pdesc->SemanticName), "GetOutputParameterDesc(%u) SemanticName failed, got "%s", expected "%s"\n", - i, desc.SemanticName, pdesc->SemanticName); - ok(desc.SemanticIndex == pdesc->SemanticIndex, "GetOutputParameterDesc(%u) SemanticIndex failed, got %u, expected %u\n", - i, desc.SemanticIndex, pdesc->SemanticIndex); - ok(desc.Register == pdesc->Register, "GetOutputParameterDesc(%u) Register failed, got %u, expected %u\n", - i, desc.Register, pdesc->Register); - ok(desc.SystemValueType == pdesc->SystemValueType, "GetOutputParameterDesc(%u) SystemValueType failed, got %x, expected %x\n", - i, desc.SystemValueType, pdesc->SystemValueType); - ok(desc.ComponentType == pdesc->ComponentType, "GetOutputParameterDesc(%u) ComponentType failed, got %x, expected %x\n", - i, desc.ComponentType, pdesc->ComponentType); - ok(desc.Mask == pdesc->Mask, "GetOutputParameterDesc(%u) Mask failed, got %x, expected %x\n", - i, desc.Mask, pdesc->Mask); - ok(desc.ReadWriteMask == pdesc->ReadWriteMask, "GetOutputParameterDesc(%u) ReadWriteMask failed, got %x, expected %x\n", - i, desc.ReadWriteMask, pdesc->ReadWriteMask); + hr = ref11->lpVtbl->GetOutputParameterDesc(ref11, i, &desc11); + ok(hr == S_OK, "Got unexpected hr %#x, i %u.\n", hr, i); + + ok(!strcmp(desc11.SemanticName, pdesc->SemanticName), "Got unexpected SemanticName "%s", i %u.\n", + desc11.SemanticName, i); + ok(desc11.SemanticIndex == pdesc->SemanticIndex, "Got unexpected SemanticIndex %u, i %u.\n", + desc11.SemanticIndex, i); + ok(desc11.Register == pdesc->Register, "Got unexpected Register %u, i %u.\n", desc11.Register, i); + ok(desc11.SystemValueType == pdesc->SystemValueType, "Got unexpected SystemValueType %u, i %u.\n", + desc11.SystemValueType, i); + ok(desc11.ComponentType == pdesc->ComponentType, "Got unexpected ComponentType %u, i %u.\n", + desc11.ComponentType, i); + ok(desc11.Mask == pdesc->Mask, "Got unexpected SystemValueType %#x, i %u.\n", desc11.Mask, i); + ok(desc11.ReadWriteMask == pdesc->ReadWriteMask, "Got unexpected ReadWriteMask %#x, i %u.\n", + desc11.ReadWriteMask, i); + /* The Stream field of D3D11_SIGNATURE_PARAMETER_DESC is in the + * trailing padding of the D3D10_SIGNATURE_PARAMETER_DESC struct on + * 64-bits and thus undefined. Don't test it. */ if (D3D_COMPILER_VERSION) - ok(desc.Stream == pdesc->Stream, "(%u): got unexpected Stream %u, expected %u.\n", - i, desc.Stream, pdesc->Stream); + ok(desc11.Stream == pdesc->Stream, "Got unexpected Stream %u, i %u.\n", + desc11.Stream, i); else if (sizeof(void *) == 4) - ok(!desc.Stream, "(%u): got unexpected Stream %u.\n", i, desc.Stream); + ok(!desc11.Stream, "Got unexpected Stream %u, i %u.\n", desc11.Stream, i); + + if (ref12) + { + hr = ref12->lpVtbl->GetOutputParameterDesc(ref12, i, &desc12); + ok(hr == S_OK, "Got unexpected hr %#x, i %u.\n", hr, i); + + ok(!memcmp(&desc12, &desc11, sizeof(desc11)), "D3D11 and D3D12 descs do not match.\n"); + } + } + + if (ref12) + { + count = ref12->lpVtbl->Release(ref12); + 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 == 0, "Got unexpected ref count %u.\n", count); }
/*
Signed-off-by: Matteo Bruni mbruni@codeweavers.com
Signed-off-by: Paul Gofman pgofman@codeweavers.com --- dlls/d3dcompiler_43/reflection.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 3b451615103..3c4a94f8e56 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -1544,7 +1544,7 @@ static HRESULT d3dcompiler_parse_rdef(struct d3dcompiler_shader_reflection *r, c else { desc->Space = 0; - desc->uID = 0; + desc->uID = desc->BindPoint; } } }
Signed-off-by: Matteo Bruni mbruni@codeweavers.com
From: Paul Gofman pgofman@codeweavers.com
Signed-off-by: Paul Gofman pgofman@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v3: Fix some accidental double blanks.
Supersedes patch 191873.
dlls/d3dcompiler_43/tests/reflection.c | 287 ++++++++++++++++++------- 1 file changed, 211 insertions(+), 76 deletions(-)
diff --git a/dlls/d3dcompiler_43/tests/reflection.c b/dlls/d3dcompiler_43/tests/reflection.c index 6327d68af324..c37a9709c2a6 100644 --- a/dlls/d3dcompiler_43/tests/reflection.c +++ b/dlls/d3dcompiler_43/tests/reflection.c @@ -1486,26 +1486,38 @@ static const D3D11_SHADER_TYPE_DESC test_reflection_constant_buffer_type_result[
static void test_reflection_constant_buffer(void) { - HRESULT hr; - ULONG count; - ID3D11ShaderReflection *ref11; + ID3D12ShaderReflectionType *t12, *mt12, *mt12_2, *t12_dummy = NULL, *t12_valid = NULL; + ID3D12ShaderReflectionConstantBuffer *cb12, *cb12_dummy = NULL, *cb12_valid = NULL; ID3D11ShaderReflectionConstantBuffer *cb11, *cb11_dummy = NULL, *cb11_valid = NULL; - ID3D11ShaderReflectionVariable *v11, *v11_dummy = NULL, *v11_valid = NULL; ID3D11ShaderReflectionType *t11, *t, *t2, *t11_dummy = NULL, *t11_valid = NULL; - D3D11_SHADER_BUFFER_DESC cbdesc = {0}; + ID3D12ShaderReflectionVariable *v12, *v12_dummy = NULL, *v12_valid = NULL; + ID3D11ShaderReflectionVariable *v11, *v11_dummy = NULL, *v11_valid = NULL; + D3D12_SHADER_VARIABLE_DESC vdesc12 = {0}; + const D3D11_SHADER_VARIABLE_DESC *pvdesc; + const D3D11_SHADER_BUFFER_DESC *pcbdesc; + D3D12_SHADER_BUFFER_DESC cbdesc12 = {0}; D3D11_SHADER_VARIABLE_DESC vdesc = {0}; + D3D11_SHADER_BUFFER_DESC cbdesc = {0}; + ID3D12ShaderReflection *ref12 = NULL; + const D3D11_SHADER_TYPE_DESC *ptdesc; + D3D12_SHADER_TYPE_DESC tdesc12 = {0}; D3D11_SHADER_TYPE_DESC tdesc = {0}; + ID3D11ShaderReflection *ref11; D3D11_SHADER_DESC sdesc = {0}; - const D3D11_SHADER_BUFFER_DESC *pcbdesc; - const D3D11_SHADER_VARIABLE_DESC *pvdesc; - const D3D11_SHADER_TYPE_DESC *ptdesc; unsigned int i, expected; LPCSTR string; + ULONG count; + HRESULT hr;
hr = call_reflect(test_reflection_constant_buffer_blob, test_reflection_constant_buffer_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11); ok(hr == S_OK, "D3DReflect failed %x\n", hr);
+#if D3D_COMPILER_VERSION + call_reflect(test_reflection_constant_buffer_blob, test_reflection_constant_buffer_blob[6], + &IID_ID3D12ShaderReflection, (void **)&ref12); +#endif + hr = ref11->lpVtbl->GetDesc(ref11, &sdesc); ok(hr == S_OK, "GetDesc failed %x\n", hr);
@@ -1556,20 +1568,44 @@ static void test_reflection_constant_buffer(void)
/* get the dummys for comparison */ cb11_dummy = ref11->lpVtbl->GetConstantBufferByIndex(ref11, 0xffffffff); - ok(cb11_dummy != NULL, "GetConstantBufferByIndex failed\n"); + ok(!!cb11_dummy, "Got unexpected buffer %p.\n", cb11_dummy); + + if (ref12) + { + cb12_dummy = ref12->lpVtbl->GetConstantBufferByIndex(ref12, 0xffffffff); + ok(!!cb12_dummy, "Got unexpected buffer %p.\n", cb12_dummy); + ok(cb12_dummy == (void *)cb11_dummy, "Got unexpected buffer %p.\n", cb12_dummy);
+ v12_dummy = cb12_dummy->lpVtbl->GetVariableByIndex(cb12_dummy, 0xffffffff); + ok(!!v12_dummy, "Got unexpected NULL variable.\n"); + } v11_dummy = cb11_dummy->lpVtbl->GetVariableByIndex(cb11_dummy, 0xffffffff); - ok(v11_dummy != NULL, "GetVariableByIndex failed\n"); + ok(!!v11_dummy, "Got unexpected NULL variable.\n");
t11_dummy = v11_dummy->lpVtbl->GetType(v11_dummy); - ok(t11_dummy != NULL, "GetType failed\n"); + ok(!!t11_dummy, "Got NULL type.\n");
/* get the valid variables */ cb11_valid = ref11->lpVtbl->GetConstantBufferByIndex(ref11, 1); - ok(cb11_valid != cb11_dummy && cb11_valid, "GetConstantBufferByIndex failed\n"); + ok(cb11_valid != cb11_dummy && cb11_valid, "Got unexpected buffer %p.\n", cb11_valid); + if (ref12) + { + cb12_valid = ref12->lpVtbl->GetConstantBufferByIndex(ref12, 1); + ok(cb12_valid != cb12_dummy && cb12_valid, "Got unexpected buffer %p.\n", cb11_valid); + ok(cb12_valid != (void *)cb11_valid, "Got unexpected buffer %p.\n", cb12_valid); + + v12_valid = cb12_valid->lpVtbl->GetVariableByIndex(cb12_valid, 0); + ok(v12_valid != v12_dummy && v12_valid, "Got unexpected variable %p.\n", v12_valid); + + t12_dummy = v12_dummy->lpVtbl->GetType(v12_dummy); + ok(!!t12_dummy, "Got NULL type.\n"); + + t12_valid = v12_valid->lpVtbl->GetType(v12_valid); + ok(t12_valid != t12_dummy && t12_valid, "GetType failed\n"); + }
v11_valid = cb11_valid->lpVtbl->GetVariableByIndex(cb11_valid, 0); - ok(v11_valid != v11_dummy && v11_valid, "GetVariableByIndex failed\n"); + ok(v11_valid != v11_dummy && v11_valid, "Got unexpected variable %p.\n", v11_valid);
t11_valid = v11_valid->lpVtbl->GetType(v11_valid); ok(t11_valid != t11_dummy && t11_valid, "GetType failed\n"); @@ -1583,30 +1619,36 @@ static void test_reflection_constant_buffer(void)
#if D3D_COMPILER_VERSION v11 = ref11->lpVtbl->GetVariableByName(ref11, NULL); - ok(v11_dummy == v11, "GetVariableByIndex failed, got %p, expected %p\n", v11, v11_dummy); + ok(v11_dummy == v11, "Got unexpected variable %p.\n", v11);
v11 = ref11->lpVtbl->GetVariableByName(ref11, "invalid"); - ok(v11_dummy == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_dummy); + ok(v11_dummy == v11, "Got unexpected variable %p.\n", v11);
v11 = ref11->lpVtbl->GetVariableByName(ref11, "a"); - ok(v11_valid == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_valid); + ok(v11_valid == v11, "Got unexpected variable %p.\n", v11); #endif
/* constant buffer calls */ v11 = cb11_dummy->lpVtbl->GetVariableByName(cb11_dummy, NULL); - ok(v11_dummy == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_dummy); + ok(v11_dummy == v11, "Got unexpected variable %p.\n", v11);
v11 = cb11_dummy->lpVtbl->GetVariableByName(cb11_dummy, "invalid"); - ok(v11_dummy == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_dummy); + ok(v11_dummy == v11, "Got unexpected variable %p.\n", v11);
v11 = cb11_valid->lpVtbl->GetVariableByName(cb11_valid, NULL); - ok(v11_dummy == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_dummy); + ok(v11_dummy == v11, "Got unexpected variable %p.\n", v11);
v11 = cb11_valid->lpVtbl->GetVariableByName(cb11_valid, "invalid"); - ok(v11_dummy == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_dummy); + ok(v11_dummy == v11, "Got unexpected variable %p.\n", v11);
v11 = cb11_valid->lpVtbl->GetVariableByName(cb11_valid, "a"); - ok(v11_valid == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_valid); + ok(v11_valid == v11, "Got unexpected variable %p.\n", v11); + + if (ref12) + { + v12 = cb12_valid->lpVtbl->GetVariableByName(cb12_valid, "a"); + ok(v12_valid == v12, "Got unexpected variable %p.\n", v12); + }
hr = cb11_dummy->lpVtbl->GetDesc(cb11_dummy, NULL); ok(hr == E_FAIL, "GetDesc failed, got %x, expected %x\n", hr, E_FAIL); @@ -1681,21 +1723,30 @@ static void test_reflection_constant_buffer(void) pcbdesc = &test_reflection_constant_buffer_cb_result[i];
cb11 = ref11->lpVtbl->GetConstantBufferByIndex(ref11, i); - ok(cb11_dummy != cb11, "GetConstantBufferByIndex(%u) failed\n", i); + ok(cb11_dummy != cb11, "Got dummy constant buffer, i %u.\n", i);
hr = cb11->lpVtbl->GetDesc(cb11, &cbdesc); - ok(hr == S_OK, "GetDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK); - - ok(!strcmp(cbdesc.Name, pcbdesc->Name), "GetDesc(%u) Name failed, got "%s", expected "%s"\n", - i, cbdesc.Name, pcbdesc->Name); - ok(cbdesc.Type == pcbdesc->Type, "GetDesc(%u) Type failed, got %x, expected %x\n", - i, cbdesc.Type, pcbdesc->Type); - ok(cbdesc.Variables == pcbdesc->Variables, "GetDesc(%u) Variables failed, got %u, expected %u\n", - i, cbdesc.Variables, pcbdesc->Variables); - ok(cbdesc.Size == pcbdesc->Size, "GetDesc(%u) Size failed, got %u, expected %u\n", - i, cbdesc.Size, pcbdesc->Size); - ok(cbdesc.uFlags == pcbdesc->uFlags, "GetDesc(%u) uFlags failed, got %u, expected %u\n", - i, cbdesc.uFlags, pcbdesc->uFlags); + ok(hr == S_OK, "Got unexpected hr %#x, i %u.\n", hr, i); + + ok(!strcmp(cbdesc.Name, pcbdesc->Name), "Got unexpected name "%s", i %u.\n", cbdesc.Name, i); + ok(cbdesc.Type == pcbdesc->Type, "Got unexpected Type %#x, i %u.\n", cbdesc.Type, i); + ok(cbdesc.Variables == pcbdesc->Variables, "Got unexpected Variables %u, i %u.\n", cbdesc.Variables, i); + ok(cbdesc.Size == pcbdesc->Size, "Got unexpected Size %u, i %u.\n", cbdesc.Size, i); + ok(cbdesc.uFlags == pcbdesc->uFlags, "Got unexpected uFlags %#x, i %u.\n", cbdesc.uFlags, i); + + if (ref12) + { + cb12 = ref12->lpVtbl->GetConstantBufferByIndex(ref12, i); + ok(cb12_dummy != cb12, "Got dummy constant buffer, i %u.\n", i); + + hr = cb12->lpVtbl->GetDesc(cb12, &cbdesc12); + ok(hr == S_OK, "Got unexpected hr %#x, i %u.\n", hr, i); + + ok(!strcmp(cbdesc12.Name, pcbdesc->Name), "Got unexpected name "%s", i %u.\n", cbdesc.Name, i); + ok(cbdesc.Type == pcbdesc->Type, "Got unexpected Type %#x, i %u.\n", cbdesc.Type, i); + ok(!memcmp(&cbdesc12.Type, &cbdesc.Type, sizeof(cbdesc) - offsetof(D3D11_SHADER_BUFFER_DESC, Type)), + "CB description does not match. i %u.\n", i); + } }
/* variables */ @@ -1707,45 +1758,85 @@ static void test_reflection_constant_buffer(void) v11 = ref11->lpVtbl->GetVariableByName(ref11, pvdesc->Name); else v11 = cb11_valid->lpVtbl->GetVariableByName(cb11_valid, pvdesc->Name); - ok(v11_dummy != v11, "Test %u: got unexpected variable %p.\n", i, v11); + ok(v11_dummy != v11, "Test %u, got unexpected variable %p.\n", i, v11); + + if (D3D_COMPILER_VERSION) + { + vdesc.StartTexture = 0xdeadbeef; + vdesc.TextureSize = 0xdeadbeef; + vdesc.StartSampler = 0xdeadbeef; + vdesc.SamplerSize = 0xdeadbeef; + } + else + { + vdesc.StartTexture = 0xffffffff; + vdesc.StartSampler = 0xffffffff; + }
hr = v11->lpVtbl->GetDesc(v11, &vdesc); - ok(hr == S_OK, "GetDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK); - - ok(!strcmp(vdesc.Name, pvdesc->Name), "GetDesc(%u) Name failed, got "%s", expected "%s"\n", - i, vdesc.Name, pvdesc->Name); - ok(vdesc.StartOffset == pvdesc->StartOffset, "GetDesc(%u) StartOffset failed, got %u, expected %u\n", - i, vdesc.StartOffset, pvdesc->StartOffset); - ok(vdesc.Size == pvdesc->Size, "GetDesc(%u) Size failed, got %u, expected %u\n", - i, vdesc.Size, pvdesc->Size); - ok(vdesc.uFlags == pvdesc->uFlags, "GetDesc(%u) uFlags failed, got %u, expected %u\n", - i, vdesc.uFlags, pvdesc->uFlags); - ok(vdesc.DefaultValue == pvdesc->DefaultValue, "GetDesc(%u) DefaultValue failed\n", i); + ok(hr == S_OK, "Got unexpected hr %#x, i %u.\n", hr, i); + + ok(!strcmp(vdesc.Name, pvdesc->Name), "Got unexpected name "%s", i %u", vdesc.Name, i); + ok(vdesc.StartOffset == pvdesc->StartOffset, "Got unexpected StartOffset %u, i %u.\n", + vdesc.StartOffset, i); + ok(vdesc.Size == pvdesc->Size, "Got unexpected Size %u, i %u.\n", vdesc.Size, i); + ok(vdesc.uFlags == pvdesc->uFlags, "Got unexpected uFlags %#x, i %u.\n", vdesc.uFlags, i); + ok(vdesc.DefaultValue == pvdesc->DefaultValue, "Got unexpected DefaultValue %p, i %u.\n", + vdesc.DefaultValue, i); + todo_wine_if(D3D_COMPILER_VERSION) + { + ok(vdesc.StartTexture == 0xffffffff, "Got unexpected StartTexture %#x, i %u.\n", vdesc.StartTexture, i); + ok(!vdesc.TextureSize, "Got unexpected TextureSize %u, i %u.\n", vdesc.TextureSize, i); + ok(vdesc.StartSampler == 0xffffffff, "Got unexpected StartSampler %u, i %u.\n", vdesc.StartSampler, i); + ok(!vdesc.SamplerSize, "Got unexpected SamplerSize %u, i %u.\n", vdesc.SamplerSize, i); + } + + if (ref12) + { + v12 = ref12->lpVtbl->GetVariableByName(ref12, pvdesc->Name); + ok(v12_dummy != v12, "Test %u, got unexpected variable %p.\n", i, v12); + hr = v12->lpVtbl->GetDesc(v12, &vdesc12); + ok(hr == S_OK, "Got unexpected hr %#x, i %u.\n", hr, i); + ok(!strcmp(vdesc12.Name, pvdesc->Name), "Got unexpected name "%s", i %u", vdesc12.Name, i); + todo_wine ok(!memcmp(&vdesc12.StartOffset, &vdesc.StartOffset, + sizeof(vdesc) - offsetof(D3D11_SHADER_VARIABLE_DESC, StartOffset)), + "D3D11 and D3D12 descs do not match.\n"); + } + else + { + /* Silence compiler warning. */ + v12 = NULL; + }
/* types */ ptdesc = &test_reflection_constant_buffer_type_result[test_reflection_constant_buffer_variable_result[i].type];
t11 = v11->lpVtbl->GetType(v11); - ok(t11_dummy != t11, "GetType(%u) failed\n", i); + ok(t11_dummy != t11, "Got unexpected type %p, i %u.\n", t11, i);
hr = t11->lpVtbl->GetDesc(t11, &tdesc); - ok(hr == S_OK, "GetDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK); - - ok(tdesc.Class == ptdesc->Class, "GetDesc(%u) Class failed, got %x, expected %x\n", - i, tdesc.Class, ptdesc->Class); - ok(tdesc.Type == ptdesc->Type, "GetDesc(%u) Type failed, got %x, expected %x\n", - i, tdesc.Type, ptdesc->Type); - ok(tdesc.Rows == ptdesc->Rows, "GetDesc(%u) Rows failed, got %x, expected %x\n", - i, tdesc.Rows, ptdesc->Rows); - ok(tdesc.Columns == ptdesc->Columns, "GetDesc(%u) Columns failed, got %u, expected %u\n", - i, tdesc.Columns, ptdesc->Columns); - ok(tdesc.Elements == ptdesc->Elements, "GetDesc(%u) Elements failed, got %u, expected %u\n", - i, tdesc.Elements, ptdesc->Elements); - ok(tdesc.Offset == ptdesc->Offset, "GetDesc(%u) Offset failed, got %u, expected %u\n", - i, tdesc.Offset, ptdesc->Offset); + ok(hr == S_OK, "Got unexpected hr %#x, i %u.\n", hr, i); + + ok(tdesc.Class == ptdesc->Class, "Got unexpected Class %u, i %u.\n", tdesc.Class, i); + ok(tdesc.Type == ptdesc->Type, "Got unexpected Type %u, i %u.\n", tdesc.Type, i); + ok(tdesc.Rows == ptdesc->Rows, "Got unexpected Rows %u, i %u.\n", tdesc.Rows, i); + ok(tdesc.Columns == ptdesc->Columns, "Got unexpected Columns %u, i %u.\n", tdesc.Columns, i); + ok(tdesc.Elements == ptdesc->Elements, "Got unexpected Elements %u, i %u.\n", tdesc.Elements, i); + ok(tdesc.Offset == ptdesc->Offset, "Got unexpected Offset %u, i %u.\n", tdesc.Offset, i); if (D3D_COMPILER_VERSION) - ok(!strcmp(tdesc.Name, ptdesc->Name), "Test %u: got unexpected Name %s.\n", - i, debugstr_a(tdesc.Name)); + ok(!strcmp(tdesc.Name, ptdesc->Name), "Got unexpected Name %s, i %u.\n", debugstr_a(tdesc.Name), i); + + if (ref12) + { + t12 = v12->lpVtbl->GetType(v12); + ok(t12_dummy != t12, "Got unexpected type %p, i %u.\n", t12, i); + + hr = t12->lpVtbl->GetDesc(t12, &tdesc12); + ok(hr == S_OK, "Got unexpected hr %#x, i %u.\n", hr, i); + ok(!memcmp(&tdesc12, &tdesc, offsetof(D3D11_SHADER_TYPE_DESC, Name)), + "D3D11 and D3D12 descs do not match.\n"); + ok(!strcmp(tdesc12.Name, ptdesc->Name), "Got unexpected Name %s, i %u.\n", debugstr_a(tdesc12.Name), i); + } }
/* types */ @@ -1756,47 +1847,91 @@ static void test_reflection_constant_buffer(void) ok(v11_dummy != v11, "Got unexpected variable %p.\n", v11);
t11 = v11->lpVtbl->GetType(v11); - ok(t11 != t11_dummy, "GetType failed\n"); + ok(t11 != t11_dummy, "Got unexpected type %p.\n", t11);
t = t11->lpVtbl->GetMemberTypeByIndex(t11, 0); - ok(t != t11_dummy, "GetMemberTypeByIndex failed\n"); + ok(t != t11_dummy, "Got unexpected type %p.\n", t);
t2 = t11->lpVtbl->GetMemberTypeByName(t11, "a"); - ok(t == t2, "GetMemberTypeByName failed, got %p, expected %p\n", t2, t); + ok(t == t2, "Got unexpected type %p.\n", t2);
string = t11->lpVtbl->GetMemberTypeName(t11, 0); - ok(!strcmp(string, "a"), "GetMemberTypeName failed, got "%s", expected "%s"\n", string, "a"); + ok(!strcmp(string, "a"), "Got unexpected string "%s".\n", string);
t = t11->lpVtbl->GetMemberTypeByIndex(t11, 1); - ok(t != t11_dummy, "GetMemberTypeByIndex failed\n"); + ok(t != t11_dummy, "Got unexpected type %p.\n", t);
t2 = t11->lpVtbl->GetMemberTypeByName(t11, "b"); - ok(t == t2, "GetMemberTypeByName failed, got %p, expected %p\n", t2, t); + ok(t == t2, "Got unexpected type %p.\n", t2);
string = t11->lpVtbl->GetMemberTypeName(t11, 1); - ok(!strcmp(string, "b"), "GetMemberTypeName failed, got "%s", expected "%s"\n", string, "b"); + ok(!strcmp(string, "b"), "Got unexpected string "%s".\n", string);
#if D3D_COMPILER_VERSION /* float vs float (in struct) */ hr = t11->lpVtbl->IsEqual(t11, t11_valid); - ok(hr == S_FALSE, "IsEqual failed, got %x, expected %x\n", hr, S_FALSE); + ok(hr == S_FALSE, "Got unexpected hr %#x.\n", hr);
hr = t11_valid->lpVtbl->IsEqual(t11_valid, t11); - ok(hr == S_FALSE, "IsEqual failed, got %x, expected %x\n", hr, S_FALSE); + ok(hr == S_FALSE, "Got unexpected hr %#x.\n", hr);
/* float vs float */ t = t11->lpVtbl->GetMemberTypeByIndex(t11, 0); - ok(t != t11_dummy, "GetMemberTypeByIndex failed\n"); + ok(t != t11_dummy, "Got unexpected type %p.\n", t);
t2 = t11->lpVtbl->GetMemberTypeByIndex(t11, 1); - ok(t2 != t11_dummy, "GetMemberTypeByIndex failed\n"); + ok(t2 != t11_dummy, "Got unexpected type %p.\n", t2);
hr = t->lpVtbl->IsEqual(t, t2); - ok(hr == S_OK, "IsEqual failed, got %x, expected %x\n", hr, S_OK); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); #endif
+ if (ref12) + { + v12 = ref12->lpVtbl->GetVariableByName(ref12, "t"); + ok(v12_dummy != v12, "Got unexpected variable %p.\n", v12); + + t12 = v12->lpVtbl->GetType(v12); + ok(t12 != t12_dummy, "Got unexpected type %p.\n", t12); + + mt12 = t12->lpVtbl->GetMemberTypeByIndex(t12, 0); + ok(mt12 != t12_dummy, "Got unexpected type %p.\n", mt12); + + mt12_2 = t12->lpVtbl->GetMemberTypeByName(t12, "a"); + ok(mt12 == mt12_2, "Got unexpected type %p.\n", mt12_2); + + string = t12->lpVtbl->GetMemberTypeName(t12, 0); + ok(!strcmp(string, "a"), "Got unexpected string "%s".\n", string); + + mt12 = t12->lpVtbl->GetMemberTypeByIndex(t12, 1); + ok(mt12 != t12_dummy, "Got unexpected type %p.\n", mt12); + + mt12_2 = t12->lpVtbl->GetMemberTypeByName(t12, "b"); + ok(mt12 == mt12_2, "Got unexpected type %p.\n", mt12_2); + + string = t12->lpVtbl->GetMemberTypeName(t12, 1); + ok(!strcmp(string, "b"), "Got unexpected string "%s".\n", string); + + hr = t12->lpVtbl->IsEqual(t12, t12_valid); + ok(hr == S_FALSE, "Got unexpected hr %#x.\n", hr); + + hr = t12_valid->lpVtbl->IsEqual(t12_valid, t12); + ok(hr == S_FALSE, "Got unexpected hr %#x.\n", hr); + + mt12 = t12->lpVtbl->GetMemberTypeByIndex(t12, 0); + ok(mt12 != t12_dummy, "Got unexpected type %p.\n", mt12); + + mt12_2 = t12->lpVtbl->GetMemberTypeByIndex(t12, 1); + ok(mt12_2 != t12_dummy, "Got unexpected type %p.\n", mt12_2); + + hr = mt12->lpVtbl->IsEqual(mt12, mt12_2); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + count = ref12->lpVtbl->Release(ref12); + ok(!count, "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); }
/*
Signed-off-by: Paul Gofman pgofman@codeweavers.com --- dlls/d3dcompiler_43/tests/reflection.c | 267 ++++++++++++++++--------- 1 file changed, 175 insertions(+), 92 deletions(-)
diff --git a/dlls/d3dcompiler_43/tests/reflection.c b/dlls/d3dcompiler_43/tests/reflection.c index 6327d68af32..c29c800ccdd 100644 --- a/dlls/d3dcompiler_43/tests/reflection.c +++ b/dlls/d3dcompiler_43/tests/reflection.c @@ -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; + 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,39 @@ 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); + } +#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 +1228,57 @@ 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); - - 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); + hr = ref11->lpVtbl->GetResourceBindingDesc(ref11, i, &desc11); + ok(hr == S_OK, "Got unexpected hr %x, i %u.\n", hr, i); + + 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->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"); + /* 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); + } }
#if D3D_COMPILER_VERSION @@ -1237,30 +1287,63 @@ 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); - - 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); + hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, pdesc->Name, &desc11); + ok(hr == S_OK, "Got unexpected hr %x, i %u.\n", hr, i); + + 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); + } } #endif
+ if (ref12) + { + 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 @@ -1874,12 +1957,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)
On Wed, Sep 2, 2020 at 9:30 PM Paul Gofman pgofman@codeweavers.com wrote:
Signed-off-by: Paul Gofman pgofman@codeweavers.com
dlls/d3dcompiler_43/tests/reflection.c | 267 ++++++++++++++++--------- 1 file changed, 175 insertions(+), 92 deletions(-)
@@ -1204,31 +1228,57 @@ 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);
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);
hr = ref11->lpVtbl->GetResourceBindingDesc(ref11, i, &desc11);
ok(hr == S_OK, "Got unexpected hr %x, i %u.\n", hr, i);
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->GetResourceBindingDescByName(ref12, pdesc->Name, &desc12);
ok(hr == S_OK, "Got unexpected hr %x, i %u.\n", hr, i);
Did you mean to test GetResourceBindingDesc() here instead, mirroring the test above?
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");
/* 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);
I wonder if it makes sense to have the opposite test in Wine too: ref11_from_d3d12, passing in a D3D12_SHADER_INPUT_BIND_DESC pointer (with a cast) to make sure not to write over some other variable.
On 9/8/20 23:43, Matteo Bruni wrote:
On Wed, Sep 2, 2020 at 9:30 PM Paul Gofman pgofman@codeweavers.com wrote:
Signed-off-by: Paul Gofman pgofman@codeweavers.com
dlls/d3dcompiler_43/tests/reflection.c | 267 ++++++++++++++++--------- 1 file changed, 175 insertions(+), 92 deletions(-)
@@ -1204,31 +1228,57 @@ 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);
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);
hr = ref11->lpVtbl->GetResourceBindingDesc(ref11, i, &desc11);
ok(hr == S_OK, "Got unexpected hr %x, i %u.\n", hr, i);
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);
#if D3D_COMPILER_VERSION expected = pdesc->uFlags; #else expected = 0; todo_wine_if(pdesc->uFlags) #endifok(desc11.BindCount == pdesc->BindCount, "Got unexpected BindCount %u, i %u.\n", desc11.BindCount, i);
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->GetResourceBindingDescByName(ref12, pdesc->Name, &desc12);
ok(hr == S_OK, "Got unexpected hr %x, i %u.\n", hr, i);
Did you mean to test GetResourceBindingDesc() here instead, mirroring the test above?
Yes, sure, I will update that.
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");
/* 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);
I wonder if it makes sense to have the opposite test in Wine too: ref11_from_d3d12, passing in a D3D12_SHADER_INPUT_BIND_DESC pointer (with a cast) to make sure not to write over some other variable.
Yeah, I will add the test. It is probably more interesting to have than the other ones checking identical interfaces.
Signed-off-by: Paul Gofman pgofman@codeweavers.com --- dlls/d3dcompiler_43/tests/reflection.c | 284 ++++++++++++++++++------- 1 file changed, 208 insertions(+), 76 deletions(-)
diff --git a/dlls/d3dcompiler_43/tests/reflection.c b/dlls/d3dcompiler_43/tests/reflection.c index c29c800ccdd..8b8679ed025 100644 --- a/dlls/d3dcompiler_43/tests/reflection.c +++ b/dlls/d3dcompiler_43/tests/reflection.c @@ -1569,26 +1569,38 @@ static const D3D11_SHADER_TYPE_DESC test_reflection_constant_buffer_type_result[
static void test_reflection_constant_buffer(void) { - HRESULT hr; - ULONG count; - ID3D11ShaderReflection *ref11; + ID3D12ShaderReflectionType *t12, *mt12, *mt12_2, *t12_dummy = NULL, *t12_valid = NULL; + ID3D12ShaderReflectionConstantBuffer *cb12, *cb12_dummy = NULL, *cb12_valid = NULL; ID3D11ShaderReflectionConstantBuffer *cb11, *cb11_dummy = NULL, *cb11_valid = NULL; - ID3D11ShaderReflectionVariable *v11, *v11_dummy = NULL, *v11_valid = NULL; ID3D11ShaderReflectionType *t11, *t, *t2, *t11_dummy = NULL, *t11_valid = NULL; - D3D11_SHADER_BUFFER_DESC cbdesc = {0}; + ID3D12ShaderReflectionVariable *v12, *v12_dummy = NULL, *v12_valid = NULL; + ID3D11ShaderReflectionVariable *v11, *v11_dummy = NULL, *v11_valid = NULL; + D3D12_SHADER_VARIABLE_DESC vdesc12 = {0}; + const D3D11_SHADER_VARIABLE_DESC *pvdesc; + const D3D11_SHADER_BUFFER_DESC *pcbdesc; + D3D12_SHADER_BUFFER_DESC cbdesc12 = {0}; D3D11_SHADER_VARIABLE_DESC vdesc = {0}; + D3D11_SHADER_BUFFER_DESC cbdesc = {0}; + ID3D12ShaderReflection *ref12 = NULL; + const D3D11_SHADER_TYPE_DESC *ptdesc; + D3D12_SHADER_TYPE_DESC tdesc12 = {0}; D3D11_SHADER_TYPE_DESC tdesc = {0}; + ID3D11ShaderReflection *ref11; D3D11_SHADER_DESC sdesc = {0}; - const D3D11_SHADER_BUFFER_DESC *pcbdesc; - const D3D11_SHADER_VARIABLE_DESC *pvdesc; - const D3D11_SHADER_TYPE_DESC *ptdesc; unsigned int i, expected; LPCSTR string; + ULONG count; + HRESULT hr;
hr = call_reflect(test_reflection_constant_buffer_blob, test_reflection_constant_buffer_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11); ok(hr == S_OK, "D3DReflect failed %x\n", hr);
+#if D3D_COMPILER_VERSION + call_reflect(test_reflection_constant_buffer_blob, test_reflection_constant_buffer_blob[6], + &IID_ID3D12ShaderReflection, (void **)&ref12); +#endif + hr = ref11->lpVtbl->GetDesc(ref11, &sdesc); ok(hr == S_OK, "GetDesc failed %x\n", hr);
@@ -1639,20 +1651,44 @@ static void test_reflection_constant_buffer(void)
/* get the dummys for comparison */ cb11_dummy = ref11->lpVtbl->GetConstantBufferByIndex(ref11, 0xffffffff); - ok(cb11_dummy != NULL, "GetConstantBufferByIndex failed\n"); + ok(!!cb11_dummy, "Got unexpected buffer %p.\n", cb11_dummy); + + if (ref12) + { + cb12_dummy = ref12->lpVtbl->GetConstantBufferByIndex(ref12, 0xffffffff); + ok(!!cb12_dummy, "Got unexpected buffer %p.\n", cb12_dummy); + ok(cb12_dummy == (void *)cb11_dummy, "Got unexpected buffer %p.\n", cb12_dummy);
+ v12_dummy = cb12_dummy->lpVtbl->GetVariableByIndex(cb12_dummy, 0xffffffff); + ok(!!v12_dummy, "Got unexpected NULL variable.\n"); + } v11_dummy = cb11_dummy->lpVtbl->GetVariableByIndex(cb11_dummy, 0xffffffff); - ok(v11_dummy != NULL, "GetVariableByIndex failed\n"); + ok(!!v11_dummy, "Got unexpected NULL variable.\n");
t11_dummy = v11_dummy->lpVtbl->GetType(v11_dummy); - ok(t11_dummy != NULL, "GetType failed\n"); + ok(!!t11_dummy, "Got NULL type.\n");
/* get the valid variables */ cb11_valid = ref11->lpVtbl->GetConstantBufferByIndex(ref11, 1); - ok(cb11_valid != cb11_dummy && cb11_valid, "GetConstantBufferByIndex failed\n"); + ok(cb11_valid != cb11_dummy && cb11_valid, "Got unexpected buffer %p.\n", cb11_valid); + if (ref12) + { + cb12_valid = ref12->lpVtbl->GetConstantBufferByIndex(ref12, 1); + ok(cb12_valid != cb12_dummy && cb12_valid, "Got unexpected buffer %p.\n", cb11_valid); + ok(cb12_valid != (void *)cb11_valid, "Got unexpected buffer %p.\n", cb12_valid); + + v12_valid = cb12_valid->lpVtbl->GetVariableByIndex(cb12_valid, 0); + ok(v12_valid != v12_dummy && v12_valid, "Got unexpected variable %p.\n", v12_valid); + + t12_dummy = v12_dummy->lpVtbl->GetType(v12_dummy); + ok(!!t12_dummy, "Got NULL type.\n"); + + t12_valid = v12_valid->lpVtbl->GetType(v12_valid); + ok(t12_valid != t12_dummy && t12_valid, "GetType failed\n"); + }
v11_valid = cb11_valid->lpVtbl->GetVariableByIndex(cb11_valid, 0); - ok(v11_valid != v11_dummy && v11_valid, "GetVariableByIndex failed\n"); + ok(v11_valid != v11_dummy && v11_valid, "Got unexpected variable %p.\n", v11_valid);
t11_valid = v11_valid->lpVtbl->GetType(v11_valid); ok(t11_valid != t11_dummy && t11_valid, "GetType failed\n"); @@ -1666,30 +1702,36 @@ static void test_reflection_constant_buffer(void)
#if D3D_COMPILER_VERSION v11 = ref11->lpVtbl->GetVariableByName(ref11, NULL); - ok(v11_dummy == v11, "GetVariableByIndex failed, got %p, expected %p\n", v11, v11_dummy); + ok(v11_dummy == v11, "Got unexpected variable %p.\n", v11);
v11 = ref11->lpVtbl->GetVariableByName(ref11, "invalid"); - ok(v11_dummy == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_dummy); + ok(v11_dummy == v11, "Got unexpected variable %p.\n", v11);
v11 = ref11->lpVtbl->GetVariableByName(ref11, "a"); - ok(v11_valid == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_valid); + ok(v11_valid == v11, "Got unexpected variable %p.\n", v11); #endif
/* constant buffer calls */ v11 = cb11_dummy->lpVtbl->GetVariableByName(cb11_dummy, NULL); - ok(v11_dummy == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_dummy); + ok(v11_dummy == v11, "Got unexpected variable %p.\n", v11);
v11 = cb11_dummy->lpVtbl->GetVariableByName(cb11_dummy, "invalid"); - ok(v11_dummy == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_dummy); + ok(v11_dummy == v11, "Got unexpected variable %p.\n", v11);
v11 = cb11_valid->lpVtbl->GetVariableByName(cb11_valid, NULL); - ok(v11_dummy == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_dummy); + ok(v11_dummy == v11, "Got unexpected variable %p.\n", v11);
v11 = cb11_valid->lpVtbl->GetVariableByName(cb11_valid, "invalid"); - ok(v11_dummy == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_dummy); + ok(v11_dummy == v11, "Got unexpected variable %p.\n", v11);
v11 = cb11_valid->lpVtbl->GetVariableByName(cb11_valid, "a"); - ok(v11_valid == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_valid); + ok(v11_valid == v11, "Got unexpected variable %p.\n", v11); + + if (ref12) + { + v12 = cb12_valid->lpVtbl->GetVariableByName(cb12_valid, "a"); + ok(v12_valid == v12, "Got unexpected variable %p.\n", v12); + }
hr = cb11_dummy->lpVtbl->GetDesc(cb11_dummy, NULL); ok(hr == E_FAIL, "GetDesc failed, got %x, expected %x\n", hr, E_FAIL); @@ -1764,21 +1806,30 @@ static void test_reflection_constant_buffer(void) pcbdesc = &test_reflection_constant_buffer_cb_result[i];
cb11 = ref11->lpVtbl->GetConstantBufferByIndex(ref11, i); - ok(cb11_dummy != cb11, "GetConstantBufferByIndex(%u) failed\n", i); + ok(cb11_dummy != cb11, "Got dummy constant buffer, i %u.\n", i);
hr = cb11->lpVtbl->GetDesc(cb11, &cbdesc); - ok(hr == S_OK, "GetDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK); - - ok(!strcmp(cbdesc.Name, pcbdesc->Name), "GetDesc(%u) Name failed, got "%s", expected "%s"\n", - i, cbdesc.Name, pcbdesc->Name); - ok(cbdesc.Type == pcbdesc->Type, "GetDesc(%u) Type failed, got %x, expected %x\n", - i, cbdesc.Type, pcbdesc->Type); - ok(cbdesc.Variables == pcbdesc->Variables, "GetDesc(%u) Variables failed, got %u, expected %u\n", - i, cbdesc.Variables, pcbdesc->Variables); - ok(cbdesc.Size == pcbdesc->Size, "GetDesc(%u) Size failed, got %u, expected %u\n", - i, cbdesc.Size, pcbdesc->Size); - ok(cbdesc.uFlags == pcbdesc->uFlags, "GetDesc(%u) uFlags failed, got %u, expected %u\n", - i, cbdesc.uFlags, pcbdesc->uFlags); + ok(hr == S_OK, "Got unexpected hr %#x, i %u.\n", hr, i); + + ok(!strcmp(cbdesc.Name, pcbdesc->Name), "Got unexpected name "%s", i %u.\n", cbdesc.Name, i); + ok(cbdesc.Type == pcbdesc->Type, "Got unexpected Type %#x, i %u.\n", cbdesc.Type, i); + ok(cbdesc.Variables == pcbdesc->Variables, "Got unexpected Variables %u, i %u.\n", cbdesc.Variables, i); + ok(cbdesc.Size == pcbdesc->Size, "Got unexpected Size %u, i %u.\n", cbdesc.Size, i); + ok(cbdesc.uFlags == pcbdesc->uFlags, "Got unexpected uFlags %#x, i %u.\n", cbdesc.uFlags, i); + + if (ref12) + { + cb12 = ref12->lpVtbl->GetConstantBufferByIndex(ref12, i); + ok(cb12_dummy != cb12, "Got dummy constant buffer, i %u.\n", i); + + hr = cb12->lpVtbl->GetDesc(cb12, &cbdesc12); + ok(hr == S_OK, "Got unexpected hr %#x, i %u.\n", hr, i); + + ok(!strcmp(cbdesc12.Name, pcbdesc->Name), "Got unexpected name "%s", i %u.\n", cbdesc.Name, i); + ok(cbdesc.Type == pcbdesc->Type, "Got unexpected Type %#x, i %u.\n", cbdesc.Type, i); + ok(!memcmp(&cbdesc12.Type, &cbdesc.Type, sizeof(cbdesc) - offsetof(D3D11_SHADER_BUFFER_DESC, Type)), + "CB description does not match. i %u.\n", i); + } }
/* variables */ @@ -1790,45 +1841,82 @@ static void test_reflection_constant_buffer(void) v11 = ref11->lpVtbl->GetVariableByName(ref11, pvdesc->Name); else v11 = cb11_valid->lpVtbl->GetVariableByName(cb11_valid, pvdesc->Name); - ok(v11_dummy != v11, "Test %u: got unexpected variable %p.\n", i, v11); + ok(v11_dummy != v11, "Test %u, got unexpected variable %p.\n", i, v11); + + if (D3D_COMPILER_VERSION) + { + vdesc.StartTexture = 0xdeadbeef; + vdesc.TextureSize = 0xdeadbeef; + vdesc.StartSampler = 0xdeadbeef; + vdesc.SamplerSize = 0xdeadbeef; + } + else + { + vdesc.StartTexture = 0xffffffff; + vdesc.StartSampler = 0xffffffff; + }
hr = v11->lpVtbl->GetDesc(v11, &vdesc); - ok(hr == S_OK, "GetDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK); - - ok(!strcmp(vdesc.Name, pvdesc->Name), "GetDesc(%u) Name failed, got "%s", expected "%s"\n", - i, vdesc.Name, pvdesc->Name); - ok(vdesc.StartOffset == pvdesc->StartOffset, "GetDesc(%u) StartOffset failed, got %u, expected %u\n", - i, vdesc.StartOffset, pvdesc->StartOffset); - ok(vdesc.Size == pvdesc->Size, "GetDesc(%u) Size failed, got %u, expected %u\n", - i, vdesc.Size, pvdesc->Size); - ok(vdesc.uFlags == pvdesc->uFlags, "GetDesc(%u) uFlags failed, got %u, expected %u\n", - i, vdesc.uFlags, pvdesc->uFlags); - ok(vdesc.DefaultValue == pvdesc->DefaultValue, "GetDesc(%u) DefaultValue failed\n", i); + ok(hr == S_OK, "Got unexpected hr %#x, i %u.\n", hr, i); + + ok(!strcmp(vdesc.Name, pvdesc->Name), "Got unexpected name "%s", i %u", vdesc.Name, i); + ok(vdesc.StartOffset == pvdesc->StartOffset, "Got unexpected StartOffset %u, i %u.\n", + vdesc.StartOffset, i); + ok(vdesc.Size == pvdesc->Size, "Got unexpected Size %u, i %u.\n", vdesc.Size, i); + ok(vdesc.uFlags == pvdesc->uFlags, "Got unexpected uFlags %#x, i %u.\n", vdesc.uFlags, i); + ok(vdesc.DefaultValue == pvdesc->DefaultValue, "Got unexpected DefaultValue %p, i %u.\n", + vdesc.DefaultValue, i); + todo_wine ok(vdesc.StartTexture == 0xffffffff, "Got unexpected StartTexture %#x, i %u.\n", vdesc.StartTexture, i); + todo_wine ok(!vdesc.TextureSize, "Got unexpected TextureSize %u, i %u.\n", vdesc.TextureSize, i); + todo_wine ok(vdesc.StartSampler == 0xffffffff, "Got unexpected StartSampler %u, i %u.\n", vdesc.StartSampler, i); + todo_wine ok(!vdesc.SamplerSize, "Got unexpected SamplerSize %u, i %u.\n", vdesc.SamplerSize, i); + + if (ref12) + { + v12 = ref12->lpVtbl->GetVariableByName(ref12, pvdesc->Name); + ok(v12_dummy != v12, "Test %u, got unexpected variable %p.\n", i, v12); + hr = v12->lpVtbl->GetDesc(v12, &vdesc12); + ok(hr == S_OK, "Got unexpected hr %#x, i %u.\n", hr, i); + ok(!strcmp(vdesc12.Name, pvdesc->Name), "Got unexpected name "%s", i %u", vdesc12.Name, i); + todo_wine ok(!memcmp(&vdesc12.StartOffset, &vdesc.StartOffset, + sizeof(vdesc) - offsetof(D3D11_SHADER_VARIABLE_DESC, StartOffset)), + "D3D11 and D3D12 descs do not match.\n"); + } + else + { + /* Silence compiler warning. */ + v12 = NULL; + }
/* types */ ptdesc = &test_reflection_constant_buffer_type_result[test_reflection_constant_buffer_variable_result[i].type];
t11 = v11->lpVtbl->GetType(v11); - ok(t11_dummy != t11, "GetType(%u) failed\n", i); + ok(t11_dummy != t11, "Got unexpected type %p, i %u.\n", t11, i);
hr = t11->lpVtbl->GetDesc(t11, &tdesc); - ok(hr == S_OK, "GetDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK); - - ok(tdesc.Class == ptdesc->Class, "GetDesc(%u) Class failed, got %x, expected %x\n", - i, tdesc.Class, ptdesc->Class); - ok(tdesc.Type == ptdesc->Type, "GetDesc(%u) Type failed, got %x, expected %x\n", - i, tdesc.Type, ptdesc->Type); - ok(tdesc.Rows == ptdesc->Rows, "GetDesc(%u) Rows failed, got %x, expected %x\n", - i, tdesc.Rows, ptdesc->Rows); - ok(tdesc.Columns == ptdesc->Columns, "GetDesc(%u) Columns failed, got %u, expected %u\n", - i, tdesc.Columns, ptdesc->Columns); - ok(tdesc.Elements == ptdesc->Elements, "GetDesc(%u) Elements failed, got %u, expected %u\n", - i, tdesc.Elements, ptdesc->Elements); - ok(tdesc.Offset == ptdesc->Offset, "GetDesc(%u) Offset failed, got %u, expected %u\n", - i, tdesc.Offset, ptdesc->Offset); + ok(hr == S_OK, "Got unexpected hr %#x, i %u.\n", hr, i); + + ok(tdesc.Class == ptdesc->Class, "Got unexpected Class %u, i %u.\n", tdesc.Class, i); + ok(tdesc.Type == ptdesc->Type, "Got unexpected Type %u, i %u.\n", tdesc.Type, i); + ok(tdesc.Rows == ptdesc->Rows, "Got unexpected Rows %u, i %u.\n", tdesc.Rows, i); + ok(tdesc.Columns == ptdesc->Columns, "Got unexpected Columns %u, i %u.\n", tdesc.Columns, i); + ok(tdesc.Elements == ptdesc->Elements, "Got unexpected Elements %u, i %u.\n", tdesc.Elements, i); + ok(tdesc.Offset == ptdesc->Offset, "Got unexpected Offset %u, i %u.\n", tdesc.Offset, i); if (D3D_COMPILER_VERSION) - ok(!strcmp(tdesc.Name, ptdesc->Name), "Test %u: got unexpected Name %s.\n", - i, debugstr_a(tdesc.Name)); + ok(!strcmp(tdesc.Name, ptdesc->Name), "Got unexpected Name %s, i %u.\n", debugstr_a(tdesc.Name), i); + + if (ref12) + { + t12 = v12->lpVtbl->GetType(v12); + ok(t12_dummy != t12, "Got unexpected type %p, i %u.\n", t12, i); + + hr = t12->lpVtbl->GetDesc(t12, &tdesc12); + ok(hr == S_OK, "Got unexpected hr %#x, i %u.\n", hr, i); + ok(!memcmp(&tdesc12, &tdesc, offsetof(D3D11_SHADER_TYPE_DESC, Name)), + "D3D11 and D3D12 descs do not match.\n"); + ok(!strcmp(tdesc12.Name, ptdesc->Name), "Got unexpected Name %s, i %u.\n", debugstr_a(tdesc12.Name), i); + } }
/* types */ @@ -1839,47 +1927,91 @@ static void test_reflection_constant_buffer(void) ok(v11_dummy != v11, "Got unexpected variable %p.\n", v11);
t11 = v11->lpVtbl->GetType(v11); - ok(t11 != t11_dummy, "GetType failed\n"); + ok(t11 != t11_dummy, "Got unexpected type %p.\n", t11);
t = t11->lpVtbl->GetMemberTypeByIndex(t11, 0); - ok(t != t11_dummy, "GetMemberTypeByIndex failed\n"); + ok(t != t11_dummy, "Got unexpected type %p.\n", t);
t2 = t11->lpVtbl->GetMemberTypeByName(t11, "a"); - ok(t == t2, "GetMemberTypeByName failed, got %p, expected %p\n", t2, t); + ok(t == t2, "Got unexpected type %p.\n", t2);
string = t11->lpVtbl->GetMemberTypeName(t11, 0); - ok(!strcmp(string, "a"), "GetMemberTypeName failed, got "%s", expected "%s"\n", string, "a"); + ok(!strcmp(string, "a"), "Got unexpected string "%s".\n", string);
t = t11->lpVtbl->GetMemberTypeByIndex(t11, 1); - ok(t != t11_dummy, "GetMemberTypeByIndex failed\n"); + ok(t != t11_dummy, "Got unexpected type %p.\n", t);
t2 = t11->lpVtbl->GetMemberTypeByName(t11, "b"); - ok(t == t2, "GetMemberTypeByName failed, got %p, expected %p\n", t2, t); + ok(t == t2, "Got unexpected type %p.\n", t2);
string = t11->lpVtbl->GetMemberTypeName(t11, 1); - ok(!strcmp(string, "b"), "GetMemberTypeName failed, got "%s", expected "%s"\n", string, "b"); + ok(!strcmp(string, "b"), "Got unexpected string "%s".\n", string);
#if D3D_COMPILER_VERSION /* float vs float (in struct) */ hr = t11->lpVtbl->IsEqual(t11, t11_valid); - ok(hr == S_FALSE, "IsEqual failed, got %x, expected %x\n", hr, S_FALSE); + ok(hr == S_FALSE, "Got unexpected hr %#x.\n", hr);
hr = t11_valid->lpVtbl->IsEqual(t11_valid, t11); - ok(hr == S_FALSE, "IsEqual failed, got %x, expected %x\n", hr, S_FALSE); + ok(hr == S_FALSE, "Got unexpected hr %#x.\n", hr);
/* float vs float */ t = t11->lpVtbl->GetMemberTypeByIndex(t11, 0); - ok(t != t11_dummy, "GetMemberTypeByIndex failed\n"); + ok(t != t11_dummy, "Got unexpected type %p.\n", t);
t2 = t11->lpVtbl->GetMemberTypeByIndex(t11, 1); - ok(t2 != t11_dummy, "GetMemberTypeByIndex failed\n"); + ok(t2 != t11_dummy, "Got unexpected type %p.\n", t2);
hr = t->lpVtbl->IsEqual(t, t2); - ok(hr == S_OK, "IsEqual failed, got %x, expected %x\n", hr, S_OK); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); #endif
+ if (ref12) + { + v12 = ref12->lpVtbl->GetVariableByName(ref12, "t"); + ok(v12_dummy != v12, "Got unexpected variable %p.\n", v12); + + t12 = v12->lpVtbl->GetType(v12); + ok(t12 != t12_dummy, "Got unexpected type %p.\n", t12); + + mt12 = t12->lpVtbl->GetMemberTypeByIndex(t12, 0); + ok(mt12 != t12_dummy, "Got unexpected type %p.\n", mt12); + + mt12_2 = t12->lpVtbl->GetMemberTypeByName(t12, "a"); + ok(mt12 == mt12_2, "Got unexpected type %p.\n", mt12_2); + + string = t12->lpVtbl->GetMemberTypeName(t12, 0); + ok(!strcmp(string, "a"), "Got unexpected string "%s".\n", string); + + mt12 = t12->lpVtbl->GetMemberTypeByIndex(t12, 1); + ok(mt12 != t12_dummy, "Got unexpected type %p.\n", mt12); + + mt12_2 = t12->lpVtbl->GetMemberTypeByName(t12, "b"); + ok(mt12 == mt12_2, "Got unexpected type %p.\n", mt12_2); + + string = t12->lpVtbl->GetMemberTypeName(t12, 1); + ok(!strcmp(string, "b"), "Got unexpected string "%s".\n", string); + + hr = t12->lpVtbl->IsEqual(t12, t12_valid); + ok(hr == S_FALSE, "Got unexpected hr %#x.\n", hr); + + hr = t12_valid->lpVtbl->IsEqual(t12_valid, t12); + ok(hr == S_FALSE, "Got unexpected hr %#x.\n", hr); + + mt12 = t12->lpVtbl->GetMemberTypeByIndex(t12, 0); + ok(mt12 != t12_dummy, "Got unexpected type %p.\n", mt12); + + mt12_2 = t12->lpVtbl->GetMemberTypeByIndex(t12, 1); + ok(mt12_2 != t12_dummy, "Got unexpected type %p.\n", mt12_2); + + hr = mt12->lpVtbl->IsEqual(mt12, mt12_2); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + count = ref12->lpVtbl->Release(ref12); + ok(!count, "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); }
/*
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=77986
Your paranoid android.
=== debiant (32 bit report) ===
d3d10: reflection.c:1869: Test succeeded inside todo block: Got unexpected StartTexture 0xffffffff, i 0. reflection.c:1870: Test succeeded inside todo block: Got unexpected TextureSize 0, i 0. reflection.c:1871: Test succeeded inside todo block: Got unexpected StartSampler 4294967295, i 0. reflection.c:1872: Test succeeded inside todo block: Got unexpected SamplerSize 0, i 0. reflection.c:1869: Test succeeded inside todo block: Got unexpected StartTexture 0xffffffff, i 1. reflection.c:1870: Test succeeded inside todo block: Got unexpected TextureSize 0, i 1. reflection.c:1871: Test succeeded inside todo block: Got unexpected StartSampler 4294967295, i 1. reflection.c:1872: Test succeeded inside todo block: Got unexpected SamplerSize 0, i 1. reflection.c:1869: Test succeeded inside todo block: Got unexpected StartTexture 0xffffffff, i 2. reflection.c:1870: Test succeeded inside todo block: Got unexpected TextureSize 0, i 2. reflection.c:1871: Test succeeded inside todo block: Got unexpected StartSampler 4294967295, i 2. reflection.c:1872: Test succeeded inside todo block: Got unexpected SamplerSize 0, i 2. reflection.c:1869: Test succeeded inside todo block: Got unexpected StartTexture 0xffffffff, i 3. reflection.c:1870: Test succeeded inside todo block: Got unexpected TextureSize 0, i 3. reflection.c:1871: Test succeeded inside todo block: Got unexpected StartSampler 4294967295, i 3. reflection.c:1872: Test succeeded inside todo block: Got unexpected SamplerSize 0, i 3.
=== debiant (32 bit Chinese:China report) ===
d3d10: reflection.c:1869: Test succeeded inside todo block: Got unexpected StartTexture 0xffffffff, i 0. reflection.c:1870: Test succeeded inside todo block: Got unexpected TextureSize 0, i 0. reflection.c:1871: Test succeeded inside todo block: Got unexpected StartSampler 4294967295, i 0. reflection.c:1872: Test succeeded inside todo block: Got unexpected SamplerSize 0, i 0. reflection.c:1869: Test succeeded inside todo block: Got unexpected StartTexture 0xffffffff, i 1. reflection.c:1870: Test succeeded inside todo block: Got unexpected TextureSize 0, i 1. reflection.c:1871: Test succeeded inside todo block: Got unexpected StartSampler 4294967295, i 1. reflection.c:1872: Test succeeded inside todo block: Got unexpected SamplerSize 0, i 1. reflection.c:1869: Test succeeded inside todo block: Got unexpected StartTexture 0xffffffff, i 2. reflection.c:1870: Test succeeded inside todo block: Got unexpected TextureSize 0, i 2. reflection.c:1871: Test succeeded inside todo block: Got unexpected StartSampler 4294967295, i 2. reflection.c:1872: Test succeeded inside todo block: Got unexpected SamplerSize 0, i 2. reflection.c:1869: Test succeeded inside todo block: Got unexpected StartTexture 0xffffffff, i 3. reflection.c:1870: Test succeeded inside todo block: Got unexpected TextureSize 0, i 3. reflection.c:1871: Test succeeded inside todo block: Got unexpected StartSampler 4294967295, i 3. reflection.c:1872: Test succeeded inside todo block: Got unexpected SamplerSize 0, i 3.
=== debiant (32 bit WoW report) ===
d3d10: reflection.c:1869: Test succeeded inside todo block: Got unexpected StartTexture 0xffffffff, i 0. reflection.c:1870: Test succeeded inside todo block: Got unexpected TextureSize 0, i 0. reflection.c:1871: Test succeeded inside todo block: Got unexpected StartSampler 4294967295, i 0. reflection.c:1872: Test succeeded inside todo block: Got unexpected SamplerSize 0, i 0. reflection.c:1869: Test succeeded inside todo block: Got unexpected StartTexture 0xffffffff, i 1. reflection.c:1870: Test succeeded inside todo block: Got unexpected TextureSize 0, i 1. reflection.c:1871: Test succeeded inside todo block: Got unexpected StartSampler 4294967295, i 1. reflection.c:1872: Test succeeded inside todo block: Got unexpected SamplerSize 0, i 1. reflection.c:1869: Test succeeded inside todo block: Got unexpected StartTexture 0xffffffff, i 2. reflection.c:1870: Test succeeded inside todo block: Got unexpected TextureSize 0, i 2. reflection.c:1871: Test succeeded inside todo block: Got unexpected StartSampler 4294967295, i 2. reflection.c:1872: Test succeeded inside todo block: Got unexpected SamplerSize 0, i 2. reflection.c:1869: Test succeeded inside todo block: Got unexpected StartTexture 0xffffffff, i 3. reflection.c:1870: Test succeeded inside todo block: Got unexpected TextureSize 0, i 3. reflection.c:1871: Test succeeded inside todo block: Got unexpected StartSampler 4294967295, i 3. reflection.c:1872: Test succeeded inside todo block: Got unexpected SamplerSize 0, i 3.
=== debiant (64 bit WoW report) ===
d3d10: reflection.c:1869: Test succeeded inside todo block: Got unexpected StartTexture 0xffffffff, i 0. reflection.c:1870: Test succeeded inside todo block: Got unexpected TextureSize 0, i 0. reflection.c:1871: Test succeeded inside todo block: Got unexpected StartSampler 4294967295, i 0. reflection.c:1872: Test succeeded inside todo block: Got unexpected SamplerSize 0, i 0. reflection.c:1869: Test succeeded inside todo block: Got unexpected StartTexture 0xffffffff, i 1. reflection.c:1870: Test succeeded inside todo block: Got unexpected TextureSize 0, i 1. reflection.c:1871: Test succeeded inside todo block: Got unexpected StartSampler 4294967295, i 1. reflection.c:1872: Test succeeded inside todo block: Got unexpected SamplerSize 0, i 1. reflection.c:1869: Test succeeded inside todo block: Got unexpected StartTexture 0xffffffff, i 2. reflection.c:1870: Test succeeded inside todo block: Got unexpected TextureSize 0, i 2. reflection.c:1871: Test succeeded inside todo block: Got unexpected StartSampler 4294967295, i 2. reflection.c:1872: Test succeeded inside todo block: Got unexpected SamplerSize 0, i 2. reflection.c:1869: Test succeeded inside todo block: Got unexpected StartTexture 0xffffffff, i 3. reflection.c:1870: Test succeeded inside todo block: Got unexpected TextureSize 0, i 3. reflection.c:1871: Test succeeded inside todo block: Got unexpected StartSampler 4294967295, i 3. reflection.c:1872: Test succeeded inside todo block: Got unexpected SamplerSize 0, i 3.
Signed-off-by: Paul Gofman pgofman@codeweavers.com --- dlls/d3dcompiler_43/reflection.c | 6 ++++++ dlls/d3dcompiler_43/tests/reflection.c | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 3c4a94f8e56..10558283dd4 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -857,6 +857,12 @@ static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_variable_GetDesc( desc->uFlags = This->flags; desc->DefaultValue = This->default_value;
+ /* TODO test and set proper values for texture. */ + desc->StartTexture = 0xffffffff; + desc->TextureSize = 0; + desc->StartSampler = 0xffffffff; + desc->SamplerSize = 0; + return S_OK; }
diff --git a/dlls/d3dcompiler_43/tests/reflection.c b/dlls/d3dcompiler_43/tests/reflection.c index 8b8679ed025..531e6bfbc82 100644 --- a/dlls/d3dcompiler_43/tests/reflection.c +++ b/dlls/d3dcompiler_43/tests/reflection.c @@ -1866,10 +1866,10 @@ static void test_reflection_constant_buffer(void) ok(vdesc.uFlags == pvdesc->uFlags, "Got unexpected uFlags %#x, i %u.\n", vdesc.uFlags, i); ok(vdesc.DefaultValue == pvdesc->DefaultValue, "Got unexpected DefaultValue %p, i %u.\n", vdesc.DefaultValue, i); - todo_wine ok(vdesc.StartTexture == 0xffffffff, "Got unexpected StartTexture %#x, i %u.\n", vdesc.StartTexture, i); - todo_wine ok(!vdesc.TextureSize, "Got unexpected TextureSize %u, i %u.\n", vdesc.TextureSize, i); - todo_wine ok(vdesc.StartSampler == 0xffffffff, "Got unexpected StartSampler %u, i %u.\n", vdesc.StartSampler, i); - todo_wine ok(!vdesc.SamplerSize, "Got unexpected SamplerSize %u, i %u.\n", vdesc.SamplerSize, i); + ok(vdesc.StartTexture == 0xffffffff, "Got unexpected StartTexture %#x, i %u.\n", vdesc.StartTexture, i); + ok(!vdesc.TextureSize, "Got unexpected TextureSize %u, i %u.\n", vdesc.TextureSize, i); + ok(vdesc.StartSampler == 0xffffffff, "Got unexpected StartSampler %u, i %u.\n", vdesc.StartSampler, i); + ok(!vdesc.SamplerSize, "Got unexpected SamplerSize %u, i %u.\n", vdesc.SamplerSize, i);
if (ref12) { @@ -1878,7 +1878,7 @@ static void test_reflection_constant_buffer(void) hr = v12->lpVtbl->GetDesc(v12, &vdesc12); ok(hr == S_OK, "Got unexpected hr %#x, i %u.\n", hr, i); ok(!strcmp(vdesc12.Name, pvdesc->Name), "Got unexpected name "%s", i %u", vdesc12.Name, i); - todo_wine ok(!memcmp(&vdesc12.StartOffset, &vdesc.StartOffset, + ok(!memcmp(&vdesc12.StartOffset, &vdesc.StartOffset, sizeof(vdesc) - offsetof(D3D11_SHADER_VARIABLE_DESC, StartOffset)), "D3D11 and D3D12 descs do not match.\n"); }