Commit fd3d769a authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d9: Fix locking.

It appears there are some calls to wined3d missing critical sections.
parent 435b528e
......@@ -513,6 +513,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_Reset(LPDIRECT3DDEVICE9EX iface, D3
* Unsetting them is no problem, because the states are supposed to be reset anyway. If the validation
* below fails, the device is considered "lost", and _Reset and _Release are the only allowed calls
*/
EnterCriticalSection(&d3d9_cs);
IWineD3DDevice_SetIndices(This->WineD3DDevice, NULL);
for(i = 0; i < 16; i++) {
IWineD3DDevice_SetStreamSource(This->WineD3DDevice, i, NULL, 0, 0);
......@@ -525,6 +527,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_Reset(LPDIRECT3DDEVICE9EX iface, D3
if(!resources_ok) {
WARN("The application is holding D3DPOOL_DEFAULT resources, rejecting reset\n");
This->notreset = TRUE;
LeaveCriticalSection(&d3d9_cs);
return WINED3DERR_INVALIDCALL;
}
......@@ -544,9 +547,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_Reset(LPDIRECT3DDEVICE9EX iface, D3
localParameters.PresentationInterval = pPresentationParameters->PresentationInterval;
localParameters.AutoRestoreDisplayMode = TRUE;
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DDevice_Reset(This->WineD3DDevice, &localParameters);
LeaveCriticalSection(&d3d9_cs);
if(FAILED(hr)) {
This->notreset = TRUE;
......@@ -568,6 +569,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_Reset(LPDIRECT3DDEVICE9EX iface, D3
This->notreset = FALSE;
}
LeaveCriticalSection(&d3d9_cs);
return hr;
}
......@@ -672,9 +675,11 @@ static HRESULT IDirect3DDevice9Impl_CreateSurface(LPDIRECT3DDEVICE9EX iface, UIN
TRACE("(%p) : w(%d) h(%d) fmt(%d) surf@%p\n", This, Width, Height, Format, *ppSurface);
EnterCriticalSection(&d3d9_cs);
hrc = IWineD3DDevice_CreateSurface(This->WineD3DDevice, Width, Height, wined3dformat_from_d3dformat(Format),
Lockable, Discard, Level, &object->wineD3DSurface, Type, Usage & WINED3DUSAGE_MASK, (WINED3DPOOL)Pool,
MultiSample, MultisampleQuality, pSharedHandle, SURFACE_OPENGL, (IUnknown *)object);
LeaveCriticalSection(&d3d9_cs);
if (hrc != D3D_OK || NULL == object->wineD3DSurface) {
......@@ -699,10 +704,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateRenderTarget(LPDIRECT3DDEVICE
HRESULT hr;
TRACE("Relay\n");
/* Is this correct? */
EnterCriticalSection(&d3d9_cs);
hr = IDirect3DDevice9Impl_CreateSurface(iface,Width,Height,Format,Lockable,FALSE/*Discard*/, 0/*Level*/, ppSurface,D3DRTYPE_SURFACE,D3DUSAGE_RENDERTARGET,D3DPOOL_DEFAULT,MultiSample,MultisampleQuality,pSharedHandle);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
......@@ -713,11 +715,9 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateDepthStencilSurface(LPDIRECT3
HRESULT hr;
TRACE("Relay\n");
EnterCriticalSection(&d3d9_cs);
hr = IDirect3DDevice9Impl_CreateSurface(iface,Width,Height,Format,TRUE/* Lockable */,Discard, 0/* Level */
,ppSurface,D3DRTYPE_SURFACE,D3DUSAGE_DEPTHSTENCIL,
D3DPOOL_DEFAULT,MultiSample,MultisampleQuality,pSharedHandle);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
......@@ -796,19 +796,21 @@ static HRESULT WINAPI IDirect3DDevice9Impl_ColorFill(LPDIRECT3DDEVICE9EX iface
desc.Usage = &usage;
desc.Pool = &pool;
desc.Type = &restype;
EnterCriticalSection(&d3d9_cs);
IWineD3DSurface_GetDesc(surface->wineD3DSurface, &desc);
/* This method is only allowed with surfaces that are render targets, or offscreen plain surfaces
* in D3DPOOL_DEFAULT
*/
if(!(usage & WINED3DUSAGE_RENDERTARGET) && (pool != D3DPOOL_DEFAULT || restype != D3DRTYPE_SURFACE)) {
LeaveCriticalSection(&d3d9_cs);
WARN("Surface is not a render target, or not a stand-alone D3DPOOL_DEFAULT surface\n");
return D3DERR_INVALIDCALL;
}
/* Colorfill can only be used on rendertarget surfaces, or offscreen plain surfaces in D3DPOOL_DEFAULT */
/* Note: D3DRECT is compatible with WINED3DRECT */
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DDevice_ColorFill(This->WineD3DDevice, surface->wineD3DSurface, (CONST WINED3DRECT*)pRect, color);
LeaveCriticalSection(&d3d9_cs);
return hr;
......@@ -828,9 +830,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateOffscreenPlainSurface(LPDIREC
Why, their always lockable?
should I change the usage to dynamic?
*/
EnterCriticalSection(&d3d9_cs);
hr = IDirect3DDevice9Impl_CreateSurface(iface,Width,Height,Format,TRUE/*Loackable*/,FALSE/*Discard*/,0/*Level*/ , ppSurface,D3DRTYPE_SURFACE, 0/*Usage (undefined/none)*/,(WINED3DPOOL) Pool,D3DMULTISAMPLE_NONE,0/*MultisampleQuality*/,pSharedHandle);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
......@@ -958,10 +959,16 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetTransform(LPDIRECT3DDEVICE9EX if
static HRESULT WINAPI IDirect3DDevice9Impl_GetTransform(LPDIRECT3DDEVICE9EX iface, D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n" , This);
EnterCriticalSection(&d3d9_cs);
/* Note: D3DMATRIX is compatible with WINED3DMATRIX */
return IWineD3DDevice_GetTransform(This->WineD3DDevice, State, (WINED3DMATRIX*) pMatrix);
hr = IWineD3DDevice_GetTransform(This->WineD3DDevice, State, (WINED3DMATRIX*) pMatrix);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
static HRESULT WINAPI IDirect3DDevice9Impl_MultiplyTransform(LPDIRECT3DDEVICE9EX iface, D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix) {
......@@ -1519,21 +1526,19 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetFVF(LPDIRECT3DDEVICE9EX iface, DWO
}
EnterCriticalSection(&d3d9_cs);
decl = getConvertedDecl(This, FVF);
LeaveCriticalSection(&d3d9_cs);
if (!decl)
{
/* Any situation when this should happen, except out of memory? */
ERR("Failed to create a converted vertex declaration\n");
LeaveCriticalSection(&d3d9_cs);
return D3DERR_DRIVERINTERNALERROR;
}
hr = IDirect3DDevice9Impl_SetVertexDeclaration(iface, decl);
if (FAILED(hr)) ERR("Failed to set vertex declaration\n");
LeaveCriticalSection(&d3d9_cs);
return hr;
}
......
......@@ -165,7 +165,10 @@ static HRESULT WINAPI IDirect3D9Impl_GetAdapterDisplayMode(LPDIRECT3D9EX iface,
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
HRESULT hr;
EnterCriticalSection(&d3d9_cs);
hr = IWineD3D_GetAdapterDisplayMode(This->WineD3D, Adapter, (WINED3DDISPLAYMODE *) pMode);
LeaveCriticalSection(&d3d9_cs);
if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format);
return hr;
......
......@@ -239,9 +239,11 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateIndexBuffer(LPDIRECT3DDEVICE9EX iface,
object->lpVtbl = &Direct3DIndexBuffer9_Vtbl;
object->ref = 1;
TRACE("Calling wined3d create index buffer\n");
EnterCriticalSection(&d3d9_cs);
hrc = IWineD3DDevice_CreateIndexBuffer(This->WineD3DDevice, Length, Usage & WINED3DUSAGE_MASK,
wined3dformat_from_d3dformat(Format), (WINED3DPOOL)Pool, &object->wineD3DIndexBuffer,
pSharedHandle, (IUnknown *)object);
LeaveCriticalSection(&d3d9_cs);
if (hrc != D3D_OK) {
/* free up object */
......
......@@ -205,8 +205,15 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(LPDIRECT3DDEVICE9EX
HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT Register, float* pConstantData, UINT Vector4fCount) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n", This);
return IWineD3DDevice_GetPixelShaderConstantF(This->WineD3DDevice, Register, pConstantData, Vector4fCount);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DDevice_GetPixelShaderConstantF(This->WineD3DDevice, Register, pConstantData, Vector4fCount);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantI(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST int* pConstantData, UINT Vector4iCount) {
......
......@@ -74,8 +74,15 @@ static ULONG WINAPI IDirect3DSwapChain9Impl_Release(LPDIRECT3DSWAPCHAIN9 iface)
/* IDirect3DSwapChain9 parts follow: */
static HRESULT WINAPI IDirect3DSwapChain9Impl_Present(LPDIRECT3DSWAPCHAIN9 iface, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion, DWORD dwFlags) {
IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n", This);
return IWineD3DSwapChain_Present(This->wineD3DSwapChain, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, dwFlags);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DSwapChain_Present(This->wineD3DSwapChain, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, dwFlags);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
static HRESULT WINAPI IDirect3DSwapChain9Impl_GetFrontBufferData(LPDIRECT3DSWAPCHAIN9 iface, IDirect3DSurface9* pDestSurface) {
......
......@@ -87,8 +87,15 @@ static HRESULT WINAPI IDirect3DVertexBuffer9Impl_GetDevice(LPDIRECT3DVERTEXBUFFE
static HRESULT WINAPI IDirect3DVertexBuffer9Impl_SetPrivateData(LPDIRECT3DVERTEXBUFFER9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n", This);
return IWineD3DBuffer_SetPrivateData(This->wineD3DVertexBuffer, refguid, pData, SizeOfData, Flags);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DBuffer_SetPrivateData(This->wineD3DVertexBuffer, refguid, pData, SizeOfData, Flags);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
static HRESULT WINAPI IDirect3DVertexBuffer9Impl_GetPrivateData(LPDIRECT3DVERTEXBUFFER9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
......
......@@ -72,7 +72,9 @@ static ULONG WINAPI IDirect3DVolume9Impl_Release(LPDIRECT3DVOLUME9 iface) {
TRACE("(%p) : ReleaseRef to %d\n", This, ref);
if (ref == 0) {
EnterCriticalSection(&d3d9_cs);
IWineD3DVolume_Release(This->wineD3DVolume);
LeaveCriticalSection(&d3d9_cs);
HeapFree(GetProcessHeap(), 0, This);
}
......@@ -85,28 +87,62 @@ static HRESULT WINAPI IDirect3DVolume9Impl_GetDevice(LPDIRECT3DVOLUME9 iface, ID
IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface;
IWineD3DDevice *myDevice = NULL;
TRACE("iface %p, ppDevice %p\n", iface, ppDevice);
EnterCriticalSection(&d3d9_cs);
IWineD3DVolume_GetDevice(This->wineD3DVolume, &myDevice);
IWineD3DDevice_GetParent(myDevice, (IUnknown **)ppDevice);
IWineD3DDevice_Release(myDevice);
LeaveCriticalSection(&d3d9_cs);
return D3D_OK;
}
static HRESULT WINAPI IDirect3DVolume9Impl_SetPrivateData(LPDIRECT3DVOLUME9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n", This);
return IWineD3DVolume_SetPrivateData(This->wineD3DVolume, refguid, pData, SizeOfData, Flags);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DVolume_SetPrivateData(This->wineD3DVolume, refguid, pData, SizeOfData, Flags);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
static HRESULT WINAPI IDirect3DVolume9Impl_GetPrivateData(LPDIRECT3DVOLUME9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n", This);
return IWineD3DVolume_GetPrivateData(This->wineD3DVolume, refguid, pData, pSizeOfData);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DVolume_GetPrivateData(This->wineD3DVolume, refguid, pData, pSizeOfData);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
static HRESULT WINAPI IDirect3DVolume9Impl_FreePrivateData(LPDIRECT3DVOLUME9 iface, REFGUID refguid) {
IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n", This);
return IWineD3DVolume_FreePrivateData(This->wineD3DVolume, refguid);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DVolume_FreePrivateData(This->wineD3DVolume, refguid);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
static HRESULT WINAPI IDirect3DVolume9Impl_GetContainer(LPDIRECT3DVOLUME9 iface, REFIID riid, void** ppContainer) {
......@@ -147,8 +183,12 @@ static HRESULT WINAPI IDirect3DVolume9Impl_GetDesc(LPDIRECT3DVOLUME9 iface, D3DV
wined3ddesc.Height = &pDesc->Height;
wined3ddesc.Depth = &pDesc->Depth;
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DVolume_GetDesc(This->wineD3DVolume, &wined3ddesc);
LeaveCriticalSection(&d3d9_cs);
if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(format);
return hr;
......@@ -156,14 +196,33 @@ static HRESULT WINAPI IDirect3DVolume9Impl_GetDesc(LPDIRECT3DVOLUME9 iface, D3DV
static HRESULT WINAPI IDirect3DVolume9Impl_LockBox(LPDIRECT3DVOLUME9 iface, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) {
IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface;
HRESULT hr;
TRACE("(%p) relay %p %p %p %d\n", This, This->wineD3DVolume, pLockedVolume, pBox, Flags);
return IWineD3DVolume_LockBox(This->wineD3DVolume, (WINED3DLOCKED_BOX *)pLockedVolume, (CONST WINED3DBOX *)pBox, Flags);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DVolume_LockBox(This->wineD3DVolume, (WINED3DLOCKED_BOX *)pLockedVolume,
(const WINED3DBOX *)pBox, Flags);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
static HRESULT WINAPI IDirect3DVolume9Impl_UnlockBox(LPDIRECT3DVOLUME9 iface) {
IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface;
HRESULT hr;
TRACE("(%p) relay %p\n", This, This->wineD3DVolume);
return IWineD3DVolume_UnlockBox(This->wineD3DVolume);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DVolume_UnlockBox(This->wineD3DVolume);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
const IDirect3DVolume9Vtbl Direct3DVolume9_Vtbl =
......
......@@ -58,7 +58,9 @@ static ULONG WINAPI IDirect3DVolumeTexture9Impl_Release(LPDIRECT3DVOLUMETEXTURE9
TRACE("(%p) : ReleaseRef to %d\n", This, ref);
if (ref == 0) {
EnterCriticalSection(&d3d9_cs);
IWineD3DVolumeTexture_Destroy(This->wineD3DVolumeTexture, D3D9CB_DestroyVolume);
LeaveCriticalSection(&d3d9_cs);
IDirect3DDevice9Ex_Release(This->parentDevice);
HeapFree(GetProcessHeap(), 0, This);
}
......@@ -87,81 +89,192 @@ static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetDevice(LPDIRECT3DVOLUMETEXT
static HRESULT WINAPI IDirect3DVolumeTexture9Impl_SetPrivateData(LPDIRECT3DVOLUMETEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n", This);
return IWineD3DVolumeTexture_SetPrivateData(This->wineD3DVolumeTexture, refguid, pData, SizeOfData, Flags);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DVolumeTexture_SetPrivateData(This->wineD3DVolumeTexture, refguid, pData, SizeOfData, Flags);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetPrivateData(LPDIRECT3DVOLUMETEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n", This);
return IWineD3DVolumeTexture_GetPrivateData(This->wineD3DVolumeTexture, refguid, pData, pSizeOfData);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DVolumeTexture_GetPrivateData(This->wineD3DVolumeTexture, refguid, pData, pSizeOfData);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
static HRESULT WINAPI IDirect3DVolumeTexture9Impl_FreePrivateData(LPDIRECT3DVOLUMETEXTURE9 iface, REFGUID refguid) {
IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n", This);
return IWineD3DVolumeTexture_FreePrivateData(This->wineD3DVolumeTexture, refguid);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DVolumeTexture_FreePrivateData(This->wineD3DVolumeTexture, refguid);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
static DWORD WINAPI IDirect3DVolumeTexture9Impl_SetPriority(LPDIRECT3DVOLUMETEXTURE9 iface, DWORD PriorityNew) {
IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
DWORD priority;
TRACE("(%p) Relay\n", This);
return IWineD3DVolumeTexture_SetPriority(This->wineD3DVolumeTexture, PriorityNew);
EnterCriticalSection(&d3d9_cs);
priority = IWineD3DVolumeTexture_SetPriority(This->wineD3DVolumeTexture, PriorityNew);
LeaveCriticalSection(&d3d9_cs);
return priority;
}
static DWORD WINAPI IDirect3DVolumeTexture9Impl_GetPriority(LPDIRECT3DVOLUMETEXTURE9 iface) {
IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
DWORD priority;
TRACE("(%p) Relay\n", This);
return IWineD3DVolumeTexture_GetPriority(This->wineD3DVolumeTexture);
EnterCriticalSection(&d3d9_cs);
priority = IWineD3DVolumeTexture_GetPriority(This->wineD3DVolumeTexture);
LeaveCriticalSection(&d3d9_cs);
return priority;
}
static void WINAPI IDirect3DVolumeTexture9Impl_PreLoad(LPDIRECT3DVOLUMETEXTURE9 iface) {
IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d9_cs);
IWineD3DVolumeTexture_PreLoad(This->wineD3DVolumeTexture);
LeaveCriticalSection(&d3d9_cs);
}
static D3DRESOURCETYPE WINAPI IDirect3DVolumeTexture9Impl_GetType(LPDIRECT3DVOLUMETEXTURE9 iface) {
IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
D3DRESOURCETYPE type;
TRACE("(%p) Relay\n", This);
return IWineD3DVolumeTexture_GetType(This->wineD3DVolumeTexture);
EnterCriticalSection(&d3d9_cs);
type = IWineD3DVolumeTexture_GetType(This->wineD3DVolumeTexture);
LeaveCriticalSection(&d3d9_cs);
return type;
}
/* IDirect3DVolumeTexture9 IDirect3DBaseTexture9 Interface follow: */
static DWORD WINAPI IDirect3DVolumeTexture9Impl_SetLOD(LPDIRECT3DVOLUMETEXTURE9 iface, DWORD LODNew) {
IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
DWORD lod;
TRACE("(%p) Relay\n", This);
return IWineD3DVolumeTexture_SetLOD(This->wineD3DVolumeTexture, LODNew);
EnterCriticalSection(&d3d9_cs);
lod = IWineD3DVolumeTexture_SetLOD(This->wineD3DVolumeTexture, LODNew);
LeaveCriticalSection(&d3d9_cs);
return lod;
}
static DWORD WINAPI IDirect3DVolumeTexture9Impl_GetLOD(LPDIRECT3DVOLUMETEXTURE9 iface) {
IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
DWORD lod;
TRACE("(%p) Relay\n", This);
return IWineD3DVolumeTexture_GetLOD(This->wineD3DVolumeTexture);
EnterCriticalSection(&d3d9_cs);
lod = IWineD3DVolumeTexture_GetLOD(This->wineD3DVolumeTexture);
LeaveCriticalSection(&d3d9_cs);
return lod;
}
static DWORD WINAPI IDirect3DVolumeTexture9Impl_GetLevelCount(LPDIRECT3DVOLUMETEXTURE9 iface) {
IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
DWORD level_count;
TRACE("(%p) Relay\n", This);
return IWineD3DVolumeTexture_GetLevelCount(This->wineD3DVolumeTexture);
EnterCriticalSection(&d3d9_cs);
level_count = IWineD3DVolumeTexture_GetLevelCount(This->wineD3DVolumeTexture);
LeaveCriticalSection(&d3d9_cs);
return level_count;
}
static HRESULT WINAPI IDirect3DVolumeTexture9Impl_SetAutoGenFilterType(LPDIRECT3DVOLUMETEXTURE9 iface, D3DTEXTUREFILTERTYPE FilterType) {
IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n", This);
return IWineD3DVolumeTexture_SetAutoGenFilterType(This->wineD3DVolumeTexture, (WINED3DTEXTUREFILTERTYPE) FilterType);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DVolumeTexture_SetAutoGenFilterType(This->wineD3DVolumeTexture, (WINED3DTEXTUREFILTERTYPE) FilterType);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
static D3DTEXTUREFILTERTYPE WINAPI IDirect3DVolumeTexture9Impl_GetAutoGenFilterType(LPDIRECT3DVOLUMETEXTURE9 iface) {
IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
D3DTEXTUREFILTERTYPE filter_type;
TRACE("(%p) Relay\n", This);
return (D3DTEXTUREFILTERTYPE) IWineD3DVolumeTexture_GetAutoGenFilterType(This->wineD3DVolumeTexture);
EnterCriticalSection(&d3d9_cs);
filter_type = (D3DTEXTUREFILTERTYPE)IWineD3DVolumeTexture_GetAutoGenFilterType(This->wineD3DVolumeTexture);
LeaveCriticalSection(&d3d9_cs);
return filter_type;
}
static void WINAPI IDirect3DVolumeTexture9Impl_GenerateMipSubLevels(LPDIRECT3DVOLUMETEXTURE9 iface) {
IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d9_cs);
IWineD3DVolumeTexture_GenerateMipSubLevels(This->wineD3DVolumeTexture);
LeaveCriticalSection(&d3d9_cs);
}
/* IDirect3DVolumeTexture9 Interface follow: */
......@@ -184,8 +297,12 @@ static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetLevelDesc(LPDIRECT3DVOLUMET
wined3ddesc.Height = &pDesc->Height;
wined3ddesc.Depth = &pDesc->Depth;
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DVolumeTexture_GetLevelDesc(This->wineD3DVolumeTexture, Level, &wined3ddesc);
LeaveCriticalSection(&d3d9_cs);
if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(format);
return hr;
......@@ -198,30 +315,63 @@ static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetVolumeLevel(LPDIRECT3DVOLUM
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d9_cs);
hrc = IWineD3DVolumeTexture_GetVolumeLevel(This->wineD3DVolumeTexture, Level, &myVolume);
if (hrc == D3D_OK && NULL != ppVolumeLevel) {
IWineD3DVolumeTexture_GetParent(myVolume, (IUnknown **)ppVolumeLevel);
IWineD3DVolumeTexture_Release(myVolume);
}
LeaveCriticalSection(&d3d9_cs);
return hrc;
}
static HRESULT WINAPI IDirect3DVolumeTexture9Impl_LockBox(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) {
IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay %p %p %p %d\n", This, This->wineD3DVolumeTexture, pLockedVolume, pBox,Flags);
return IWineD3DVolumeTexture_LockBox(This->wineD3DVolumeTexture, Level, (WINED3DLOCKED_BOX *)pLockedVolume, (CONST WINED3DBOX *)pBox, Flags);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DVolumeTexture_LockBox(This->wineD3DVolumeTexture, Level, (WINED3DLOCKED_BOX *)pLockedVolume,
(const WINED3DBOX *)pBox, Flags);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
static HRESULT WINAPI IDirect3DVolumeTexture9Impl_UnlockBox(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level) {
IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay %p %d\n", This, This->wineD3DVolumeTexture, Level);
return IWineD3DVolumeTexture_UnlockBox(This->wineD3DVolumeTexture, Level);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DVolumeTexture_UnlockBox(This->wineD3DVolumeTexture, Level);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
static HRESULT WINAPI IDirect3DVolumeTexture9Impl_AddDirtyBox(LPDIRECT3DVOLUMETEXTURE9 iface, CONST D3DBOX* pDirtyBox) {
IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n", This);
return IWineD3DVolumeTexture_AddDirtyBox(This->wineD3DVolumeTexture, (CONST WINED3DBOX *)pDirtyBox);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DVolumeTexture_AddDirtyBox(This->wineD3DVolumeTexture, (CONST WINED3DBOX *)pDirtyBox);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
......@@ -277,9 +427,15 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVolumeTexture(LPDIRECT3DDEVICE9EX if
object->lpVtbl = &Direct3DVolumeTexture9_Vtbl;
object->ref = 1;
EnterCriticalSection(&d3d9_cs);
hrc = IWineD3DDevice_CreateVolumeTexture(This->WineD3DDevice, Width, Height, Depth, Levels,
Usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(Format), Pool,
&object->wineD3DVolumeTexture, pSharedHandle, (IUnknown *)object);
LeaveCriticalSection(&d3d9_cs);
if (hrc != D3D_OK) {
/* free up object */
......
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