mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 14:03:40 +00:00
d3d9: Hold the lock in swapchain methods.
This commit is contained in:
parent
35c5c4528f
commit
ef5e5300e3
|
@ -62,7 +62,9 @@ static ULONG WINAPI IDirect3DSwapChain9Impl_Release(LPDIRECT3DSWAPCHAIN9 iface)
|
|||
if (ref == 0) {
|
||||
if (This->parentDevice) IUnknown_Release(This->parentDevice);
|
||||
if (!This->isImplicit) {
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
IWineD3DSwapChain_Destroy(This->wineD3DSwapChain, D3D9CB_DestroyRenderTarget);
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
}
|
||||
|
@ -78,8 +80,13 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_Present(LPDIRECT3DSWAPCHAIN9 iface
|
|||
|
||||
static HRESULT WINAPI IDirect3DSwapChain9Impl_GetFrontBufferData(LPDIRECT3DSWAPCHAIN9 iface, IDirect3DSurface9* pDestSurface) {
|
||||
IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
return IWineD3DSwapChain_GetFrontBufferData(This->wineD3DSwapChain, ((IDirect3DSurface9Impl *)pDestSurface)->wineD3DSurface);
|
||||
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
hr = IWineD3DSwapChain_GetFrontBufferData(This->wineD3DSwapChain, ((IDirect3DSurface9Impl *)pDestSurface)->wineD3DSurface);
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3DSwapChain9Impl_GetBackBuffer(LPDIRECT3DSWAPCHAIN9 iface, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer) {
|
||||
|
@ -89,25 +96,37 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetBackBuffer(LPDIRECT3DSWAPCHAIN9
|
|||
|
||||
TRACE("(%p) Relay\n", This);
|
||||
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
hrc = IWineD3DSwapChain_GetBackBuffer(This->wineD3DSwapChain, iBackBuffer, (WINED3DBACKBUFFER_TYPE) Type, &mySurface);
|
||||
if (hrc == D3D_OK && NULL != mySurface) {
|
||||
IWineD3DSurface_GetParent(mySurface, (IUnknown **)ppBackBuffer);
|
||||
IWineD3DSurface_Release(mySurface);
|
||||
}
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
/* Do not touch the **ppBackBuffer pointer otherwise! (see device test) */
|
||||
return hrc;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3DSwapChain9Impl_GetRasterStatus(LPDIRECT3DSWAPCHAIN9 iface, D3DRASTER_STATUS* pRasterStatus) {
|
||||
IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
return IWineD3DSwapChain_GetRasterStatus(This->wineD3DSwapChain, (WINED3DRASTER_STATUS *) pRasterStatus);
|
||||
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
hr = IWineD3DSwapChain_GetRasterStatus(This->wineD3DSwapChain, (WINED3DRASTER_STATUS *) pRasterStatus);
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3DSwapChain9Impl_GetDisplayMode(LPDIRECT3DSWAPCHAIN9 iface, D3DDISPLAYMODE* pMode) {
|
||||
IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
return IWineD3DSwapChain_GetDisplayMode(This->wineD3DSwapChain, (WINED3DDISPLAYMODE *) pMode);
|
||||
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
hr = IWineD3DSwapChain_GetDisplayMode(This->wineD3DSwapChain, (WINED3DDISPLAYMODE *) pMode);
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3DSwapChain9Impl_GetDevice(LPDIRECT3DSWAPCHAIN9 iface, IDirect3DDevice9** ppDevice) {
|
||||
|
@ -117,11 +136,13 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetDevice(LPDIRECT3DSWAPCHAIN9 ifa
|
|||
|
||||
TRACE("(%p) Relay\n", This);
|
||||
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
hrc = IWineD3DSwapChain_GetDevice(This->wineD3DSwapChain, &device);
|
||||
if (hrc == D3D_OK && NULL != device) {
|
||||
IWineD3DDevice_GetParent(device, (IUnknown **)ppDevice);
|
||||
IWineD3DDevice_Release(device);
|
||||
}
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
return hrc;
|
||||
}
|
||||
|
||||
|
@ -132,7 +153,9 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetPresentParameters(LPDIRECT3DSWA
|
|||
|
||||
TRACE("(%p)->(%p): Relay\n", This, pPresentationParameters);
|
||||
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
hr = IWineD3DSwapChain_GetPresentParameters(This->wineD3DSwapChain, &winePresentParameters);
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
|
||||
pPresentationParameters->BackBufferWidth = winePresentParameters.BackBufferWidth;
|
||||
pPresentationParameters->BackBufferHeight = winePresentParameters.BackBufferHeight;
|
||||
|
@ -205,7 +228,9 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE
|
|||
localParameters.FullScreen_RefreshRateInHz = pPresentationParameters->FullScreen_RefreshRateInHz;
|
||||
localParameters.PresentationInterval = pPresentationParameters->PresentationInterval;
|
||||
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
hrc = IWineD3DDevice_CreateAdditionalSwapChain(This->WineD3DDevice, &localParameters, &object->wineD3DSwapChain, (IUnknown*)object, D3D9CB_CreateRenderTarget, D3D9CB_CreateDepthStencilSurface);
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
|
||||
pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
|
||||
pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight;
|
||||
|
@ -242,6 +267,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetSwapChain(LPDIRECT3DDEVICE9 iface, UINT
|
|||
|
||||
TRACE("(%p) Relay\n", This);
|
||||
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
hrc = IWineD3DDevice_GetSwapChain(This->WineD3DDevice, iSwapChain, &swapchain);
|
||||
if (hrc == D3D_OK && NULL != swapchain) {
|
||||
IWineD3DSwapChain_GetParent(swapchain, (IUnknown **)pSwapChain);
|
||||
|
@ -249,11 +275,17 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetSwapChain(LPDIRECT3DDEVICE9 iface, UINT
|
|||
} else {
|
||||
*pSwapChain = NULL;
|
||||
}
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
return hrc;
|
||||
}
|
||||
|
||||
UINT WINAPI IDirect3DDevice9Impl_GetNumberOfSwapChains(LPDIRECT3DDEVICE9 iface) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
UINT ret;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
return IWineD3DDevice_GetNumberOfSwapChains(This->WineD3DDevice);
|
||||
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
ret = IWineD3DDevice_GetNumberOfSwapChains(This->WineD3DDevice);
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue