Commit 9042fbe1 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Lock wined3d mutex in wined3d_swapchain_present().

parent 3f69b7ec
...@@ -88,7 +88,6 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d8_swapchain_Present(IDirect3DSwapChai ...@@ -88,7 +88,6 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d8_swapchain_Present(IDirect3DSwapChai
{ {
struct d3d8_swapchain *swapchain = impl_from_IDirect3DSwapChain8(iface); struct d3d8_swapchain *swapchain = impl_from_IDirect3DSwapChain8(iface);
struct d3d8_device *device = impl_from_IDirect3DDevice8(swapchain->parent_device); struct d3d8_device *device = impl_from_IDirect3DDevice8(swapchain->parent_device);
HRESULT hr;
TRACE("iface %p, src_rect %s, dst_rect %s, dst_window_override %p, dirty_region %p.\n", TRACE("iface %p, src_rect %s, dst_rect %s, dst_window_override %p, dirty_region %p.\n",
iface, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect), dst_window_override, dirty_region); iface, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect), dst_window_override, dirty_region);
...@@ -99,12 +98,8 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d8_swapchain_Present(IDirect3DSwapChai ...@@ -99,12 +98,8 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d8_swapchain_Present(IDirect3DSwapChai
if (dirty_region) if (dirty_region)
FIXME("Ignoring dirty_region %p.\n", dirty_region); FIXME("Ignoring dirty_region %p.\n", dirty_region);
wined3d_mutex_lock(); return wined3d_swapchain_present(swapchain->wined3d_swapchain,
hr = wined3d_swapchain_present(swapchain->wined3d_swapchain,
src_rect, dst_rect, dst_window_override, swapchain->swap_interval, 0); src_rect, dst_rect, dst_window_override, swapchain->swap_interval, 0);
wined3d_mutex_unlock();
return hr;
} }
static HRESULT WINAPI d3d8_swapchain_GetBackBuffer(IDirect3DSwapChain8 *iface, static HRESULT WINAPI d3d8_swapchain_GetBackBuffer(IDirect3DSwapChain8 *iface,
......
...@@ -140,7 +140,6 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_swapchain_Present(IDirect3DSwapChai ...@@ -140,7 +140,6 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_swapchain_Present(IDirect3DSwapChai
{ {
struct d3d9_swapchain *swapchain = impl_from_IDirect3DSwapChain9Ex(iface); struct d3d9_swapchain *swapchain = impl_from_IDirect3DSwapChain9Ex(iface);
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(swapchain->parent_device); struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(swapchain->parent_device);
HRESULT hr;
TRACE("iface %p, src_rect %s, dst_rect %s, dst_window_override %p, dirty_region %p, flags %#x.\n", TRACE("iface %p, src_rect %s, dst_rect %s, dst_window_override %p, dirty_region %p, flags %#x.\n",
iface, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect), iface, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect),
...@@ -152,12 +151,8 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_swapchain_Present(IDirect3DSwapChai ...@@ -152,12 +151,8 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_swapchain_Present(IDirect3DSwapChai
if (dirty_region) if (dirty_region)
FIXME("Ignoring dirty_region %p.\n", dirty_region); FIXME("Ignoring dirty_region %p.\n", dirty_region);
wined3d_mutex_lock(); return wined3d_swapchain_present(swapchain->wined3d_swapchain,
hr = wined3d_swapchain_present(swapchain->wined3d_swapchain,
src_rect, dst_rect, dst_window_override, swapchain->swap_interval, flags); src_rect, dst_rect, dst_window_override, swapchain->swap_interval, flags);
wined3d_mutex_unlock();
return hr;
} }
static HRESULT WINAPI d3d9_swapchain_GetFrontBufferData(IDirect3DSwapChain9Ex *iface, IDirect3DSurface9 *surface) static HRESULT WINAPI d3d9_swapchain_GetFrontBufferData(IDirect3DSwapChain9Ex *iface, IDirect3DSurface9 *surface)
......
...@@ -602,7 +602,6 @@ static HRESULT STDMETHODCALLTYPE d3d11_swapchain_Present1(IDXGISwapChain1 *iface ...@@ -602,7 +602,6 @@ static HRESULT STDMETHODCALLTYPE d3d11_swapchain_Present1(IDXGISwapChain1 *iface
UINT sync_interval, UINT flags, const DXGI_PRESENT_PARAMETERS *present_parameters) UINT sync_interval, UINT flags, const DXGI_PRESENT_PARAMETERS *present_parameters)
{ {
struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain1(iface); struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain1(iface);
HRESULT hr;
TRACE("iface %p, sync_interval %u, flags %#x, present_parameters %p.\n", TRACE("iface %p, sync_interval %u, flags %#x, present_parameters %p.\n",
iface, sync_interval, flags, present_parameters); iface, sync_interval, flags, present_parameters);
...@@ -624,11 +623,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_swapchain_Present1(IDXGISwapChain1 *iface ...@@ -624,11 +623,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_swapchain_Present1(IDXGISwapChain1 *iface
if (present_parameters) if (present_parameters)
FIXME("Ignored present parameters %p.\n", present_parameters); FIXME("Ignored present parameters %p.\n", present_parameters);
wined3d_mutex_lock(); return wined3d_swapchain_present(swapchain->wined3d_swapchain, NULL, NULL, NULL, sync_interval, 0);
hr = wined3d_swapchain_present(swapchain->wined3d_swapchain, NULL, NULL, NULL, sync_interval, 0);
wined3d_mutex_unlock();
return hr;
} }
static BOOL STDMETHODCALLTYPE d3d11_swapchain_IsTemporaryMonoSupported(IDXGISwapChain1 *iface) static BOOL STDMETHODCALLTYPE d3d11_swapchain_IsTemporaryMonoSupported(IDXGISwapChain1 *iface)
......
...@@ -164,9 +164,12 @@ HRESULT CDECL wined3d_swapchain_present(struct wined3d_swapchain *swapchain, ...@@ -164,9 +164,12 @@ HRESULT CDECL wined3d_swapchain_present(struct wined3d_swapchain *swapchain,
if (flags) if (flags)
FIXME("Ignoring flags %#x.\n", flags); FIXME("Ignoring flags %#x.\n", flags);
wined3d_mutex_lock();
if (!swapchain->back_buffers) if (!swapchain->back_buffers)
{ {
WARN("Swapchain doesn't have a backbuffer, returning WINED3DERR_INVALIDCALL.\n"); WARN("Swapchain doesn't have a backbuffer, returning WINED3DERR_INVALIDCALL.\n");
wined3d_mutex_unlock();
return WINED3DERR_INVALIDCALL; return WINED3DERR_INVALIDCALL;
} }
...@@ -186,6 +189,8 @@ HRESULT CDECL wined3d_swapchain_present(struct wined3d_swapchain *swapchain, ...@@ -186,6 +189,8 @@ HRESULT CDECL wined3d_swapchain_present(struct wined3d_swapchain *swapchain,
wined3d_cs_emit_present(swapchain->device->cs, swapchain, src_rect, wined3d_cs_emit_present(swapchain->device->cs, swapchain, src_rect,
dst_rect, dst_window_override, swap_interval, flags); dst_rect, dst_window_override, swap_interval, flags);
wined3d_mutex_unlock();
return WINED3D_OK; return WINED3D_OK;
} }
......
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