[PATCH 1/3] d3dx9_36: Implement stubbed ID3DXConstantTable interface

Christian Costa titan.costa at wanadoo.fr
Mon Mar 1 02:39:18 CST 2010


---

 dlls/d3dx9_36/shader.c |  325 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 323 insertions(+), 2 deletions(-)
-------------- next part --------------
diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c
index d8f7325..1106594 100644
--- a/dlls/d3dx9_36/shader.c
+++ b/dlls/d3dx9_36/shader.c
@@ -23,6 +23,7 @@
 #include "windef.h"
 #include "wingdi.h"
 #include "d3dx9.h"
+#include "d3dx9shader.h"
 #include "d3dx9_36_private.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
@@ -238,16 +239,336 @@ HRESULT WINAPI D3DXCompileShader(LPCSTR pSrcData,
     return D3DERR_INVALIDCALL;
 }
 
+static const struct ID3DXConstantTableVtbl ID3DXConstantTable_Vtbl;
+
+typedef struct ID3DXConstantTableImpl {
+    const ID3DXConstantTableVtbl *lpVtbl;
+    LONG ref;
+} ID3DXConstantTableImpl;
+
+/*** IUnknown methods ***/
+static HRESULT WINAPI ID3DXConstantTableImpl_QueryInterface(ID3DXConstantTable* iface, REFIID riid, void** ppvObject)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppvObject);
+
+    if (IsEqualGUID(riid, &IID_IUnknown) ||
+        IsEqualGUID(riid, &IID_ID3DXConstantTable))
+    {
+        ID3DXConstantTable_AddRef(iface);
+        *ppvObject = This;
+        return S_OK;
+    }
+
+    ERR("Interface %s not found\n", debugstr_guid(riid));
+
+    return E_NOINTERFACE;
+}
+
+static ULONG WINAPI ID3DXConstantTableImpl_AddRef(ID3DXConstantTable* iface)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    TRACE("(%p)->(): AddRef from %d\n", This, This->ref);
+
+    return InterlockedIncrement(&This->ref);
+}
+
+static ULONG WINAPI ID3DXConstantTableImpl_Release(ID3DXConstantTable* iface)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+    ULONG ref = InterlockedDecrement(&This->ref);
+
+    TRACE("(%p)->(): Release from %d\n", This, ref + 1);
+
+    if (!ref)
+        HeapFree(GetProcessHeap(), 0, This);
+
+    return ref;
+}
+
+/*** ID3DXBuffer methods ***/
+static LPVOID WINAPI ID3DXConstantTableImpl_GetBufferPointer(ID3DXConstantTable* iface)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    FIXME("(%p)->(): stub\n", This);
+
+    return NULL;
+}
+
+static DWORD WINAPI ID3DXConstantTableImpl_GetBufferSize(ID3DXConstantTable* iface)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    FIXME("(%p)->(): stub\n", This);
+
+    return 0;
+}
+
+/*** ID3DXConstantTable methods ***/
+static HRESULT WINAPI ID3DXConstantTableImpl_GetDesc(ID3DXConstantTable* iface, D3DXCONSTANTTABLE_DESC *desc)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    FIXME("(%p)->(%p): stub\n", This, desc);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ID3DXConstantTableImpl_GetConstantDesc(ID3DXConstantTable* iface, D3DXHANDLE constant,
+                                                             D3DXCONSTANT_DESC *desc, UINT *count)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    FIXME("(%p)->(%p, %p, %p): stub\n", This, constant, desc, count);
+
+    return E_NOTIMPL;
+}
+
+static D3DXHANDLE WINAPI ID3DXConstantTableImpl_GetConstant(ID3DXConstantTable* iface, D3DXHANDLE constant, UINT index)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    FIXME("(%p)->(%p, %d): stub\n", This, constant, index);
+
+    return NULL;
+}
+
+static D3DXHANDLE WINAPI ID3DXConstantTableImpl_GetConstantByName(ID3DXConstantTable* iface, D3DXHANDLE constant, LPCSTR name)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    FIXME("(%p)->(%p, %s): stub\n", This, constant, name);
+
+    return NULL;
+}
+
+static D3DXHANDLE WINAPI ID3DXConstantTableImpl_GetConstantByElement(ID3DXConstantTable* iface, D3DXHANDLE constant, UINT index)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    FIXME("(%p)->(%p, %d): stub\n", This, constant, index);
+
+    return NULL;
+}
+
+static HRESULT WINAPI ID3DXConstantTableImpl_SetDefaults(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    FIXME("(%p)->(%p): stub\n", This, device);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ID3DXConstantTableImpl_SetValue(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
+                                                      D3DXHANDLE constant, LPCVOID data, UINT bytes)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    FIXME("(%p)->(%p, %p, %p, %d): stub\n", This, device, constant, data, bytes);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ID3DXConstantTableImpl_SetBool(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
+                                                     D3DXHANDLE constant, BOOL b)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    FIXME("(%p)->(%p, %p, %d): stub\n", This, device, constant, b);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ID3DXConstantTableImpl_SetBoolArray(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
+                                                          D3DXHANDLE constant, CONST BOOL* b, UINT count)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    FIXME("(%p)->(%p, %p, %p, %d): stub\n", This, device, constant, b, count);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ID3DXConstantTableImpl_SetInt(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device, D3DXHANDLE constant, INT n)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    FIXME("(%p)->(%p, %p, %d): stub\n", This, device, constant, n);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ID3DXConstantTableImpl_SetIntArray(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
+                                                         D3DXHANDLE constant, CONST INT* n, UINT count)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    FIXME("(%p)->(%p, %p, %p, %d): stub\n", This, device, constant, n, count);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ID3DXConstantTableImpl_SetFloat(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
+                                                      D3DXHANDLE constant, FLOAT f)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    FIXME("(%p)->(%p, %p, %f): stub\n", This, device, constant, f);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ID3DXConstantTableImpl_SetFloatArray(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
+                                                           D3DXHANDLE constant, CONST FLOAT* f, UINT count)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    FIXME("(%p)->(%p, %p, %p, %d): stub\n", This, device, constant, f, count);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ID3DXConstantTableImpl_SetVector(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
+                                                       D3DXHANDLE constant, CONST D3DXVECTOR4* vector)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    FIXME("(%p)->(%p, %p, %p): stub\n", This, device, constant, vector);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ID3DXConstantTableImpl_SetVectorArray(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
+                                                            D3DXHANDLE constant, CONST D3DXVECTOR4* vector, UINT count)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    FIXME("(%p)->(%p, %p, %p, %d): stub\n", This, device, constant, vector, count);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrix(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
+                                                       D3DXHANDLE constant, CONST D3DXMATRIX* matrix)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    FIXME("(%p)->(%p, %p, %p): stub\n", This, device, constant, matrix);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixArray(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
+                                                            D3DXHANDLE constant, CONST D3DXMATRIX* matrix, UINT count)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    FIXME("(%p)->(%p, %p, %p, %d): stub\n", This, device, constant, matrix, count);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixPointerArray(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
+                                                                   D3DXHANDLE constant, CONST D3DXMATRIX** matrix, UINT count)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    FIXME("(%p)->(%p, %p, %p, %d): stub\n", This, device, constant, matrix, count);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixTranspose(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
+                                                                D3DXHANDLE constant, CONST D3DXMATRIX* matrix)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    FIXME("(%p)->(%p, %p, %p): stub\n", This, device, constant, matrix);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixTransposeArray(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
+                                                                     D3DXHANDLE constant, CONST D3DXMATRIX* matrix, UINT count)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    FIXME("(%p)->(%p, %p, %p, %d): stub\n", This, device, constant, matrix, count);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixTransposePointerArray(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
+                                                                            D3DXHANDLE constant, CONST D3DXMATRIX** matrix, UINT count)
+{
+    ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+
+    FIXME("(%p)->(%p, %p, %p, %d): stub\n", This, device, constant, matrix, count);
+
+    return E_NOTIMPL;
+}
+
+static const struct ID3DXConstantTableVtbl ID3DXConstantTable_Vtbl =
+{
+    /*** IUnknown methods ***/
+    ID3DXConstantTableImpl_QueryInterface,
+    ID3DXConstantTableImpl_AddRef,
+    ID3DXConstantTableImpl_Release,
+    /*** ID3DXBuffer methods ***/
+    ID3DXConstantTableImpl_GetBufferPointer,
+    ID3DXConstantTableImpl_GetBufferSize,
+    /*** ID3DXConstantTable methods ***/
+    ID3DXConstantTableImpl_GetDesc,
+    ID3DXConstantTableImpl_GetConstantDesc,
+    ID3DXConstantTableImpl_GetConstant,
+    ID3DXConstantTableImpl_GetConstantByName,
+    ID3DXConstantTableImpl_GetConstantByElement,
+    ID3DXConstantTableImpl_SetDefaults,
+    ID3DXConstantTableImpl_SetValue,
+    ID3DXConstantTableImpl_SetBool,
+    ID3DXConstantTableImpl_SetBoolArray,
+    ID3DXConstantTableImpl_SetInt,
+    ID3DXConstantTableImpl_SetIntArray,
+    ID3DXConstantTableImpl_SetFloat,
+    ID3DXConstantTableImpl_SetFloatArray,
+    ID3DXConstantTableImpl_SetVector,
+    ID3DXConstantTableImpl_SetVectorArray,
+    ID3DXConstantTableImpl_SetMatrix,
+    ID3DXConstantTableImpl_SetMatrixArray,
+    ID3DXConstantTableImpl_SetMatrixPointerArray,
+    ID3DXConstantTableImpl_SetMatrixTranspose,
+    ID3DXConstantTableImpl_SetMatrixTransposeArray,
+    ID3DXConstantTableImpl_SetMatrixTransposePointerArray
+};
+
 HRESULT WINAPI D3DXGetShaderConstantTableEx(CONST DWORD* pFunction,
                                             DWORD flags,
                                             LPD3DXCONSTANTTABLE* ppConstantTable)
 {
-    FIXME("(%p, %x, %p): stub\n", pFunction, flags, ppConstantTable);
+    ID3DXConstantTableImpl* object;
+
+    FIXME("(%p, %x, %p): semi-stub\n", pFunction, flags, ppConstantTable);
 
     if (!pFunction || !ppConstantTable)
         return D3DERR_INVALIDCALL;
 
-    return D3DXERR_INVALIDDATA;
+    object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ID3DXConstantTableImpl));
+    if (!object)
+    {
+        ERR("Out of memory\n");
+        return E_OUTOFMEMORY;
+    }
+
+    object->lpVtbl = &ID3DXConstantTable_Vtbl;
+    object->ref = 1;
+
+    *ppConstantTable = (LPD3DXCONSTANTTABLE)object;
+
+    return D3D_OK;
 }
 
 HRESULT WINAPI D3DXGetShaderConstantTable(CONST DWORD* pFunction,


More information about the wine-patches mailing list