wined3d: Execute all CS commands before changing swapchain window.

Fixes a race condition.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2018-06-11 12:05:06 +02:00 committed by Alexandre Julliard
parent 54b414b121
commit 49da19e51b
1 changed files with 5 additions and 0 deletions

View File

@ -135,6 +135,8 @@ void * CDECL wined3d_swapchain_get_parent(const struct wined3d_swapchain *swapch
void CDECL wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWND window) void CDECL wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWND window)
{ {
struct wined3d_device *device = swapchain->device;
if (!window) if (!window)
window = swapchain->device_window; window = swapchain->device_window;
if (window == swapchain->win_handle) if (window == swapchain->win_handle)
@ -142,6 +144,9 @@ void CDECL wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWN
TRACE("Setting swapchain %p window from %p to %p.\n", TRACE("Setting swapchain %p window from %p to %p.\n",
swapchain, swapchain->win_handle, window); swapchain, swapchain->win_handle, window);
device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
swapchain->win_handle = window; swapchain->win_handle = window;
} }