[PATCH 2/3] d3dcompiler: unify d3d11 + d3d10 reflection ifaces

Connor McAdams conmanx360 at gmail.com
Thu Oct 24 13:59:28 CDT 2019


Use ifdefs to change the type of the reflection iface, and change the
name of the variable throughout.
---
 dlls/d3dcompiler_43/reflection.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c
index ce634ac95a..5faea4c8e6 100644
--- a/dlls/d3dcompiler_43/reflection.c
+++ b/dlls/d3dcompiler_43/reflection.c
@@ -22,6 +22,7 @@
 #endif
 #include "d3dcompiler_private.h"
 #include "winternl.h"
+#include "d3d10.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler);
 
@@ -94,7 +95,11 @@ struct d3dcompiler_shader_reflection_constant_buffer
 /* ID3D11ShaderReflection */
 struct d3dcompiler_shader_reflection
 {
-    ID3D11ShaderReflection ID3D11ShaderReflection_iface;
+#ifdef D3D10REFLECT
+    ID3D10ShaderReflection ID3DShaderReflection_iface;
+#else
+    ID3D11ShaderReflection ID3DShaderReflection_iface;
+#endif
     LONG refcount;
 
     DWORD target;
@@ -304,7 +309,7 @@ static void reflection_cleanup(struct d3dcompiler_shader_reflection *ref)
 
 static inline struct d3dcompiler_shader_reflection *impl_from_ID3D11ShaderReflection(ID3D11ShaderReflection *iface)
 {
-    return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection, ID3D11ShaderReflection_iface);
+    return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection, ID3DShaderReflection_iface);
 }
 
 static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_QueryInterface(ID3D11ShaderReflection *iface, REFIID riid, void **object)
@@ -702,7 +707,6 @@ static const struct ID3D11ShaderReflectionVtbl d3dcompiler_shader_reflection_vtb
     d3dcompiler_shader_reflection_GetThreadGroupSize,
     d3dcompiler_shader_reflection_GetRequiresFlags,
 };
-
 /* ID3D11ShaderReflectionConstantBuffer methods */
 
 static inline struct d3dcompiler_shader_reflection_constant_buffer *impl_from_ID3D11ShaderReflectionConstantBuffer(ID3D11ShaderReflectionConstantBuffer *iface)
@@ -1693,9 +1697,6 @@ static HRESULT d3dcompiler_shader_reflection_init(struct d3dcompiler_shader_refl
     HRESULT hr;
     unsigned int i;
 
-    reflection->ID3D11ShaderReflection_iface.lpVtbl = &d3dcompiler_shader_reflection_vtbl;
-    reflection->refcount = 1;
-
     wine_rb_init(&reflection->types, d3dcompiler_shader_reflection_type_compare);
 
     hr = dxbc_parse(data, data_size, &src_dxbc);
@@ -1838,6 +1839,11 @@ HRESULT WINAPI D3DReflect(const void *data, SIZE_T data_size, REFIID riid, void
     if (!object)
         return E_OUTOFMEMORY;
 
+#ifndef D3D10REFLECT
+    object->ID3DShaderReflection_iface.lpVtbl = &d3dcompiler_shader_reflection_vtbl;
+    object->refcount = 1;
+#endif
+
     hr = d3dcompiler_shader_reflection_init(object, data, data_size);
     if (FAILED(hr))
     {
-- 
2.20.1




More information about the wine-devel mailing list