Move the methods for d3d10 reflection into d3dcompiler, along with the D3D10Reflect function.
Signed-off-by: Connor McAdams conmanx360@gmail.com --- dlls/d3d10/d3d10_main.c | 22 ----- dlls/d3d10/d3d10_private.h | 8 -- dlls/d3d10/shader.c | 112 ------------------------ dlls/d3dcompiler_43/reflection.c | 142 +++++++++++++++++++++++++++++++ 4 files changed, 142 insertions(+), 142 deletions(-)
diff --git a/dlls/d3d10/d3d10_main.c b/dlls/d3d10/d3d10_main.c index a54c44bdbb..2d08c82a3c 100644 --- a/dlls/d3d10/d3d10_main.c +++ b/dlls/d3d10/d3d10_main.c @@ -316,25 +316,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 fadd027f7a..96020cd4a0 100644 --- a/dlls/d3d10/d3d10_private.h +++ b/dlls/d3d10/d3d10_private.h @@ -249,14 +249,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 52e3cc06bf..d198689af6 100644 --- a/dlls/d3d10/shader.c +++ b/dlls/d3d10/shader.c @@ -22,118 +22,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d10);
-/* IUnknown methods */ - -static inline struct d3d10_shader_reflection *impl_from_ID3D10ShaderReflection(ID3D10ShaderReflection *iface) -{ - return CONTAINING_RECORD(iface, struct d3d10_shader_reflection, ID3D10ShaderReflection_iface); -} - -static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_QueryInterface(ID3D10ShaderReflection *iface, REFIID riid, void **object) -{ - TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object); - - if (IsEqualGUID(riid, &IID_ID3D10ShaderReflection) - || IsEqualGUID(riid, &IID_IUnknown)) - { - IUnknown_AddRef(iface); - *object = iface; - return S_OK; - } - - WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid)); - - *object = NULL; - return E_NOINTERFACE; -} - -static ULONG STDMETHODCALLTYPE d3d10_shader_reflection_AddRef(ID3D10ShaderReflection *iface) -{ - struct d3d10_shader_reflection *This = impl_from_ID3D10ShaderReflection(iface); - ULONG refcount = InterlockedIncrement(&This->refcount); - - TRACE("%p increasing refcount to %u\n", This, refcount); - - return refcount; -} - -static ULONG STDMETHODCALLTYPE d3d10_shader_reflection_Release(ID3D10ShaderReflection *iface) -{ - struct d3d10_shader_reflection *This = impl_from_ID3D10ShaderReflection(iface); - ULONG refcount = InterlockedDecrement(&This->refcount); - - TRACE("%p decreasing refcount to %u\n", This, refcount); - - if (!refcount) - heap_free(This); - - return refcount; -} - -/* ID3D10ShaderReflection methods */ - -static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetDesc(ID3D10ShaderReflection *iface, D3D10_SHADER_DESC *desc) -{ - FIXME("iface %p, desc %p stub!\n", iface, desc); - - return E_NOTIMPL; -} - -static struct ID3D10ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d10_shader_reflection_GetConstantBufferByIndex( - ID3D10ShaderReflection *iface, UINT index) -{ - FIXME("iface %p, index %u stub!\n", iface, index); - - return NULL; -} - -static struct ID3D10ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d10_shader_reflection_GetConstantBufferByName( - ID3D10ShaderReflection *iface, const char *name) -{ - FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name)); - - return NULL; -} - -static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetResourceBindingDesc( - ID3D10ShaderReflection *iface, UINT index, D3D10_SHADER_INPUT_BIND_DESC *desc) -{ - FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc); - - return E_NOTIMPL; -} - -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); - - return E_NOTIMPL; -} - -static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetOutputParameterDesc( - ID3D10ShaderReflection *iface, UINT index, D3D10_SIGNATURE_PARAMETER_DESC *desc) -{ - FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc); - - return E_NOTIMPL; -} - -const struct ID3D10ShaderReflectionVtbl d3d10_shader_reflection_vtbl = -{ - /* IUnknown methods */ - d3d10_shader_reflection_QueryInterface, - d3d10_shader_reflection_AddRef, - d3d10_shader_reflection_Release, - /* ID3D10ShaderReflection methods */ - d3d10_shader_reflection_GetDesc, - d3d10_shader_reflection_GetConstantBufferByIndex, - d3d10_shader_reflection_GetConstantBufferByName, - d3d10_shader_reflection_GetResourceBindingDesc, - d3d10_shader_reflection_GetInputParameterDesc, - d3d10_shader_reflection_GetOutputParameterDesc, -}; - 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) diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 8f71bd9ce8..dc91472a37 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -24,6 +24,7 @@
#include "d3dcompiler_private.h" #include "winternl.h" +#include "d3d10.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler);
@@ -97,6 +98,7 @@ struct d3dcompiler_shader_reflection_constant_buffer struct d3dcompiler_shader_reflection { ID3D11ShaderReflection ID3D11ShaderReflection_iface; + ID3D10ShaderReflection ID3D10ShaderReflection_iface; LONG refcount;
DWORD target; @@ -302,6 +304,122 @@ static void reflection_cleanup(struct d3dcompiler_shader_reflection *ref) HeapFree(GetProcessHeap(), 0, ref->creator); }
+/* + * D3D10 Reflect methods. + */ +#ifndef D3D_COMPILER_VERSION +/* IUnknown methods */ +static inline struct d3dcompiler_shader_reflection *impl_from_ID3D10ShaderReflection(ID3D10ShaderReflection *iface) +{ + return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection, ID3D10ShaderReflection_iface); +} + +static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_QueryInterface(ID3D10ShaderReflection *iface, REFIID riid, void **object) +{ + TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); + + if (IsEqualGUID(riid, &IID_ID3D10ShaderReflection) + || IsEqualGUID(riid, &IID_IUnknown)) + { + IUnknown_AddRef(iface); + *object = iface; + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); + + *object = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE d3d10_shader_reflection_AddRef(ID3D10ShaderReflection *iface) +{ + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D10ShaderReflection(iface); + ULONG refcount = InterlockedIncrement(&reflection->refcount); + + TRACE("%p increasing refcount to %u.\n", reflection, refcount); + + return refcount; +} + +static ULONG STDMETHODCALLTYPE d3d10_shader_reflection_Release(ID3D10ShaderReflection *iface) +{ + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D10ShaderReflection(iface); + ULONG refcount = InterlockedDecrement(&reflection->refcount); + + TRACE("%p decreasing refcount to %u.\n", reflection, refcount); + + if (!refcount) + heap_free(reflection); + + return refcount; +} + +/* ID3D10ShaderReflection methods */ + +static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetDesc(ID3D10ShaderReflection *iface, D3D10_SHADER_DESC *desc) +{ + FIXME("iface %p, desc %p stub!\n", iface, desc); + + return E_NOTIMPL; +} + +static struct ID3D10ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d10_shader_reflection_GetConstantBufferByIndex( + ID3D10ShaderReflection *iface, UINT index) +{ + FIXME("iface %p, index %u stub!\n", iface, index); + + return NULL; +} + +static struct ID3D10ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d10_shader_reflection_GetConstantBufferByName( + ID3D10ShaderReflection *iface, const char *name) +{ + FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name)); + + return NULL; +} + +static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetResourceBindingDesc( + ID3D10ShaderReflection *iface, UINT index, D3D10_SHADER_INPUT_BIND_DESC *desc) +{ + FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc); + + return E_NOTIMPL; +} + +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); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetOutputParameterDesc( + ID3D10ShaderReflection *iface, UINT index, D3D10_SIGNATURE_PARAMETER_DESC *desc) +{ + FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc); + + return E_NOTIMPL; +} + +const struct ID3D10ShaderReflectionVtbl d3d10_shader_reflection_vtbl = +{ + /* IUnknown methods */ + d3d10_shader_reflection_QueryInterface, + d3d10_shader_reflection_AddRef, + d3d10_shader_reflection_Release, + /* ID3D10ShaderReflection methods */ + d3d10_shader_reflection_GetDesc, + d3d10_shader_reflection_GetConstantBufferByIndex, + d3d10_shader_reflection_GetConstantBufferByName, + d3d10_shader_reflection_GetResourceBindingDesc, + d3d10_shader_reflection_GetInputParameterDesc, + d3d10_shader_reflection_GetOutputParameterDesc, +}; +#endif + /* IUnknown methods */
static inline struct d3dcompiler_shader_reflection *impl_from_ID3D11ShaderReflection(ID3D11ShaderReflection *iface) @@ -1810,6 +1928,30 @@ err_out: return hr; }
+#ifndef D3D_COMPILER_VERSION +HRESULT WINAPI D3D10ReflectShader(const void *data, SIZE_T data_size, ID3D10ShaderReflection **reflector) +{ + struct d3dcompiler_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; +} +#endif + HRESULT WINAPI D3DReflect(const void *data, SIZE_T data_size, REFIID riid, void **reflector) { struct d3dcompiler_shader_reflection *object;