Signed-off-by: Paul Gofman pgofman@codeweavers.com --- v2, v3: - no changes.
dlls/d3dcompiler_43/reflection.c | 63 ++++++++++++++------------ dlls/d3dcompiler_43/tests/reflection.c | 17 +++++++ 2 files changed, 50 insertions(+), 30 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 420af0aff9a..088f734a0a4 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -387,35 +387,8 @@ static HRESULT d3dcompiler_shader_reflection_QueryInterface(struct d3dcompiler_s return E_NOINTERFACE; }
-/* IUnknown methods */ - -static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_QueryInterface(ID3D11ShaderReflection *iface, - REFIID riid, void **object) -{ - TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); - - return d3dcompiler_shader_reflection_QueryInterface(impl_from_ID3D11ShaderReflection(iface), - riid, object, (IUnknown *)iface); -} - -static ULONG STDMETHODCALLTYPE d3d11_shader_reflection_AddRef(ID3D11ShaderReflection *iface) -{ - return d3dcompiler_shader_reflection_AddRef(impl_from_ID3D11ShaderReflection(iface)); -} - -static ULONG STDMETHODCALLTYPE d3d11_shader_reflection_Release(ID3D11ShaderReflection *iface) +static HRESULT d3dcompiler_shader_reflection_GetDesc(struct d3dcompiler_shader_reflection *reflection, D3D12_SHADER_DESC *desc) { - return d3dcompiler_shader_reflection_Release(impl_from_ID3D11ShaderReflection(iface)); -} - -/* ID3D11ShaderReflection methods */ - -static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_GetDesc(ID3D11ShaderReflection *iface, D3D11_SHADER_DESC *desc) -{ - struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D11ShaderReflection(iface); - - FIXME("iface %p, desc %p partial stub.\n", iface, desc); - if (!desc) { WARN("Invalid argument specified.\n"); @@ -464,6 +437,36 @@ static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_GetDesc(ID3D11ShaderRef return S_OK; }
+/* IUnknown methods */ + +static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_QueryInterface(ID3D11ShaderReflection *iface, + REFIID riid, void **object) +{ + TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); + + return d3dcompiler_shader_reflection_QueryInterface(impl_from_ID3D11ShaderReflection(iface), + riid, object, (IUnknown *)iface); +} + +static ULONG STDMETHODCALLTYPE d3d11_shader_reflection_AddRef(ID3D11ShaderReflection *iface) +{ + return d3dcompiler_shader_reflection_AddRef(impl_from_ID3D11ShaderReflection(iface)); +} + +static ULONG STDMETHODCALLTYPE d3d11_shader_reflection_Release(ID3D11ShaderReflection *iface) +{ + return d3dcompiler_shader_reflection_Release(impl_from_ID3D11ShaderReflection(iface)); +} + +/* ID3D11ShaderReflection methods */ + +static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_GetDesc(ID3D11ShaderReflection *iface, D3D11_SHADER_DESC *desc) +{ + FIXME("iface %p, desc %p partial stub.\n", iface, desc); + + return d3dcompiler_shader_reflection_GetDesc(impl_from_ID3D11ShaderReflection(iface), (D3D12_SHADER_DESC *)desc); +} + static struct ID3D11ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d11_shader_reflection_GetConstantBufferByIndex (ID3D11ShaderReflection *iface, UINT index) { @@ -2391,9 +2394,9 @@ static ULONG STDMETHODCALLTYPE d3d12_shader_reflection_Release(ID3D12ShaderRefle
static HRESULT STDMETHODCALLTYPE d3d12_shader_reflection_GetDesc(ID3D12ShaderReflection *iface, D3D12_SHADER_DESC *desc) { - FIXME("iface %p, desc %p stub.\n", iface, desc); + FIXME("iface %p, desc %p partial stub.\n", iface, desc);
- return E_NOTIMPL; + return d3dcompiler_shader_reflection_GetDesc(impl_from_ID3D12ShaderReflection(iface), desc); }
static struct ID3D12ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d12_shader_reflection_GetConstantBufferByIndex diff --git a/dlls/d3dcompiler_43/tests/reflection.c b/dlls/d3dcompiler_43/tests/reflection.c index 18ff93e305f..ad4a3f3ddee 100644 --- a/dlls/d3dcompiler_43/tests/reflection.c +++ b/dlls/d3dcompiler_43/tests/reflection.c @@ -391,7 +391,9 @@ static void test_reflection_desc_vs(void) D3D11_SIGNATURE_PARAMETER_DESC desc = {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 +404,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,6 +451,13 @@ 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); @@ -531,6 +542,12 @@ static void test_reflection_desc_vs(void) ok(!desc.Stream, "(%u): got unexpected Stream %u.\n", i, desc.Stream); }
+ 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); }