From: Nikolay Sivov Subject: [v2 PATCH] d3d10: Forward d3d10_shader_reflection_GetInputParameterDesc() to d3dcompiler implementation. Message-Id: <20190208162110.16670-1-nsivov@codeweavers.com> Date: Fri, 8 Feb 2019 19:21:10 +0300 Signed-off-by: Nikolay Sivov --- dlls/d3d10/d3d10_main.c | 22 --------------- dlls/d3d10/d3d10_private.h | 8 ------ dlls/d3d10/shader.c | 58 ++++++++++++++++++++++++++++++++++---- 3 files changed, 52 insertions(+), 36 deletions(-) diff --git a/dlls/d3d10/d3d10_main.c b/dlls/d3d10/d3d10_main.c index 4d3ed1244e..813be8fbdc 100644 --- a/dlls/d3d10/d3d10_main.c +++ b/dlls/d3d10/d3d10_main.c @@ -293,25 +293,3 @@ const char * WINAPI D3D10GetPixelShaderProfile(ID3D10Device *device) return "ps_4_0"; } - -HRESULT WINAPI D3D10ReflectShader(const void *data, SIZE_T data_size, ID3D10ShaderReflection **reflector) -{ - struct d3d10_shader_reflection *object; - - FIXME("data %p, data_size %lu, reflector %p stub!\n", data, data_size, reflector); - - if (!(object = heap_alloc_zero(sizeof(*object)))) - { - ERR("Failed to allocate D3D10 shader reflection object memory\n"); - return E_OUTOFMEMORY; - } - - object->ID3D10ShaderReflection_iface.lpVtbl = &d3d10_shader_reflection_vtbl; - object->refcount = 1; - - *reflector = &object->ID3D10ShaderReflection_iface; - - TRACE("Created ID3D10ShaderReflection %p\n", object); - - return S_OK; -} diff --git a/dlls/d3d10/d3d10_private.h b/dlls/d3d10/d3d10_private.h index e785b8b869..f40b9e238c 100644 --- a/dlls/d3d10/d3d10_private.h +++ b/dlls/d3d10/d3d10_private.h @@ -253,14 +253,6 @@ struct d3d10_effect struct d3d10_effect_technique *techniques; }; -/* ID3D10ShaderReflection */ -extern const struct ID3D10ShaderReflectionVtbl d3d10_shader_reflection_vtbl DECLSPEC_HIDDEN; -struct d3d10_shader_reflection -{ - ID3D10ShaderReflection ID3D10ShaderReflection_iface; - LONG refcount; -}; - HRESULT d3d10_effect_parse(struct d3d10_effect *This, const void *data, SIZE_T data_size) DECLSPEC_HIDDEN; /* D3D10Core */ diff --git a/dlls/d3d10/shader.c b/dlls/d3d10/shader.c index c97d8dfdf0..261d80077e 100644 --- a/dlls/d3d10/shader.c +++ b/dlls/d3d10/shader.c @@ -25,6 +25,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d10); +struct d3d10_shader_reflection +{ + ID3D10ShaderReflection ID3D10ShaderReflection_iface; + LONG refcount; + + ID3D11ShaderReflection *reflector; +}; + /* IUnknown methods */ static inline struct d3d10_shader_reflection *impl_from_ID3D10ShaderReflection(ID3D10ShaderReflection *iface) @@ -62,13 +70,16 @@ static ULONG STDMETHODCALLTYPE d3d10_shader_reflection_AddRef(ID3D10ShaderReflec static ULONG STDMETHODCALLTYPE d3d10_shader_reflection_Release(ID3D10ShaderReflection *iface) { - struct d3d10_shader_reflection *This = impl_from_ID3D10ShaderReflection(iface); - ULONG refcount = InterlockedDecrement(&This->refcount); + struct d3d10_shader_reflection *reflector = impl_from_ID3D10ShaderReflection(iface); + ULONG refcount = InterlockedDecrement(&reflector->refcount); - TRACE("%p decreasing refcount to %u\n", This, refcount); + TRACE("%p decreasing refcount to %u\n", reflector, refcount); if (!refcount) - heap_free(This); + { + reflector->reflector->lpVtbl->Release(reflector->reflector); + heap_free(reflector); + } return refcount; } @@ -109,9 +120,15 @@ static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetResourceBindingDesc( static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetInputParameterDesc( ID3D10ShaderReflection *iface, UINT index, D3D10_SIGNATURE_PARAMETER_DESC *desc) { - FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc); + struct d3d10_shader_reflection *reflector = impl_from_ID3D10ShaderReflection(iface); + D3D11_SIGNATURE_PARAMETER_DESC d3d11_desc; + HRESULT hr; - return E_NOTIMPL; + TRACE("iface %p, index %u, desc %p.\n", iface, index, desc); + + if (SUCCEEDED(hr = reflector->reflector->lpVtbl->GetInputParameterDesc(reflector->reflector, index, &d3d11_desc))) + memcpy(desc, &d3d11_desc, sizeof(*desc)); + return hr; } static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetOutputParameterDesc( @@ -137,6 +154,35 @@ const struct ID3D10ShaderReflectionVtbl d3d10_shader_reflection_vtbl = d3d10_shader_reflection_GetOutputParameterDesc, }; +HRESULT WINAPI D3D10ReflectShader(const void *data, SIZE_T data_size, ID3D10ShaderReflection **reflector) +{ + struct d3d10_shader_reflection *object; + HRESULT hr; + + TRACE("data %p, data_size %lu, reflector %p.\n", data, data_size, reflector); + + if (!(object = heap_alloc_zero(sizeof(*object)))) + { + ERR("Failed to allocate D3D10 shader reflection object memory\n"); + return E_OUTOFMEMORY; + } + + if (FAILED(hr = D3DReflect(data, data_size, &IID_ID3D11ShaderReflection, (void **)&object->reflector))) + { + heap_free(object); + return hr; + } + + object->ID3D10ShaderReflection_iface.lpVtbl = &d3d10_shader_reflection_vtbl; + object->refcount = 1; + + *reflector = &object->ID3D10ShaderReflection_iface; + + TRACE("Created ID3D10ShaderReflection %p\n", object); + + return S_OK; +} + HRESULT WINAPI D3D10CompileShader(const char *data, SIZE_T data_size, const char *filename, const D3D10_SHADER_MACRO *defines, ID3D10Include *include, const char *entrypoint, const char *profile, UINT flags, ID3D10Blob **shader, ID3D10Blob **error_messages) -- 2.20.1