Rico Schüller : d3dcompiler: Use an iface instead of a vtbl pointer in d3dcompiler_shader_reflection.

Alexandre Julliard julliard at winehq.org
Tue Dec 21 14:32:19 CST 2010


Module: wine
Branch: master
Commit: 8f08d38520b0f35eb29037a94df9764298a780fd
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8f08d38520b0f35eb29037a94df9764298a780fd

Author: Rico Schüller <kgbricola at web.de>
Date:   Tue Dec 21 11:05:58 2010 +0100

d3dcompiler: Use an iface instead of a vtbl pointer in d3dcompiler_shader_reflection.

---

 dlls/d3dcompiler_43/d3dcompiler_private.h |    2 +-
 dlls/d3dcompiler_43/reflection.c          |   11 ++++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/dlls/d3dcompiler_43/d3dcompiler_private.h b/dlls/d3dcompiler_43/d3dcompiler_private.h
index 1cbe561..feb2edd 100644
--- a/dlls/d3dcompiler_43/d3dcompiler_private.h
+++ b/dlls/d3dcompiler_43/d3dcompiler_private.h
@@ -60,7 +60,7 @@ HRESULT d3dcompiler_strip_shader(const void *data, SIZE_T data_size, UINT flags,
 /* ID3D11ShaderReflection */
 struct d3dcompiler_shader_reflection
 {
-    const struct ID3D11ShaderReflectionVtbl *vtbl;
+    ID3D11ShaderReflection ID3D11ShaderReflection_iface;
     LONG refcount;
 };
 
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c
index e733a8f..2a64b93 100644
--- a/dlls/d3dcompiler_43/reflection.c
+++ b/dlls/d3dcompiler_43/reflection.c
@@ -25,6 +25,11 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler);
 
+static inline struct d3dcompiler_shader_reflection *impl_from_ID3D11ShaderReflection(ID3D11ShaderReflection *iface)
+{
+    return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection, ID3D11ShaderReflection_iface);
+}
+
 /* IUnknown methods */
 
 static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_QueryInterface(ID3D11ShaderReflection *iface, REFIID riid, void **object)
@@ -47,7 +52,7 @@ static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_QueryInterface(ID
 
 static ULONG STDMETHODCALLTYPE d3dcompiler_shader_reflection_AddRef(ID3D11ShaderReflection *iface)
 {
-    struct d3dcompiler_shader_reflection *This = (struct d3dcompiler_shader_reflection *)iface;
+    struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface);
     ULONG refcount = InterlockedIncrement(&This->refcount);
 
     TRACE("%p increasing refcount to %u\n", This, refcount);
@@ -57,7 +62,7 @@ static ULONG STDMETHODCALLTYPE d3dcompiler_shader_reflection_AddRef(ID3D11Shader
 
 static ULONG STDMETHODCALLTYPE d3dcompiler_shader_reflection_Release(ID3D11ShaderReflection *iface)
 {
-    struct d3dcompiler_shader_reflection *This = (struct d3dcompiler_shader_reflection *)iface;
+    struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface);
     ULONG refcount = InterlockedDecrement(&This->refcount);
 
     TRACE("%p decreasing refcount to %u\n", This, refcount);
@@ -249,7 +254,7 @@ HRESULT d3dcompiler_shader_reflection_init(struct d3dcompiler_shader_reflection
     HRESULT hr;
     unsigned int i;
 
-    reflection->vtbl = &d3dcompiler_shader_reflection_vtbl;
+    reflection->ID3D11ShaderReflection_iface.lpVtbl = &d3dcompiler_shader_reflection_vtbl;
     reflection->refcount = 1;
 
     hr = dxbc_parse(data, data_size, &src_dxbc);




More information about the wine-cvs mailing list