Commit 1ec8788b authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

d3d8: Hold the lock in IDirect3DIndexBuffer8 methods.

parent e96287e4
......@@ -56,7 +56,9 @@ static ULONG WINAPI IDirect3DIndexBuffer8Impl_Release(LPDIRECT3DINDEXBUFFER8 ifa
TRACE("(%p) : ReleaseRef to %d\n", This, ref);
if (ref == 0) {
EnterCriticalSection(&d3d8_cs);
IWineD3DIndexBuffer_Release(This->wineD3DIndexBuffer);
LeaveCriticalSection(&d3d8_cs);
IUnknown_Release(This->parentDevice);
HeapFree(GetProcessHeap(), 0, This);
}
......@@ -66,69 +68,122 @@ static ULONG WINAPI IDirect3DIndexBuffer8Impl_Release(LPDIRECT3DINDEXBUFFER8 ifa
/* IDirect3DIndexBuffer8 IDirect3DResource8 Interface follow: */
static HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetDevice(LPDIRECT3DINDEXBUFFER8 iface, IDirect3DDevice8 **ppDevice) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n", This);
return IDirect3DResource8Impl_GetDevice((LPDIRECT3DRESOURCE8) This, ppDevice);
EnterCriticalSection(&d3d8_cs);
hr = IDirect3DResource8Impl_GetDevice((LPDIRECT3DRESOURCE8) This, ppDevice);
LeaveCriticalSection(&d3d8_cs);
return hr;
}
static HRESULT WINAPI IDirect3DIndexBuffer8Impl_SetPrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n", This);
return IWineD3DIndexBuffer_SetPrivateData(This->wineD3DIndexBuffer, refguid, pData, SizeOfData, Flags);
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DIndexBuffer_SetPrivateData(This->wineD3DIndexBuffer, refguid, pData, SizeOfData, Flags);
LeaveCriticalSection(&d3d8_cs);
return hr;
}
static HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetPrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid, void *pData, DWORD *pSizeOfData) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n", This);
return IWineD3DIndexBuffer_GetPrivateData(This->wineD3DIndexBuffer, refguid, pData, pSizeOfData);
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DIndexBuffer_GetPrivateData(This->wineD3DIndexBuffer, refguid, pData, pSizeOfData);
LeaveCriticalSection(&d3d8_cs);
return hr;
}
static HRESULT WINAPI IDirect3DIndexBuffer8Impl_FreePrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n", This);
return IWineD3DIndexBuffer_FreePrivateData(This->wineD3DIndexBuffer, refguid);
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DIndexBuffer_FreePrivateData(This->wineD3DIndexBuffer, refguid);
LeaveCriticalSection(&d3d8_cs);
return hr;
}
static DWORD WINAPI IDirect3DIndexBuffer8Impl_SetPriority(LPDIRECT3DINDEXBUFFER8 iface, DWORD PriorityNew) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
DWORD ret;
TRACE("(%p) Relay\n", This);
return IWineD3DIndexBuffer_SetPriority(This->wineD3DIndexBuffer, PriorityNew);
EnterCriticalSection(&d3d8_cs);
ret = IWineD3DIndexBuffer_SetPriority(This->wineD3DIndexBuffer, PriorityNew);
LeaveCriticalSection(&d3d8_cs);
return ret;
}
static DWORD WINAPI IDirect3DIndexBuffer8Impl_GetPriority(LPDIRECT3DINDEXBUFFER8 iface) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
DWORD ret;
TRACE("(%p) Relay\n", This);
return IWineD3DIndexBuffer_GetPriority(This->wineD3DIndexBuffer);
EnterCriticalSection(&d3d8_cs);
ret = IWineD3DIndexBuffer_GetPriority(This->wineD3DIndexBuffer);
LeaveCriticalSection(&d3d8_cs);
return ret;
}
static void WINAPI IDirect3DIndexBuffer8Impl_PreLoad(LPDIRECT3DINDEXBUFFER8 iface) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d8_cs);
IWineD3DIndexBuffer_PreLoad(This->wineD3DIndexBuffer);
LeaveCriticalSection(&d3d8_cs);
}
static D3DRESOURCETYPE WINAPI IDirect3DIndexBuffer8Impl_GetType(LPDIRECT3DINDEXBUFFER8 iface) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
D3DRESOURCETYPE type;
TRACE("(%p) Relay\n", This);
return IWineD3DIndexBuffer_GetType(This->wineD3DIndexBuffer);
EnterCriticalSection(&d3d8_cs);
type = IWineD3DIndexBuffer_GetType(This->wineD3DIndexBuffer);
LeaveCriticalSection(&d3d8_cs);
return type;
}
/* IDirect3DIndexBuffer8 Interface follow: */
static HRESULT WINAPI IDirect3DIndexBuffer8Impl_Lock(LPDIRECT3DINDEXBUFFER8 iface, UINT OffsetToLock, UINT SizeToLock, BYTE **ppbData, DWORD Flags) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n", This);
return IWineD3DIndexBuffer_Lock(This->wineD3DIndexBuffer, OffsetToLock, SizeToLock, ppbData, Flags);
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DIndexBuffer_Lock(This->wineD3DIndexBuffer, OffsetToLock, SizeToLock, ppbData, Flags);
LeaveCriticalSection(&d3d8_cs);
return hr;
}
static HRESULT WINAPI IDirect3DIndexBuffer8Impl_Unlock(LPDIRECT3DINDEXBUFFER8 iface) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n", This);
return IWineD3DIndexBuffer_Unlock(This->wineD3DIndexBuffer);
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DIndexBuffer_Unlock(This->wineD3DIndexBuffer);
LeaveCriticalSection(&d3d8_cs);
return hr;
}
static HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetDesc(LPDIRECT3DINDEXBUFFER8 iface, D3DINDEXBUFFER_DESC *pDesc) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n", This);
return IWineD3DIndexBuffer_GetDesc(This->wineD3DIndexBuffer, (WINED3DINDEXBUFFER_DESC *) pDesc);
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DIndexBuffer_GetDesc(This->wineD3DIndexBuffer, (WINED3DINDEXBUFFER_DESC *) pDesc);
LeaveCriticalSection(&d3d8_cs);
return hr;
}
......
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