d3d9: Hold the lock in Vertexbuffer methods.
This commit is contained in:
parent
99a3d76e8d
commit
d9583c6c58
|
@ -58,7 +58,9 @@ static ULONG WINAPI IDirect3DVertexBuffer9Impl_Release(LPDIRECT3DVERTEXBUFFER9 i
|
|||
TRACE("(%p) : ReleaseRef to %d\n", This, ref);
|
||||
|
||||
if (ref == 0) {
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
IWineD3DVertexBuffer_Release(This->wineD3DVertexBuffer);
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
IUnknown_Release(This->parentDevice);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
@ -68,8 +70,13 @@ static ULONG WINAPI IDirect3DVertexBuffer9Impl_Release(LPDIRECT3DVERTEXBUFFER9 i
|
|||
/* IDirect3DVertexBuffer9 IDirect3DResource9 Interface follow: */
|
||||
static HRESULT WINAPI IDirect3DVertexBuffer9Impl_GetDevice(LPDIRECT3DVERTEXBUFFER9 iface, IDirect3DDevice9** ppDevice) {
|
||||
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
return IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice);
|
||||
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
hr = IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice);
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3DVertexBuffer9Impl_SetPrivateData(LPDIRECT3DVERTEXBUFFER9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
|
||||
|
@ -80,58 +87,101 @@ static HRESULT WINAPI IDirect3DVertexBuffer9Impl_SetPrivateData(LPDIRECT3DVERTEX
|
|||
|
||||
static HRESULT WINAPI IDirect3DVertexBuffer9Impl_GetPrivateData(LPDIRECT3DVERTEXBUFFER9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
|
||||
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
return IWineD3DVertexBuffer_GetPrivateData(This->wineD3DVertexBuffer, refguid, pData, pSizeOfData);
|
||||
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
hr = IWineD3DVertexBuffer_GetPrivateData(This->wineD3DVertexBuffer, refguid, pData, pSizeOfData);
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3DVertexBuffer9Impl_FreePrivateData(LPDIRECT3DVERTEXBUFFER9 iface, REFGUID refguid) {
|
||||
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
return IWineD3DVertexBuffer_FreePrivateData(This->wineD3DVertexBuffer, refguid);
|
||||
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
hr = IWineD3DVertexBuffer_FreePrivateData(This->wineD3DVertexBuffer, refguid);
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
return hr;
|
||||
}
|
||||
|
||||
static DWORD WINAPI IDirect3DVertexBuffer9Impl_SetPriority(LPDIRECT3DVERTEXBUFFER9 iface, DWORD PriorityNew) {
|
||||
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
return IWineD3DVertexBuffer_SetPriority(This->wineD3DVertexBuffer, PriorityNew);
|
||||
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
hr = IWineD3DVertexBuffer_SetPriority(This->wineD3DVertexBuffer, PriorityNew);
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
return hr;
|
||||
}
|
||||
|
||||
static DWORD WINAPI IDirect3DVertexBuffer9Impl_GetPriority(LPDIRECT3DVERTEXBUFFER9 iface) {
|
||||
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
return IWineD3DVertexBuffer_GetPriority(This->wineD3DVertexBuffer);
|
||||
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
hr = IWineD3DVertexBuffer_GetPriority(This->wineD3DVertexBuffer);
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
return hr;
|
||||
}
|
||||
|
||||
static void WINAPI IDirect3DVertexBuffer9Impl_PreLoad(LPDIRECT3DVERTEXBUFFER9 iface) {
|
||||
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
IWineD3DVertexBuffer_PreLoad(This->wineD3DVertexBuffer);
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
return ;
|
||||
}
|
||||
|
||||
static D3DRESOURCETYPE WINAPI IDirect3DVertexBuffer9Impl_GetType(LPDIRECT3DVERTEXBUFFER9 iface) {
|
||||
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
|
||||
D3DRESOURCETYPE ret;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
return IWineD3DVertexBuffer_GetType(This->wineD3DVertexBuffer);
|
||||
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
ret = IWineD3DVertexBuffer_GetType(This->wineD3DVertexBuffer);
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* IDirect3DVertexBuffer9 Interface follow: */
|
||||
static HRESULT WINAPI IDirect3DVertexBuffer9Impl_Lock(LPDIRECT3DVERTEXBUFFER9 iface, UINT OffsetToLock, UINT SizeToLock, void** ppbData, DWORD Flags) {
|
||||
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
return IWineD3DVertexBuffer_Lock(This->wineD3DVertexBuffer, OffsetToLock, SizeToLock, (BYTE **)ppbData, Flags);
|
||||
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
hr = IWineD3DVertexBuffer_Lock(This->wineD3DVertexBuffer, OffsetToLock, SizeToLock, (BYTE **)ppbData, Flags);
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3DVertexBuffer9Impl_Unlock(LPDIRECT3DVERTEXBUFFER9 iface) {
|
||||
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
return IWineD3DVertexBuffer_Unlock(This->wineD3DVertexBuffer);
|
||||
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
hr = IWineD3DVertexBuffer_Unlock(This->wineD3DVertexBuffer);
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3DVertexBuffer9Impl_GetDesc(LPDIRECT3DVERTEXBUFFER9 iface, D3DVERTEXBUFFER_DESC* pDesc) {
|
||||
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
return IWineD3DVertexBuffer_GetDesc(This->wineD3DVertexBuffer, (WINED3DVERTEXBUFFER_DESC *) pDesc);
|
||||
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
hr = IWineD3DVertexBuffer_GetDesc(This->wineD3DVertexBuffer, (WINED3DVERTEXBUFFER_DESC *) pDesc);
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
return hr;
|
||||
}
|
||||
|
||||
static const IDirect3DVertexBuffer9Vtbl Direct3DVertexBuffer9_Vtbl =
|
||||
|
@ -174,7 +224,9 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(LPDIRECT3DDEVICE9 iface,
|
|||
|
||||
object->lpVtbl = &Direct3DVertexBuffer9_Vtbl;
|
||||
object->ref = 1;
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
hrc = IWineD3DDevice_CreateVertexBuffer(This->WineD3DDevice, Size, Usage & WINED3DUSAGE_MASK, FVF, (WINED3DPOOL) Pool, &(object->wineD3DVertexBuffer), pSharedHandle, (IUnknown *)object);
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
|
||||
if (hrc != D3D_OK) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue