Commit 513a493f authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Merge IWineD3DIndexBuffer and IWineD3DBuffer.

parent 2a7a2371
......@@ -347,7 +347,7 @@ struct IDirect3DIndexBuffer8Impl
LONG ref;
/* IDirect3DResource8 fields */
IWineD3DIndexBuffer *wineD3DIndexBuffer;
IWineD3DBuffer *wineD3DIndexBuffer;
/* Parent reference */
LPDIRECT3DDEVICE8 parentDevice;
......
......@@ -2099,7 +2099,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetIndices(LPDIRECT3DDEVICE8 iface, I
static HRESULT WINAPI IDirect3DDevice8Impl_GetIndices(LPDIRECT3DDEVICE8 iface, IDirect3DIndexBuffer8** ppIndexData,UINT* pBaseVertexIndex) {
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
IWineD3DIndexBuffer *retIndexData = NULL;
IWineD3DBuffer *retIndexData = NULL;
HRESULT rc = D3D_OK;
TRACE("(%p) Relay\n", This);
......@@ -2113,8 +2113,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetIndices(LPDIRECT3DDEVICE8 iface, I
IWineD3DDevice_GetBaseVertexIndex(This->WineD3DDevice, (INT *) pBaseVertexIndex);
rc = IWineD3DDevice_GetIndices(This->WineD3DDevice, &retIndexData);
if (SUCCEEDED(rc) && retIndexData) {
IWineD3DIndexBuffer_GetParent(retIndexData, (IUnknown **)ppIndexData);
IWineD3DIndexBuffer_Release(retIndexData);
IWineD3DBuffer_GetParent(retIndexData, (IUnknown **)ppIndexData);
IWineD3DBuffer_Release(retIndexData);
} else {
if (FAILED(rc)) FIXME("Call to GetIndices failed\n");
*ppIndexData = NULL;
......
......@@ -57,7 +57,7 @@ static ULONG WINAPI IDirect3DIndexBuffer8Impl_Release(LPDIRECT3DINDEXBUFFER8 ifa
if (ref == 0) {
EnterCriticalSection(&d3d8_cs);
IWineD3DIndexBuffer_Release(This->wineD3DIndexBuffer);
IWineD3DBuffer_Release(This->wineD3DIndexBuffer);
LeaveCriticalSection(&d3d8_cs);
IUnknown_Release(This->parentDevice);
HeapFree(GetProcessHeap(), 0, This);
......@@ -73,7 +73,7 @@ static HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetDevice(LPDIRECT3DINDEXBUFFER8
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DIndexBuffer_GetDevice(This->wineD3DIndexBuffer, &wined3d_device);
hr = IWineD3DBuffer_GetDevice(This->wineD3DIndexBuffer, &wined3d_device);
if (SUCCEEDED(hr))
{
IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice);
......@@ -89,7 +89,7 @@ static HRESULT WINAPI IDirect3DIndexBuffer8Impl_SetPrivateData(LPDIRECT3DINDEXBU
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DIndexBuffer_SetPrivateData(This->wineD3DIndexBuffer, refguid, pData, SizeOfData, Flags);
hr = IWineD3DBuffer_SetPrivateData(This->wineD3DIndexBuffer, refguid, pData, SizeOfData, Flags);
LeaveCriticalSection(&d3d8_cs);
return hr;
}
......@@ -100,7 +100,7 @@ static HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetPrivateData(LPDIRECT3DINDEXBU
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DIndexBuffer_GetPrivateData(This->wineD3DIndexBuffer, refguid, pData, pSizeOfData);
hr = IWineD3DBuffer_GetPrivateData(This->wineD3DIndexBuffer, refguid, pData, pSizeOfData);
LeaveCriticalSection(&d3d8_cs);
return hr;
}
......@@ -111,7 +111,7 @@ static HRESULT WINAPI IDirect3DIndexBuffer8Impl_FreePrivateData(LPDIRECT3DINDEXB
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DIndexBuffer_FreePrivateData(This->wineD3DIndexBuffer, refguid);
hr = IWineD3DBuffer_FreePrivateData(This->wineD3DIndexBuffer, refguid);
LeaveCriticalSection(&d3d8_cs);
return hr;
}
......@@ -122,7 +122,7 @@ static DWORD WINAPI IDirect3DIndexBuffer8Impl_SetPriority(LPDIRECT3DINDEXBUFFER8
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d8_cs);
ret = IWineD3DIndexBuffer_SetPriority(This->wineD3DIndexBuffer, PriorityNew);
ret = IWineD3DBuffer_SetPriority(This->wineD3DIndexBuffer, PriorityNew);
LeaveCriticalSection(&d3d8_cs);
return ret;
}
......@@ -133,7 +133,7 @@ static DWORD WINAPI IDirect3DIndexBuffer8Impl_GetPriority(LPDIRECT3DINDEXBUFFER8
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d8_cs);
ret = IWineD3DIndexBuffer_GetPriority(This->wineD3DIndexBuffer);
ret = IWineD3DBuffer_GetPriority(This->wineD3DIndexBuffer);
LeaveCriticalSection(&d3d8_cs);
return ret;
}
......@@ -143,7 +143,7 @@ static void WINAPI IDirect3DIndexBuffer8Impl_PreLoad(LPDIRECT3DINDEXBUFFER8 ifac
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d8_cs);
IWineD3DIndexBuffer_PreLoad(This->wineD3DIndexBuffer);
IWineD3DBuffer_PreLoad(This->wineD3DIndexBuffer);
LeaveCriticalSection(&d3d8_cs);
}
......@@ -161,7 +161,7 @@ static HRESULT WINAPI IDirect3DIndexBuffer8Impl_Lock(LPDIRECT3DINDEXBUFFER8 ifac
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DIndexBuffer_Map(This->wineD3DIndexBuffer, OffsetToLock, SizeToLock, ppbData, Flags);
hr = IWineD3DBuffer_Map(This->wineD3DIndexBuffer, OffsetToLock, SizeToLock, ppbData, Flags);
LeaveCriticalSection(&d3d8_cs);
return hr;
}
......@@ -172,7 +172,7 @@ static HRESULT WINAPI IDirect3DIndexBuffer8Impl_Unlock(LPDIRECT3DINDEXBUFFER8 if
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DIndexBuffer_Unmap(This->wineD3DIndexBuffer);
hr = IWineD3DBuffer_Unmap(This->wineD3DIndexBuffer);
LeaveCriticalSection(&d3d8_cs);
return hr;
}
......@@ -184,7 +184,7 @@ static HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetDesc(LPDIRECT3DINDEXBUFFER8 i
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DIndexBuffer_GetDesc(This->wineD3DIndexBuffer, &desc);
hr = IWineD3DBuffer_GetDesc(This->wineD3DIndexBuffer, &desc);
LeaveCriticalSection(&d3d8_cs);
if (SUCCEEDED(hr)) {
......
......@@ -345,7 +345,7 @@ typedef struct IDirect3DIndexBuffer9Impl
LONG ref;
/* IDirect3DResource9 fields */
IWineD3DIndexBuffer *wineD3DIndexBuffer;
IWineD3DBuffer *wineD3DIndexBuffer;
/* Parent reference */
LPDIRECT3DDEVICE9EX parentDevice;
......
......@@ -1649,7 +1649,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetIndices(LPDIRECT3DDEVICE9EX ifac
static HRESULT WINAPI IDirect3DDevice9Impl_GetIndices(LPDIRECT3DDEVICE9EX iface, IDirect3DIndexBuffer9 **ppIndexData) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IWineD3DIndexBuffer *retIndexData = NULL;
IWineD3DBuffer *retIndexData = NULL;
HRESULT rc = D3D_OK;
TRACE("(%p) Relay\n", This);
......@@ -1661,8 +1661,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetIndices(LPDIRECT3DDEVICE9EX ifac
EnterCriticalSection(&d3d9_cs);
rc = IWineD3DDevice_GetIndices(This->WineD3DDevice, &retIndexData);
if (SUCCEEDED(rc) && retIndexData) {
IWineD3DIndexBuffer_GetParent(retIndexData, (IUnknown **)ppIndexData);
IWineD3DIndexBuffer_Release(retIndexData);
IWineD3DBuffer_GetParent(retIndexData, (IUnknown **)ppIndexData);
IWineD3DBuffer_Release(retIndexData);
} else {
if (FAILED(rc)) FIXME("Call to GetIndices failed\n");
*ppIndexData = NULL;
......
......@@ -58,7 +58,7 @@ static ULONG WINAPI IDirect3DIndexBuffer9Impl_Release(LPDIRECT3DINDEXBUFFER9 ifa
if (ref == 0) {
EnterCriticalSection(&d3d9_cs);
IWineD3DIndexBuffer_Release(This->wineD3DIndexBuffer);
IWineD3DBuffer_Release(This->wineD3DIndexBuffer);
LeaveCriticalSection(&d3d9_cs);
IDirect3DDevice9Ex_Release(This->parentDevice);
HeapFree(GetProcessHeap(), 0, This);
......@@ -74,7 +74,7 @@ static HRESULT WINAPI IDirect3DIndexBuffer9Impl_GetDevice(LPDIRECT3DINDEXBUFFER9
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DIndexBuffer_GetDevice(This->wineD3DIndexBuffer, &wined3d_device);
hr = IWineD3DBuffer_GetDevice(This->wineD3DIndexBuffer, &wined3d_device);
if (SUCCEEDED(hr))
{
IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice);
......@@ -90,7 +90,7 @@ static HRESULT WINAPI IDirect3DIndexBuffer9Impl_SetPrivateData(LPDIRECT3DINDEXBU
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DIndexBuffer_SetPrivateData(This->wineD3DIndexBuffer, refguid, pData, SizeOfData, Flags);
hr = IWineD3DBuffer_SetPrivateData(This->wineD3DIndexBuffer, refguid, pData, SizeOfData, Flags);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
......@@ -101,7 +101,7 @@ static HRESULT WINAPI IDirect3DIndexBuffer9Impl_GetPrivateData(LPDIRECT3DINDEXBU
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DIndexBuffer_GetPrivateData(This->wineD3DIndexBuffer, refguid, pData, pSizeOfData);
hr = IWineD3DBuffer_GetPrivateData(This->wineD3DIndexBuffer, refguid, pData, pSizeOfData);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
......@@ -112,7 +112,7 @@ static HRESULT WINAPI IDirect3DIndexBuffer9Impl_FreePrivateData(LPDIRECT3DINDEXB
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DIndexBuffer_FreePrivateData(This->wineD3DIndexBuffer, refguid);
hr = IWineD3DBuffer_FreePrivateData(This->wineD3DIndexBuffer, refguid);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
......@@ -123,7 +123,7 @@ static DWORD WINAPI IDirect3DIndexBuffer9Impl_SetPriority(LPDIRECT3DINDEXBUFFER9
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d9_cs);
ret = IWineD3DIndexBuffer_SetPriority(This->wineD3DIndexBuffer, PriorityNew);
ret = IWineD3DBuffer_SetPriority(This->wineD3DIndexBuffer, PriorityNew);
LeaveCriticalSection(&d3d9_cs);
return ret;
}
......@@ -134,7 +134,7 @@ static DWORD WINAPI IDirect3DIndexBuffer9Impl_GetPriority(LPDIRECT3DINDEXBUFFER9
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d9_cs);
ret = IWineD3DIndexBuffer_GetPriority(This->wineD3DIndexBuffer);
ret = IWineD3DBuffer_GetPriority(This->wineD3DIndexBuffer);
LeaveCriticalSection(&d3d9_cs);
return ret;
}
......@@ -144,7 +144,7 @@ static void WINAPI IDirect3DIndexBuffer9Impl_PreLoad(LPDIRECT3DINDEXBUFFER9 ifac
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d9_cs);
IWineD3DIndexBuffer_PreLoad(This->wineD3DIndexBuffer);
IWineD3DBuffer_PreLoad(This->wineD3DIndexBuffer);
LeaveCriticalSection(&d3d9_cs);
}
......@@ -162,7 +162,7 @@ static HRESULT WINAPI IDirect3DIndexBuffer9Impl_Lock(LPDIRECT3DINDEXBUFFER9 ifac
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DIndexBuffer_Map(This->wineD3DIndexBuffer, OffsetToLock, SizeToLock, (BYTE **)ppbData, Flags);
hr = IWineD3DBuffer_Map(This->wineD3DIndexBuffer, OffsetToLock, SizeToLock, (BYTE **)ppbData, Flags);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
......@@ -173,7 +173,7 @@ static HRESULT WINAPI IDirect3DIndexBuffer9Impl_Unlock(LPDIRECT3DINDEXBUFFER9 if
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DIndexBuffer_Unmap(This->wineD3DIndexBuffer);
hr = IWineD3DBuffer_Unmap(This->wineD3DIndexBuffer);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
......@@ -185,7 +185,7 @@ static HRESULT WINAPI IDirect3DIndexBuffer9Impl_GetDesc(LPDIRECT3DINDEXB
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DIndexBuffer_GetDesc(This->wineD3DIndexBuffer, &desc);
hr = IWineD3DBuffer_GetDesc(This->wineD3DIndexBuffer, &desc);
LeaveCriticalSection(&d3d9_cs);
if (SUCCEEDED(hr)) {
......
......@@ -385,7 +385,7 @@ struct IDirect3DDeviceImpl
/* Other object connections */
IWineD3DDevice *wineD3DDevice;
IDirectDrawImpl *ddraw;
IWineD3DIndexBuffer *indexbuffer;
IWineD3DBuffer *indexbuffer;
IDirectDrawSurfaceImpl *target;
BOOL OffScreenTarget;
......
......@@ -317,8 +317,8 @@ IDirect3DDeviceImpl_7_Release(IDirect3DDevice7 *iface)
EnterCriticalSection(&ddraw_cs);
/* Free the index buffer. */
IWineD3DDevice_SetIndices(This->wineD3DDevice, NULL);
IWineD3DIndexBuffer_GetParent(This->indexbuffer,
(IUnknown **) &IndexBufferParent);
IWineD3DBuffer_GetParent(This->indexbuffer,
(IUnknown **) &IndexBufferParent);
IParent_Release(IndexBufferParent); /* Once for the getParent */
if( IParent_Release(IndexBufferParent) != 0) /* And now to destroy it */
{
......@@ -4271,23 +4271,23 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
* or a SetData-Method for the index buffer, which
* overrides the index buffer data with our pointer.
*/
hr = IWineD3DIndexBuffer_Map(This->indexbuffer,
0 /* OffSetToLock */,
IndexCount * sizeof(WORD),
(BYTE **) &LockedIndices,
0 /* Flags */);
hr = IWineD3DBuffer_Map(This->indexbuffer,
0 /* OffSetToLock */,
IndexCount * sizeof(WORD),
(BYTE **) &LockedIndices,
0 /* Flags */);
assert(IndexCount < 0x100000);
if(hr != D3D_OK)
{
ERR("(%p) IWineD3DIndexBuffer::Lock failed with hr = %08x\n", This, hr);
ERR("(%p) IWineD3DBuffer::Map failed with hr = %08x\n", This, hr);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
memcpy(LockedIndices, Indices, IndexCount * sizeof(WORD));
hr = IWineD3DIndexBuffer_Unmap(This->indexbuffer);
hr = IWineD3DBuffer_Unmap(This->indexbuffer);
if(hr != D3D_OK)
{
ERR("(%p) IWineD3DIndexBuffer::Unlock failed with hr = %08x\n", This, hr);
ERR("(%p) IWineD3DBuffer::Unmap failed with hr = %08x\n", This, hr);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
......
......@@ -820,7 +820,7 @@ IDirect3DImpl_7_CreateDevice(IDirect3D7 *iface,
/* Create an Index Buffer. WineD3D needs one for Drawing indexed primitives
* Create a (hopefully) long enough buffer, and copy the indices into it
* Ideally, a IWineD3DIndexBuffer::SetData method could be created, which
* Ideally, a IWineD3DBuffer::SetData method could be created, which
* takes the pointer and avoids the memcpy
*/
hr = IWineD3DDevice_CreateIndexBuffer(This->wineD3DDevice, 0x40000 /* Length. Don't know how long it should be */,
......
......@@ -245,7 +245,7 @@ IDirect3DVertexBufferImpl_Lock(IDirect3DVertexBuffer7 *iface,
hr = IWineD3DBuffer_GetDesc(This->wineD3DVertexBuffer, &Desc);
if(hr != D3D_OK)
{
ERR("(%p) IWineD3DVertexBuffer::GetDesc failed with hr=%08x\n", This, hr);
ERR("(%p) IWineD3DBuffer::GetDesc failed with hr=%08x\n", This, hr);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
......@@ -445,7 +445,7 @@ IDirect3DVertexBufferImpl_GetVertexBufferDesc(IDirect3DVertexBuffer7 *iface,
hr = IWineD3DBuffer_GetDesc(This->wineD3DVertexBuffer, &WDesc);
if(hr != D3D_OK)
{
ERR("(%p) IWineD3DVertexBuffer::GetDesc failed with hr=%08x\n", This, hr);
ERR("(%p) IWineD3DBuffer::GetDesc failed with hr=%08x\n", This, hr);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
......
......@@ -583,7 +583,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *ifac
}
static HRESULT WINAPI IWineD3DDeviceImpl_CreateIndexBuffer(IWineD3DDevice *iface, UINT Length, DWORD Usage,
WINED3DFORMAT Format, WINED3DPOOL Pool, IWineD3DIndexBuffer** ppIndexBuffer,
WINED3DFORMAT Format, WINED3DPOOL Pool, IWineD3DBuffer** ppIndexBuffer,
HANDLE *sharedHandle, IUnknown *parent) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
const struct GlPixelFormatDesc *format_desc = getFormatDescEntry(Format, &This->adapter->gl_info);
......@@ -622,7 +622,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateIndexBuffer(IWineD3DDevice *iface
TRACE("(%p) : Len=%d, Use=%x, Format=(%u,%s), Pool=%d - Memory@%p, Iface@%p\n", This, Length, Usage, Format,
debug_d3dformat(Format), Pool, object, object->resource.allocatedMemory);
*ppIndexBuffer = (IWineD3DIndexBuffer *) object;
*ppIndexBuffer = (IWineD3DBuffer *) object;
return WINED3D_OK;
}
......@@ -752,7 +752,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface,
}
}
if(object->pIndexData) {
IWineD3DIndexBuffer_AddRef(object->pIndexData);
IWineD3DBuffer_AddRef(object->pIndexData);
}
if(object->vertexShader) {
IWineD3DVertexShader_AddRef(object->vertexShader);
......@@ -3637,9 +3637,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetMaterial(IWineD3DDevice *iface, WINE
/*****
* Get / Set Indices
*****/
static HRESULT WINAPI IWineD3DDeviceImpl_SetIndices(IWineD3DDevice *iface, IWineD3DIndexBuffer* pIndexData) {
static HRESULT WINAPI IWineD3DDeviceImpl_SetIndices(IWineD3DDevice *iface, IWineD3DBuffer* pIndexData) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DIndexBuffer *oldIdxs;
IWineD3DBuffer *oldIdxs;
TRACE("(%p) : Setting to %p\n", This, pIndexData);
oldIdxs = This->updateStateBlock->pIndexData;
......@@ -3650,8 +3650,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetIndices(IWineD3DDevice *iface, IWine
/* Handle recording of state blocks */
if (This->isRecordingState) {
TRACE("Recording... not performing anything\n");
if(pIndexData) IWineD3DIndexBuffer_AddRef(pIndexData);
if(oldIdxs) IWineD3DIndexBuffer_Release(oldIdxs);
if(pIndexData) IWineD3DBuffer_AddRef(pIndexData);
if(oldIdxs) IWineD3DBuffer_Release(oldIdxs);
return WINED3D_OK;
}
......@@ -3659,25 +3659,25 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetIndices(IWineD3DDevice *iface, IWine
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER);
if(pIndexData) {
InterlockedIncrement(&((struct wined3d_buffer *)pIndexData)->bind_count);
IWineD3DIndexBuffer_AddRef(pIndexData);
IWineD3DBuffer_AddRef(pIndexData);
}
if(oldIdxs) {
InterlockedDecrement(&((struct wined3d_buffer *)oldIdxs)->bind_count);
IWineD3DIndexBuffer_Release(oldIdxs);
IWineD3DBuffer_Release(oldIdxs);
}
}
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DDeviceImpl_GetIndices(IWineD3DDevice *iface, IWineD3DIndexBuffer** ppIndexData) {
static HRESULT WINAPI IWineD3DDeviceImpl_GetIndices(IWineD3DDevice *iface, IWineD3DBuffer** ppIndexData) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
*ppIndexData = This->stateBlock->pIndexData;
/* up ref count on ppindexdata */
if (*ppIndexData) {
IWineD3DIndexBuffer_AddRef(*ppIndexData);
IWineD3DBuffer_AddRef(*ppIndexData);
TRACE("(%p) index data set to %p\n", This, ppIndexData);
}else{
TRACE("(%p) No index data set\n", This);
......@@ -5637,7 +5637,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *if
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
UINT idxStride = 2;
IWineD3DIndexBuffer *pIB;
IWineD3DBuffer *pIB;
WINED3DBUFFER_DESC IdxBufDsc;
GLuint vbo;
......@@ -5665,7 +5665,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *if
TRACE("(%p) : min %u, vertex count %u, startIdx %u, index count %u\n",
This, minIndex, NumVertices, startIndex, index_count);
IWineD3DIndexBuffer_GetDesc(pIB, &IdxBufDsc);
IWineD3DBuffer_GetDesc(pIB, &IdxBufDsc);
if (IdxBufDsc.Format == WINED3DFMT_R16_UINT) {
idxStride = 2;
} else {
......@@ -5729,7 +5729,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *
int idxStride;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DBuffer *vb;
IWineD3DIndexBuffer *ib;
IWineD3DBuffer *ib;
TRACE("(%p) : MinVtxIdx %u, NumVIdx %u, index count %u, pidxdata %p, IdxFmt %u, pVtxdata %p, stride=%u\n",
This, MinVertexIndex, NumVertices, index_count, pIndexData,
......@@ -5769,7 +5769,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *
This->stateBlock->streamStride[0] = 0;
ib = This->stateBlock->pIndexData;
if(ib) {
IWineD3DIndexBuffer_Release(ib);
IWineD3DBuffer_Release(ib);
This->stateBlock->pIndexData = NULL;
}
/* No need to mark the stream source state dirty here. Either the app calls UP drawing again, or it has to call
......@@ -7890,12 +7890,12 @@ static void WINAPI IWineD3DDeviceImpl_ResourceReleased(IWineD3DDevice *iface, IW
}
if (This->updateStateBlock != NULL ) { /* ==NULL when device is being destroyed */
if (This->updateStateBlock->pIndexData == (IWineD3DIndexBuffer *)resource) {
if (This->updateStateBlock->pIndexData == (IWineD3DBuffer *)resource) {
This->updateStateBlock->pIndexData = NULL;
}
}
if (This->stateBlock != NULL ) { /* ==NULL when device is being destroyed */
if (This->stateBlock->pIndexData == (IWineD3DIndexBuffer *)resource) {
if (This->stateBlock->pIndexData == (IWineD3DBuffer *)resource) {
This->stateBlock->pIndexData = NULL;
}
}
......
......@@ -301,7 +301,7 @@ static ULONG WINAPI IWineD3DStateBlockImpl_Release(IWineD3DStateBlock *iface) {
}
}
}
if(This->pIndexData) IWineD3DIndexBuffer_Release(This->pIndexData);
if(This->pIndexData) IWineD3DBuffer_Release(This->pIndexData);
if(This->vertexShader) IWineD3DVertexShader_Release(This->vertexShader);
if(This->pixelShader) IWineD3DPixelShader_Release(This->pixelShader);
......@@ -509,8 +509,8 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|| (This->baseVertexIndex != targetStateBlock->baseVertexIndex))) {
TRACE("Updating pIndexData to %p, baseVertexIndex to %d\n",
targetStateBlock->pIndexData, targetStateBlock->baseVertexIndex);
if(targetStateBlock->pIndexData) IWineD3DIndexBuffer_AddRef(targetStateBlock->pIndexData);
if(This->pIndexData) IWineD3DIndexBuffer_Release(This->pIndexData);
if(targetStateBlock->pIndexData) IWineD3DBuffer_AddRef(targetStateBlock->pIndexData);
if(This->pIndexData) IWineD3DBuffer_Release(This->pIndexData);
This->pIndexData = targetStateBlock->pIndexData;
This->baseVertexIndex = targetStateBlock->baseVertexIndex;
}
......@@ -656,8 +656,8 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
This->scissorRect = targetStateBlock->scissorRect;
if(targetStateBlock->pIndexData != This->pIndexData) {
if (targetStateBlock->pIndexData) IWineD3DIndexBuffer_AddRef(targetStateBlock->pIndexData);
if (This->pIndexData) IWineD3DIndexBuffer_Release(This->pIndexData);
if (targetStateBlock->pIndexData) IWineD3DBuffer_AddRef(targetStateBlock->pIndexData);
if (This->pIndexData) IWineD3DBuffer_Release(This->pIndexData);
This->pIndexData = targetStateBlock->pIndexData;
}
for(i = 0; i < MAX_STREAMS; i++) {
......
......@@ -1930,7 +1930,7 @@ struct IWineD3DStateBlockImpl
UINT streamFlags[MAX_STREAMS + 1]; /*0 | WINED3DSTREAMSOURCE_INSTANCEDATA | WINED3DSTREAMSOURCE_INDEXEDDATA */
/* Indices */
IWineD3DIndexBuffer* pIndexData;
IWineD3DBuffer* pIndexData;
INT baseVertexIndex;
INT loadBaseVertexIndex; /* non-indexed drawing needs 0 here, indexed baseVertexIndex */
......
......@@ -2342,26 +2342,6 @@ interface IWineD3DRendertargetView : IWineD3DBase
[
object,
local,
uuid(3a02a54e-6f30-11d9-c687-00046142c14f)
]
interface IWineD3DIndexBuffer : IWineD3DResource
{
HRESULT Map(
[in] UINT offset,
[in] UINT size,
[out] BYTE **data,
[in] DWORD flags
);
HRESULT Unmap(
);
HRESULT GetDesc(
[out] WINED3DBUFFER_DESC *desc
);
}
[
object,
local,
uuid(f756720c-32b9-4439-b5a3-1d6c97037d9e)
]
interface IWineD3DPalette : IWineD3DBase
......@@ -2916,7 +2896,7 @@ interface IWineD3DDevice : IWineD3DBase
[in] DWORD usage,
[in] WINED3DFORMAT format,
[in] WINED3DPOOL pool,
[out] IWineD3DIndexBuffer **index_buffer,
[out] IWineD3DBuffer **index_buffer,
[in] HANDLE *shared_handle,
[in] IUnknown *parent
);
......@@ -3139,10 +3119,10 @@ interface IWineD3DDevice : IWineD3DBase
[out] WINED3DGAMMARAMP *ramp
);
HRESULT SetIndices(
[in] IWineD3DIndexBuffer *index_buffer
[in] IWineD3DBuffer *index_buffer
);
HRESULT GetIndices(
[out] IWineD3DIndexBuffer **index_buffer
[out] IWineD3DBuffer **index_buffer
);
HRESULT SetBaseVertexIndex(
[in] INT base_index
......
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