wined3d: Send swapchain context destruction through the command stream.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2017-02-28 06:12:02 +01:00 committed by Alexandre Julliard
parent df0f07bfc5
commit cf4de1c498
1 changed files with 8 additions and 15 deletions

View File

@ -27,6 +27,11 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
WINE_DECLARE_DEBUG_CHANNEL(fps);
static void wined3d_swapchain_destroy_object(void *object)
{
swapchain_destroy_contexts(object);
}
static void swapchain_cleanup(struct wined3d_swapchain *swapchain)
{
HRESULT hr;
@ -60,11 +65,7 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain)
swapchain->back_buffers = NULL;
}
for (i = 0; i < swapchain->num_contexts; ++i)
{
context_destroy(swapchain->device, swapchain->context[i]);
}
HeapFree(GetProcessHeap(), 0, swapchain->context);
wined3d_cs_destroy_object(swapchain->device->cs, wined3d_swapchain_destroy_object, swapchain);
/* Restore the screen resolution if we rendered in fullscreen.
* This will restore the screen resolution to what it was before creating
@ -925,7 +926,6 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
hr = E_OUTOFMEMORY;
goto err;
}
swapchain->num_contexts = 1;
/* In WGL both color, depth and stencil are features of a pixel format. In case of D3D they are separate.
* You are able to add a depth + stencil surface at a later stage when you need it.
@ -953,6 +953,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
hr = WINED3DERR_NOTAVAILABLE;
goto err;
}
swapchain->num_contexts = 1;
if (wined3d_settings.offscreen_rendering_mode != ORM_FBO
&& (!desc->enable_auto_depth_stencil
@ -1051,15 +1052,7 @@ err:
HeapFree(GetProcessHeap(), 0, swapchain->back_buffers);
}
if (swapchain->context)
{
if (swapchain->context[0])
{
context_destroy(device, swapchain->context[0]);
swapchain->num_contexts = 0;
}
HeapFree(GetProcessHeap(), 0, swapchain->context);
}
wined3d_cs_destroy_object(swapchain->device->cs, wined3d_swapchain_destroy_object, swapchain);
if (swapchain->front_buffer)
{