Commit 73e8baff authored by Jason Edmeades's avatar Jason Edmeades Committed by Alexandre Julliard

Add indexbuffer support into wined3d.

parent aa758eaf
...@@ -639,7 +639,6 @@ struct IDirect3DVertexBuffer9Impl ...@@ -639,7 +639,6 @@ struct IDirect3DVertexBuffer9Impl
/* IDirect3DResource9 fields */ /* IDirect3DResource9 fields */
IWineD3DVertexBuffer *wineD3DVertexBuffer; IWineD3DVertexBuffer *wineD3DVertexBuffer;
IDirect3DDevice9Impl *device;
}; };
/* IUnknown: */ /* IUnknown: */
...@@ -682,12 +681,7 @@ struct IDirect3DIndexBuffer9Impl ...@@ -682,12 +681,7 @@ struct IDirect3DIndexBuffer9Impl
DWORD ref; DWORD ref;
/* IDirect3DResource9 fields */ /* IDirect3DResource9 fields */
IDirect3DDevice9Impl *Device; IWineD3DIndexBuffer *wineD3DIndexBuffer;
D3DRESOURCETYPE ResourceType;
/* IDirect3DIndexBuffer9 fields */
void *allocatedMemory;
D3DINDEXBUFFER_DESC myDesc;
}; };
/* IUnknown: */ /* IUnknown: */
......
/* /*
* IDirect3DIndexBuffer9 implementation * IDirect3DIndexBuffer9 implementation
* *
* Copyright 2002-2003 Jason Edmeades * Copyright 2002-2004 Jason Edmeades
* Raphael Junqueira * Raphael Junqueira
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
...@@ -43,15 +43,15 @@ HRESULT WINAPI IDirect3DIndexBuffer9Impl_QueryInterface(LPDIRECT3DINDEXBUFFER9 i ...@@ -43,15 +43,15 @@ HRESULT WINAPI IDirect3DIndexBuffer9Impl_QueryInterface(LPDIRECT3DINDEXBUFFER9 i
ULONG WINAPI IDirect3DIndexBuffer9Impl_AddRef(LPDIRECT3DINDEXBUFFER9 iface) { ULONG WINAPI IDirect3DIndexBuffer9Impl_AddRef(LPDIRECT3DINDEXBUFFER9 iface) {
IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface; IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface;
TRACE("(%p) : AddRef from %ld\n", This, This->ref); TRACE("(%p) : AddRef from %ld\n", This, This->ref);
return ++(This->ref); return InterlockedIncrement(&This->ref);
} }
ULONG WINAPI IDirect3DIndexBuffer9Impl_Release(LPDIRECT3DINDEXBUFFER9 iface) { ULONG WINAPI IDirect3DIndexBuffer9Impl_Release(LPDIRECT3DINDEXBUFFER9 iface) {
IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface; IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface;
ULONG ref = --This->ref; ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) { if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This->allocatedMemory); IWineD3DIndexBuffer_Release(This->wineD3DIndexBuffer);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }
return ref; return ref;
...@@ -65,61 +65,54 @@ HRESULT WINAPI IDirect3DIndexBuffer9Impl_GetDevice(LPDIRECT3DINDEXBUFFER9 iface, ...@@ -65,61 +65,54 @@ HRESULT WINAPI IDirect3DIndexBuffer9Impl_GetDevice(LPDIRECT3DINDEXBUFFER9 iface,
HRESULT WINAPI IDirect3DIndexBuffer9Impl_SetPrivateData(LPDIRECT3DINDEXBUFFER9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { HRESULT WINAPI IDirect3DIndexBuffer9Impl_SetPrivateData(LPDIRECT3DINDEXBUFFER9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface; IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface;
FIXME("(%p) : stub\n", This); return IWineD3DIndexBuffer_SetPrivateData(This->wineD3DIndexBuffer, refguid, pData, SizeOfData, Flags);
return D3D_OK;
} }
HRESULT WINAPI IDirect3DIndexBuffer9Impl_GetPrivateData(LPDIRECT3DINDEXBUFFER9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { HRESULT WINAPI IDirect3DIndexBuffer9Impl_GetPrivateData(LPDIRECT3DINDEXBUFFER9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface; IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface;
FIXME("(%p) : stub\n", This); return IWineD3DIndexBuffer_GetPrivateData(This->wineD3DIndexBuffer, refguid, pData, pSizeOfData);
return D3D_OK;
} }
HRESULT WINAPI IDirect3DIndexBuffer9Impl_FreePrivateData(LPDIRECT3DINDEXBUFFER9 iface, REFGUID refguid) { HRESULT WINAPI IDirect3DIndexBuffer9Impl_FreePrivateData(LPDIRECT3DINDEXBUFFER9 iface, REFGUID refguid) {
IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface; IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface;
FIXME("(%p) : stub\n", This); return IWineD3DIndexBuffer_FreePrivateData(This->wineD3DIndexBuffer, refguid);
return D3D_OK;
} }
DWORD WINAPI IDirect3DIndexBuffer9Impl_SetPriority(LPDIRECT3DINDEXBUFFER9 iface, DWORD PriorityNew) { DWORD WINAPI IDirect3DIndexBuffer9Impl_SetPriority(LPDIRECT3DINDEXBUFFER9 iface, DWORD PriorityNew) {
IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface; IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface;
return IDirect3DResource9Impl_SetPriority((LPDIRECT3DRESOURCE9) This, PriorityNew); return IWineD3DIndexBuffer_SetPriority(This->wineD3DIndexBuffer, PriorityNew);
} }
DWORD WINAPI IDirect3DIndexBuffer9Impl_GetPriority(LPDIRECT3DINDEXBUFFER9 iface) { DWORD WINAPI IDirect3DIndexBuffer9Impl_GetPriority(LPDIRECT3DINDEXBUFFER9 iface) {
IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface; IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface;
return IDirect3DResource9Impl_GetPriority((LPDIRECT3DRESOURCE9) This); return IWineD3DIndexBuffer_GetPriority(This->wineD3DIndexBuffer);
} }
void WINAPI IDirect3DIndexBuffer9Impl_PreLoad(LPDIRECT3DINDEXBUFFER9 iface) { void WINAPI IDirect3DIndexBuffer9Impl_PreLoad(LPDIRECT3DINDEXBUFFER9 iface) {
IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface; IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface;
FIXME("(%p) : stub\n", This); IWineD3DIndexBuffer_PreLoad(This->wineD3DIndexBuffer);
return ; return ;
} }
D3DRESOURCETYPE WINAPI IDirect3DIndexBuffer9Impl_GetType(LPDIRECT3DINDEXBUFFER9 iface) { D3DRESOURCETYPE WINAPI IDirect3DIndexBuffer9Impl_GetType(LPDIRECT3DINDEXBUFFER9 iface) {
IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface; IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface;
return IDirect3DResource9Impl_GetType((LPDIRECT3DRESOURCE9) This); return IWineD3DIndexBuffer_GetType(This->wineD3DIndexBuffer);
} }
/* IDirect3DIndexBuffer9 Interface follow: */ /* IDirect3DIndexBuffer9 Interface follow: */
HRESULT WINAPI IDirect3DIndexBuffer9Impl_Lock(LPDIRECT3DINDEXBUFFER9 iface, UINT OffsetToLock, UINT SizeToLock, void** ppbData, DWORD Flags) { HRESULT WINAPI IDirect3DIndexBuffer9Impl_Lock(LPDIRECT3DINDEXBUFFER9 iface, UINT OffsetToLock, UINT SizeToLock, void** ppbData, DWORD Flags) {
IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface; IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface;
FIXME("(%p) : stub\n", This); return IWineD3DIndexBuffer_Lock(This->wineD3DIndexBuffer, OffsetToLock, SizeToLock, (BYTE **)ppbData, Flags);
return D3D_OK;
} }
HRESULT WINAPI IDirect3DIndexBuffer9Impl_Unlock(LPDIRECT3DINDEXBUFFER9 iface) { HRESULT WINAPI IDirect3DIndexBuffer9Impl_Unlock(LPDIRECT3DINDEXBUFFER9 iface) {
IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface; IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface;
FIXME("(%p) : stub\n", This); return IWineD3DIndexBuffer_Unlock(This->wineD3DIndexBuffer);
return D3D_OK;
} }
HRESULT WINAPI IDirect3DIndexBuffer9Impl_GetDesc(LPDIRECT3DINDEXBUFFER9 iface, D3DINDEXBUFFER_DESC *pDesc) { HRESULT WINAPI IDirect3DIndexBuffer9Impl_GetDesc(LPDIRECT3DINDEXBUFFER9 iface, D3DINDEXBUFFER_DESC *pDesc) {
IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface; IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface;
TRACE("(%p) : copying into %p\n", This, pDesc); return IWineD3DIndexBuffer_GetDesc(This->wineD3DIndexBuffer, pDesc);
memcpy(pDesc, &This->myDesc, sizeof(D3DINDEXBUFFER_DESC));
return D3D_OK;
} }
...@@ -146,30 +139,16 @@ IDirect3DIndexBuffer9Vtbl Direct3DIndexBuffer9_Vtbl = ...@@ -146,30 +139,16 @@ IDirect3DIndexBuffer9Vtbl Direct3DIndexBuffer9_Vtbl =
HRESULT WINAPI IDirect3DDevice9Impl_CreateIndexBuffer(LPDIRECT3DDEVICE9 iface, HRESULT WINAPI IDirect3DDevice9Impl_CreateIndexBuffer(LPDIRECT3DDEVICE9 iface,
UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool,
IDirect3DIndexBuffer9** ppIndexBuffer, HANDLE* pSharedHandle) { IDirect3DIndexBuffer9** ppIndexBuffer, HANDLE* pSharedHandle) {
IDirect3DIndexBuffer9Impl *object;
IDirect3DIndexBuffer9Impl *object;
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
/*TRACE("(%p) : Len=%d, Use=%lx, Format=(%u,%s), Pool=%d\n", This, Length, Usage, Format, debug_d3dformat(Format), Pool);*/
/* Allocate the storage for the device */ /* Allocate the storage for the device */
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DIndexBuffer9Impl)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DIndexBuffer9Impl));
object->lpVtbl = &Direct3DIndexBuffer9_Vtbl; object->lpVtbl = &Direct3DIndexBuffer9_Vtbl;
object->ref = 1; object->ref = 1;
object->Device = This; IWineD3DDevice_CreateIndexBuffer(This->WineD3DDevice, Length, Usage, Format, Pool, &(object->wineD3DIndexBuffer), pSharedHandle, (IUnknown *)object);
object->ResourceType = D3DRTYPE_INDEXBUFFER;
object->allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, Length);
object->myDesc.Type = D3DRTYPE_INDEXBUFFER;
object->myDesc.Usage = Usage;
object->myDesc.Pool = Pool;
object->myDesc.Format = Format;
object->myDesc.Size = Length;
TRACE("(%p) : Iface@%p allocatedMem @ %p\n", This, object, object->allocatedMemory);
*ppIndexBuffer = (LPDIRECT3DINDEXBUFFER9) object; *ppIndexBuffer = (LPDIRECT3DINDEXBUFFER9) object;
return D3D_OK; return D3D_OK;
} }
...@@ -146,7 +146,6 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(LPDIRECT3DDEVICE9 iface, ...@@ -146,7 +146,6 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(LPDIRECT3DDEVICE9 iface,
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVertexBuffer9Impl)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVertexBuffer9Impl));
object->lpVtbl = &Direct3DVertexBuffer9_Vtbl; object->lpVtbl = &Direct3DVertexBuffer9_Vtbl;
object->ref = 1; object->ref = 1;
object->device = This;
IWineD3DDevice_CreateVertexBuffer(This->WineD3DDevice, Size, Usage, FVF, Pool, &(object->wineD3DVertexBuffer), pSharedHandle, (IUnknown *)object); IWineD3DDevice_CreateVertexBuffer(This->WineD3DDevice, Size, Usage, FVF, Pool, &(object->wineD3DVertexBuffer), pSharedHandle, (IUnknown *)object);
*ppVertexBuffer = (LPDIRECT3DVERTEXBUFFER9) object; *ppVertexBuffer = (LPDIRECT3DVERTEXBUFFER9) object;
......
...@@ -10,6 +10,7 @@ EXTRALIBS = -ldxguid -luuid @X_LIBS@ @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@ @OPENGL_ ...@@ -10,6 +10,7 @@ EXTRALIBS = -ldxguid -luuid @X_LIBS@ @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@ @OPENGL_
C_SRCS = \ C_SRCS = \
device.c \ device.c \
directx.c \ directx.c \
indexbuffer.c \
resource.c \ resource.c \
stateblock.c \ stateblock.c \
utils.c \ utils.c \
......
...@@ -68,6 +68,33 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *iface, UINT ...@@ -68,6 +68,33 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *iface, UINT
return D3D_OK; return D3D_OK;
} }
HRESULT WINAPI IWineD3DDeviceImpl_CreateIndexBuffer(IWineD3DDevice *iface, UINT Length, DWORD Usage,
D3DFORMAT Format, D3DPOOL Pool, IWineD3DIndexBuffer** ppIndexBuffer,
HANDLE *sharedHandle, IUnknown *parent) {
IWineD3DIndexBufferImpl *object;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
/* Allocate the storage for the device */
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DIndexBufferImpl));
object->lpVtbl = &IWineD3DIndexBuffer_Vtbl;
object->resource.wineD3DDevice = iface;
object->resource.resourceType = D3DRTYPE_INDEXBUFFER;
object->resource.parent = parent;
IWineD3DDevice_AddRef(iface);
object->resource.ref = 1;
object->allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, Length);
object->currentDesc.Usage = Usage;
object->currentDesc.Pool = Pool;
object->currentDesc.Format= Format;
object->currentDesc.Size = Length;
TRACE("(%p) : Len=%d, Use=%lx, Format=(%u,%s), Pool=%d - Memory@%p, Iface@%p\n", This, Length, Usage, Format,
debug_d3dformat(Format), Pool, object, object->allocatedMemory);
*ppIndexBuffer = (IWineD3DIndexBuffer *) object;
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface, D3DSTATEBLOCKTYPE Type, IWineD3DStateBlock** ppStateBlock, IUnknown *parent) { HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface, D3DSTATEBLOCKTYPE Type, IWineD3DStateBlock** ppStateBlock, IUnknown *parent) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
...@@ -200,6 +227,7 @@ IWineD3DDeviceVtbl IWineD3DDevice_Vtbl = ...@@ -200,6 +227,7 @@ IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
IWineD3DDeviceImpl_Release, IWineD3DDeviceImpl_Release,
IWineD3DDeviceImpl_GetParent, IWineD3DDeviceImpl_GetParent,
IWineD3DDeviceImpl_CreateVertexBuffer, IWineD3DDeviceImpl_CreateVertexBuffer,
IWineD3DDeviceImpl_CreateIndexBuffer,
IWineD3DDeviceImpl_CreateStateBlock, IWineD3DDeviceImpl_CreateStateBlock,
IWineD3DDeviceImpl_SetFVF, IWineD3DDeviceImpl_SetFVF,
IWineD3DDeviceImpl_GetFVF, IWineD3DDeviceImpl_GetFVF,
......
/*
* IWineD3DIndexBuffer Implementation
*
* Copyright 2002-2004 Jason Edmeades
* Copyright 2003-2004 Raphael Junqueira
* Copyright 2004 Christian Costa
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
/* *******************************************
IWineD3DIndexBuffer IUnknown parts follow
******************************************* */
HRESULT WINAPI IWineD3DIndexBufferImpl_QueryInterface(IWineD3DIndexBuffer *iface, REFIID riid, LPVOID *ppobj)
{
IWineD3DIndexBufferImpl *This = (IWineD3DIndexBufferImpl *)iface;
WARN("(%p)->(%s,%p) should not be called\n",This,debugstr_guid(riid),ppobj);
return E_NOINTERFACE;
}
ULONG WINAPI IWineD3DIndexBufferImpl_AddRef(IWineD3DIndexBuffer *iface) {
IWineD3DIndexBufferImpl *This = (IWineD3DIndexBufferImpl *)iface;
TRACE("(%p) : AddRef increasing from %ld\n", This, This->resource.ref);
IUnknown_AddRef(This->resource.parent);
return InterlockedIncrement(&This->resource.ref);
}
ULONG WINAPI IWineD3DIndexBufferImpl_Release(IWineD3DIndexBuffer *iface) {
IWineD3DIndexBufferImpl *This = (IWineD3DIndexBufferImpl *)iface;
ULONG ref;
TRACE("(%p) : Releasing from %ld\n", This, This->resource.ref);
ref = InterlockedDecrement(&This->resource.ref);
if (ref == 0) {
if (NULL != This->allocatedMemory) HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
IWineD3DDevice_Release(This->resource.wineD3DDevice);
HeapFree(GetProcessHeap(), 0, This);
} else {
IUnknown_Release(This->resource.parent); /* Released the reference to the d3dx VB */
}
return ref;
}
/* ****************************************************
IWineD3DIndexBuffer IWineD3DResource parts follow
**************************************************** */
HRESULT WINAPI IWineD3DIndexBufferImpl_GetDevice(IWineD3DIndexBuffer *iface, IWineD3DDevice** ppDevice) {
return IWineD3DResource_GetDevice((IWineD3DResource *)iface, ppDevice);
}
HRESULT WINAPI IWineD3DIndexBufferImpl_SetPrivateData(IWineD3DIndexBuffer *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
return IWineD3DResource_SetPrivateData((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags);
}
HRESULT WINAPI IWineD3DIndexBufferImpl_GetPrivateData(IWineD3DIndexBuffer *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
return IWineD3DResource_GetPrivateData((IWineD3DResource *)iface, refguid, pData, pSizeOfData);
}
HRESULT WINAPI IWineD3DIndexBufferImpl_FreePrivateData(IWineD3DIndexBuffer *iface, REFGUID refguid) {
return IWineD3DResource_FreePrivateData((IWineD3DResource *)iface, refguid);
}
DWORD WINAPI IWineD3DIndexBufferImpl_SetPriority(IWineD3DIndexBuffer *iface, DWORD PriorityNew) {
return IWineD3DResource_SetPriority((IWineD3DResource *)iface, PriorityNew);
}
DWORD WINAPI IWineD3DIndexBufferImpl_GetPriority(IWineD3DIndexBuffer *iface) {
return IWineD3DResource_GetPriority((IWineD3DResource *)iface);
}
void WINAPI IWineD3DIndexBufferImpl_PreLoad(IWineD3DIndexBuffer *iface) {
return IWineD3DResource_PreLoad((IWineD3DResource *)iface);
}
D3DRESOURCETYPE WINAPI IWineD3DIndexBufferImpl_GetType(IWineD3DIndexBuffer *iface) {
return IWineD3DResource_GetType((IWineD3DResource *)iface);
}
HRESULT WINAPI IWineD3DIndexBufferImpl_GetParent(IWineD3DIndexBuffer *iface, IUnknown **pParent) {
return IWineD3DResource_GetParent((IWineD3DResource *)iface, pParent);
}
/* ******************************************************
IWineD3DIndexBuffer IWineD3DIndexBuffer parts follow
****************************************************** */
HRESULT WINAPI IWineD3DIndexBufferImpl_Lock(IWineD3DIndexBuffer *iface, UINT OffsetToLock, UINT SizeToLock, BYTE** ppbData, DWORD Flags) {
IWineD3DIndexBufferImpl *This = (IWineD3DIndexBufferImpl *)iface;
TRACE("(%p) : no real locking yet, offset %d, size %d, Flags=%lx\n", This, OffsetToLock, SizeToLock, Flags);
*ppbData = (BYTE *)This->allocatedMemory + OffsetToLock;
return D3D_OK;
}
HRESULT WINAPI IWineD3DIndexBufferImpl_Unlock(IWineD3DIndexBuffer *iface) {
IWineD3DIndexBufferImpl *This = (IWineD3DIndexBufferImpl *)iface;
TRACE("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IWineD3DIndexBufferImpl_GetDesc(IWineD3DIndexBuffer *iface, D3DINDEXBUFFER_DESC *pDesc) {
IWineD3DIndexBufferImpl *This = (IWineD3DIndexBufferImpl *)iface;
TRACE("(%p)\n", This);
pDesc->Format = This->currentDesc.Format;
pDesc->Type = This->resource.resourceType;
pDesc->Usage = This->currentDesc.Usage;
pDesc->Pool = This->currentDesc.Pool;
pDesc->Size = This->currentDesc.Size;
return D3D_OK;
}
IWineD3DIndexBufferVtbl IWineD3DIndexBuffer_Vtbl =
{
IWineD3DIndexBufferImpl_QueryInterface,
IWineD3DIndexBufferImpl_AddRef,
IWineD3DIndexBufferImpl_Release,
IWineD3DIndexBufferImpl_GetParent,
IWineD3DIndexBufferImpl_GetDevice,
IWineD3DIndexBufferImpl_SetPrivateData,
IWineD3DIndexBufferImpl_GetPrivateData,
IWineD3DIndexBufferImpl_FreePrivateData,
IWineD3DIndexBufferImpl_SetPriority,
IWineD3DIndexBufferImpl_GetPriority,
IWineD3DIndexBufferImpl_PreLoad,
IWineD3DIndexBufferImpl_GetType,
IWineD3DIndexBufferImpl_Lock,
IWineD3DIndexBufferImpl_Unlock,
IWineD3DIndexBufferImpl_GetDesc
};
...@@ -116,7 +116,7 @@ HRESULT WINAPI IWineD3DVertexBufferImpl_GetDesc(IWineD3DVertexBuffer *if ...@@ -116,7 +116,7 @@ HRESULT WINAPI IWineD3DVertexBufferImpl_GetDesc(IWineD3DVertexBuffer *if
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
pDesc->Format = This->currentDesc.Format; pDesc->Format = This->currentDesc.Format;
pDesc->Type = This->currentDesc.Type; pDesc->Type = This->resource.resourceType;
pDesc->Usage = This->currentDesc.Usage; pDesc->Usage = This->currentDesc.Usage;
pDesc->Pool = This->currentDesc.Pool; pDesc->Pool = This->currentDesc.Pool;
pDesc->Size = This->currentDesc.Size; pDesc->Size = This->currentDesc.Size;
......
...@@ -196,6 +196,23 @@ typedef struct IWineD3DVertexBufferImpl ...@@ -196,6 +196,23 @@ typedef struct IWineD3DVertexBufferImpl
extern IWineD3DVertexBufferVtbl IWineD3DVertexBuffer_Vtbl; extern IWineD3DVertexBufferVtbl IWineD3DVertexBuffer_Vtbl;
/***************************************************************************** /*****************************************************************************
* IWineD3DIndexBuffer implementation structure (extends IWineD3DResourceImpl)
*/
typedef struct IWineD3DIndexBufferImpl
{
/* IUnknown & WineD3DResource Information */
IWineD3DIndexBufferVtbl *lpVtbl;
IWineD3DResourceClass resource;
/* WineD3DVertexBuffer specifics */
BYTE *allocatedMemory;
D3DINDEXBUFFER_DESC currentDesc;
} IWineD3DIndexBufferImpl;
extern IWineD3DIndexBufferVtbl IWineD3DIndexBuffer_Vtbl;
/*****************************************************************************
* IWineD3DStateBlock implementation structure * IWineD3DStateBlock implementation structure
*/ */
......
...@@ -74,6 +74,7 @@ typedef struct IWineD3D IWineD3D; ...@@ -74,6 +74,7 @@ typedef struct IWineD3D IWineD3D;
typedef struct IWineD3DDevice IWineD3DDevice; typedef struct IWineD3DDevice IWineD3DDevice;
typedef struct IWineD3DResource IWineD3DResource; typedef struct IWineD3DResource IWineD3DResource;
typedef struct IWineD3DVertexBuffer IWineD3DVertexBuffer; typedef struct IWineD3DVertexBuffer IWineD3DVertexBuffer;
typedef struct IWineD3DIndexBuffer IWineD3DIndexBuffer;
typedef struct IWineD3DStateBlock IWineD3DStateBlock; typedef struct IWineD3DStateBlock IWineD3DStateBlock;
/***************************************************************************** /*****************************************************************************
...@@ -145,6 +146,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown) ...@@ -145,6 +146,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
/*** IWineD3D methods ***/ /*** IWineD3D methods ***/
STDMETHOD(GetParent)(THIS_ IUnknown **pParent) PURE; STDMETHOD(GetParent)(THIS_ IUnknown **pParent) PURE;
STDMETHOD(CreateVertexBuffer)(THIS_ UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IWineD3DVertexBuffer **ppVertexBuffer, HANDLE *sharedHandle, IUnknown *parent) PURE; STDMETHOD(CreateVertexBuffer)(THIS_ UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IWineD3DVertexBuffer **ppVertexBuffer, HANDLE *sharedHandle, IUnknown *parent) PURE;
STDMETHOD(CreateIndexBuffer)(THIS_ UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IWineD3DIndexBuffer** ppIndexBuffer, HANDLE* pSharedHandle, IUnknown *parent) PURE;
STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE Type, IWineD3DStateBlock **ppStateBlock, IUnknown *parent) PURE; STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE Type, IWineD3DStateBlock **ppStateBlock, IUnknown *parent) PURE;
STDMETHOD(SetFVF)(THIS_ DWORD fvf) PURE; STDMETHOD(SetFVF)(THIS_ DWORD fvf) PURE;
STDMETHOD(GetFVF)(THIS_ DWORD * pfvf) PURE; STDMETHOD(GetFVF)(THIS_ DWORD * pfvf) PURE;
...@@ -161,6 +163,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown) ...@@ -161,6 +163,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
/*** IWineD3DDevice methods ***/ /*** IWineD3DDevice methods ***/
#define IWineD3DDevice_GetParent(p,a) (p)->lpVtbl->GetParent(p,a) #define IWineD3DDevice_GetParent(p,a) (p)->lpVtbl->GetParent(p,a)
#define IWineD3DDevice_CreateVertexBuffer(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d,e,f,g) #define IWineD3DDevice_CreateVertexBuffer(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d,e,f,g)
#define IWineD3DDevice_CreateIndexBuffer(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateIndexBuffer(p,a,b,c,d,e,f,g)
#define IWineD3DDevice_CreateStateBlock(p,a,b,c) (p)->lpVtbl->CreateStateBlock(p,a,b,c) #define IWineD3DDevice_CreateStateBlock(p,a,b,c) (p)->lpVtbl->CreateStateBlock(p,a,b,c)
#define IWineD3DDevice_SetFVF(p,a) (p)->lpVtbl->SetFVF(p,a) #define IWineD3DDevice_SetFVF(p,a) (p)->lpVtbl->SetFVF(p,a)
#define IWineD3DDevice_GetFVF(p,a) (p)->lpVtbl->GetFVF(p,a) #define IWineD3DDevice_GetFVF(p,a) (p)->lpVtbl->GetFVF(p,a)
...@@ -257,6 +260,54 @@ DECLARE_INTERFACE_(IWineD3DVertexBuffer,IDirect3DResource8) ...@@ -257,6 +260,54 @@ DECLARE_INTERFACE_(IWineD3DVertexBuffer,IDirect3DResource8)
#endif #endif
/***************************************************************************** /*****************************************************************************
* WineD3DIndexBuffer interface
*/
#define INTERFACE IWineD3DIndexBuffer
DECLARE_INTERFACE_(IWineD3DIndexBuffer,IDirect3DResource8)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IWineD3DResource methods ***/
STDMETHOD(GetParent)(THIS_ IUnknown **pParent) PURE;
STDMETHOD(GetDevice)(THIS_ IWineD3DDevice ** ppDevice) PURE;
STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags) PURE;
STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid, void * pData, DWORD * pSizeOfData) PURE;
STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE;
STDMETHOD_(DWORD,SetPriority)(THIS_ DWORD PriorityNew) PURE;
STDMETHOD_(DWORD,GetPriority)(THIS) PURE;
STDMETHOD_(void,PreLoad)(THIS) PURE;
STDMETHOD_(D3DRESOURCETYPE,GetType)(THIS) PURE;
/*** IWineD3DIndexBuffer methods ***/
STDMETHOD(Lock)(THIS_ UINT OffsetToLock, UINT SizeToLock, BYTE ** ppbData, DWORD Flags) PURE;
STDMETHOD(Unlock)(THIS) PURE;
STDMETHOD(GetDesc)(THIS_ D3DINDEXBUFFER_DESC * pDesc) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IWineD3DIndexBuffer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IWineD3DIndexBuffer_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IWineD3DIndexBuffer_Release(p) (p)->lpVtbl->Release(p)
/*** IWineD3DResource methods ***/
#define IWineD3DIndexBuffer_GetParent(p,a) (p)->lpVtbl->GetParent(p,a)
#define IWineD3DIndexBuffer_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a)
#define IWineD3DIndexBuffer_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d)
#define IWineD3DIndexBuffer_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c)
#define IWineD3DIndexBuffer_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a)
#define IWineD3DIndexBuffer_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a)
#define IWineD3DIndexBuffer_GetPriority(p) (p)->lpVtbl->GetPriority(p)
#define IWineD3DIndexBuffer_PreLoad(p) (p)->lpVtbl->PreLoad(p)
#define IWineD3DIndexBuffer_GetType(p) (p)->lpVtbl->GetType(p)
/*** IWineD3DIndexBuffer methods ***/
#define IWineD3DIndexBuffer_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d)
#define IWineD3DIndexBuffer_Unlock(p) (p)->lpVtbl->Unlock(p)
#define IWineD3DIndexBuffer_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a)
#endif
/*****************************************************************************
* WineD3DStateBlock interface * WineD3DStateBlock interface
*/ */
#define INTERFACE IWineD3DStateBlock #define INTERFACE IWineD3DStateBlock
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment