d3dx9_36: Use an iface instead of an vtbl pointer in ID3DXConstantTableImpl.

This commit is contained in:
Michael Stefaniuc 2010-12-21 11:30:28 +01:00 committed by Alexandre Julliard
parent f8e4771be4
commit 303f84c409
1 changed files with 35 additions and 30 deletions

View File

@ -617,7 +617,7 @@ typedef struct ctab_constant {
static const struct ID3DXConstantTableVtbl ID3DXConstantTable_Vtbl;
typedef struct ID3DXConstantTableImpl {
const ID3DXConstantTableVtbl *lpVtbl;
ID3DXConstantTable ID3DXConstantTable_iface;
LONG ref;
char *ctab;
DWORD size;
@ -625,10 +625,15 @@ typedef struct ID3DXConstantTableImpl {
ctab_constant *constants;
} ID3DXConstantTableImpl;
static inline ID3DXConstantTableImpl *impl_from_ID3DXConstantTable(ID3DXConstantTable *iface)
{
return CONTAINING_RECORD(iface, ID3DXConstantTableImpl, ID3DXConstantTable_iface);
}
/*** IUnknown methods ***/
static HRESULT WINAPI ID3DXConstantTableImpl_QueryInterface(ID3DXConstantTable* iface, REFIID riid, void** ppvObject)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppvObject);
@ -648,7 +653,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_QueryInterface(ID3DXConstantTable*
static ULONG WINAPI ID3DXConstantTableImpl_AddRef(ID3DXConstantTable* iface)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
TRACE("(%p)->(): AddRef from %d\n", This, This->ref);
@ -657,7 +662,7 @@ static ULONG WINAPI ID3DXConstantTableImpl_AddRef(ID3DXConstantTable* iface)
static ULONG WINAPI ID3DXConstantTableImpl_Release(ID3DXConstantTable* iface)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(): Release from %d\n", This, ref + 1);
@ -675,7 +680,7 @@ static ULONG WINAPI ID3DXConstantTableImpl_Release(ID3DXConstantTable* iface)
/*** ID3DXBuffer methods ***/
static LPVOID WINAPI ID3DXConstantTableImpl_GetBufferPointer(ID3DXConstantTable* iface)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
TRACE("(%p)->()\n", This);
@ -684,7 +689,7 @@ static LPVOID WINAPI ID3DXConstantTableImpl_GetBufferPointer(ID3DXConstantTable*
static DWORD WINAPI ID3DXConstantTableImpl_GetBufferSize(ID3DXConstantTable* iface)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
TRACE("(%p)->()\n", This);
@ -694,7 +699,7 @@ static DWORD WINAPI ID3DXConstantTableImpl_GetBufferSize(ID3DXConstantTable* ifa
/*** ID3DXConstantTable methods ***/
static HRESULT WINAPI ID3DXConstantTableImpl_GetDesc(ID3DXConstantTable* iface, D3DXCONSTANTTABLE_DESC *desc)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
TRACE("(%p)->(%p)\n", This, desc);
@ -709,7 +714,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_GetDesc(ID3DXConstantTable* iface,
static HRESULT WINAPI ID3DXConstantTableImpl_GetConstantDesc(ID3DXConstantTable* iface, D3DXHANDLE constant,
D3DXCONSTANT_DESC *desc, UINT *count)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
ctab_constant *constant_info;
TRACE("(%p)->(%p, %p, %p)\n", This, constant, desc, count);
@ -739,7 +744,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_GetConstantDesc(ID3DXConstantTable*
static UINT WINAPI ID3DXConstantTableImpl_GetSamplerIndex(LPD3DXCONSTANTTABLE iface, D3DXHANDLE constant)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
FIXME("(%p)->(%p): stub\n", This, constant);
@ -748,7 +753,7 @@ static UINT WINAPI ID3DXConstantTableImpl_GetSamplerIndex(LPD3DXCONSTANTTABLE if
static D3DXHANDLE WINAPI ID3DXConstantTableImpl_GetConstant(ID3DXConstantTable* iface, D3DXHANDLE constant, UINT index)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
TRACE("(%p)->(%p, %d)\n", This, constant, index);
@ -766,7 +771,7 @@ static D3DXHANDLE WINAPI ID3DXConstantTableImpl_GetConstant(ID3DXConstantTable*
static D3DXHANDLE WINAPI ID3DXConstantTableImpl_GetConstantByName(ID3DXConstantTable* iface, D3DXHANDLE constant, LPCSTR name)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
UINT i;
TRACE("(%p)->(%p, %s)\n", This, constant, name);
@ -789,7 +794,7 @@ static D3DXHANDLE WINAPI ID3DXConstantTableImpl_GetConstantByName(ID3DXConstantT
static D3DXHANDLE WINAPI ID3DXConstantTableImpl_GetConstantElement(ID3DXConstantTable* iface, D3DXHANDLE constant, UINT index)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
FIXME("(%p)->(%p, %d): stub\n", This, constant, index);
@ -798,7 +803,7 @@ static D3DXHANDLE WINAPI ID3DXConstantTableImpl_GetConstantElement(ID3DXConstant
static HRESULT WINAPI ID3DXConstantTableImpl_SetDefaults(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
FIXME("(%p)->(%p): stub\n", This, device);
@ -808,7 +813,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetDefaults(ID3DXConstantTable* ifa
static HRESULT WINAPI ID3DXConstantTableImpl_SetValue(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
D3DXHANDLE constant, LPCVOID data, UINT bytes)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
FIXME("(%p)->(%p, %p, %p, %d): stub\n", This, device, constant, data, bytes);
@ -818,7 +823,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetValue(ID3DXConstantTable* iface,
static HRESULT WINAPI ID3DXConstantTableImpl_SetBool(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
D3DXHANDLE constant, BOOL b)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
FIXME("(%p)->(%p, %p, %d): stub\n", This, device, constant, b);
@ -828,7 +833,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetBool(ID3DXConstantTable* iface,
static HRESULT WINAPI ID3DXConstantTableImpl_SetBoolArray(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
D3DXHANDLE constant, CONST BOOL* b, UINT count)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
FIXME("(%p)->(%p, %p, %p, %d): stub\n", This, device, constant, b, count);
@ -837,7 +842,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetBoolArray(ID3DXConstantTable* if
static HRESULT WINAPI ID3DXConstantTableImpl_SetInt(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device, D3DXHANDLE constant, INT n)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
FIXME("(%p)->(%p, %p, %d): stub\n", This, device, constant, n);
@ -847,7 +852,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetInt(ID3DXConstantTable* iface, L
static HRESULT WINAPI ID3DXConstantTableImpl_SetIntArray(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
D3DXHANDLE constant, CONST INT* n, UINT count)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
FIXME("(%p)->(%p, %p, %p, %d): stub\n", This, device, constant, n, count);
@ -857,7 +862,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetIntArray(ID3DXConstantTable* ifa
static HRESULT WINAPI ID3DXConstantTableImpl_SetFloat(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
D3DXHANDLE constant, FLOAT f)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
FIXME("(%p)->(%p, %p, %f): stub\n", This, device, constant, f);
@ -867,7 +872,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetFloat(ID3DXConstantTable* iface,
static HRESULT WINAPI ID3DXConstantTableImpl_SetFloatArray(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
D3DXHANDLE constant, CONST FLOAT* f, UINT count)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
FIXME("(%p)->(%p, %p, %p, %d): stub\n", This, device, constant, f, count);
@ -877,7 +882,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetFloatArray(ID3DXConstantTable* i
static HRESULT WINAPI ID3DXConstantTableImpl_SetVector(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
D3DXHANDLE constant, CONST D3DXVECTOR4* vector)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
FIXME("(%p)->(%p, %p, %p): stub\n", This, device, constant, vector);
@ -887,7 +892,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetVector(ID3DXConstantTable* iface
static HRESULT WINAPI ID3DXConstantTableImpl_SetVectorArray(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
D3DXHANDLE constant, CONST D3DXVECTOR4* vector, UINT count)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
FIXME("(%p)->(%p, %p, %p, %d): stub\n", This, device, constant, vector, count);
@ -897,7 +902,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetVectorArray(ID3DXConstantTable*
static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrix(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
D3DXHANDLE constant, CONST D3DXMATRIX* matrix)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
FIXME("(%p)->(%p, %p, %p): stub\n", This, device, constant, matrix);
@ -907,7 +912,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrix(ID3DXConstantTable* iface
static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixArray(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
D3DXHANDLE constant, CONST D3DXMATRIX* matrix, UINT count)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
FIXME("(%p)->(%p, %p, %p, %d): stub\n", This, device, constant, matrix, count);
@ -917,7 +922,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixArray(ID3DXConstantTable*
static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixPointerArray(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
D3DXHANDLE constant, CONST D3DXMATRIX** matrix, UINT count)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
FIXME("(%p)->(%p, %p, %p, %d): stub\n", This, device, constant, matrix, count);
@ -927,7 +932,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixPointerArray(ID3DXConstant
static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixTranspose(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
D3DXHANDLE constant, CONST D3DXMATRIX* matrix)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
FIXME("(%p)->(%p, %p, %p): stub\n", This, device, constant, matrix);
@ -937,7 +942,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixTranspose(ID3DXConstantTab
static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixTransposeArray(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
D3DXHANDLE constant, CONST D3DXMATRIX* matrix, UINT count)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
FIXME("(%p)->(%p, %p, %p, %d): stub\n", This, device, constant, matrix, count);
@ -947,7 +952,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixTransposeArray(ID3DXConsta
static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixTransposePointerArray(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
D3DXHANDLE constant, CONST D3DXMATRIX** matrix, UINT count)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
FIXME("(%p)->(%p, %p, %p, %d): stub\n", This, device, constant, matrix, count);
@ -1038,7 +1043,7 @@ HRESULT WINAPI D3DXGetShaderConstantTableEx(CONST DWORD* byte_code,
return E_OUTOFMEMORY;
}
object->lpVtbl = &ID3DXConstantTable_Vtbl;
object->ID3DXConstantTable_iface.lpVtbl = &ID3DXConstantTable_Vtbl;
object->ref = 1;
if (size < sizeof(D3DXSHADER_CONSTANTTABLE))
@ -1116,7 +1121,7 @@ HRESULT WINAPI D3DXGetShaderConstantTableEx(CONST DWORD* byte_code,
object->constants[i].desc.Columns;
}
*constant_table = (LPD3DXCONSTANTTABLE)object;
*constant_table = &object->ID3DXConstantTable_iface;
return D3D_OK;