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

wined3d: Send swapchain context destruction through the command stream.

parent df0f07bf
...@@ -27,6 +27,11 @@ ...@@ -27,6 +27,11 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
WINE_DECLARE_DEBUG_CHANNEL(fps); 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) static void swapchain_cleanup(struct wined3d_swapchain *swapchain)
{ {
HRESULT hr; HRESULT hr;
...@@ -60,11 +65,7 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain) ...@@ -60,11 +65,7 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain)
swapchain->back_buffers = NULL; swapchain->back_buffers = NULL;
} }
for (i = 0; i < swapchain->num_contexts; ++i) wined3d_cs_destroy_object(swapchain->device->cs, wined3d_swapchain_destroy_object, swapchain);
{
context_destroy(swapchain->device, swapchain->context[i]);
}
HeapFree(GetProcessHeap(), 0, swapchain->context);
/* Restore the screen resolution if we rendered in fullscreen. /* Restore the screen resolution if we rendered in fullscreen.
* This will restore the screen resolution to what it was before creating * 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 ...@@ -925,7 +926,6 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
goto err; 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. /* 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. * 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 ...@@ -953,6 +953,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
hr = WINED3DERR_NOTAVAILABLE; hr = WINED3DERR_NOTAVAILABLE;
goto err; goto err;
} }
swapchain->num_contexts = 1;
if (wined3d_settings.offscreen_rendering_mode != ORM_FBO if (wined3d_settings.offscreen_rendering_mode != ORM_FBO
&& (!desc->enable_auto_depth_stencil && (!desc->enable_auto_depth_stencil
...@@ -1051,15 +1052,7 @@ err: ...@@ -1051,15 +1052,7 @@ err:
HeapFree(GetProcessHeap(), 0, swapchain->back_buffers); HeapFree(GetProcessHeap(), 0, swapchain->back_buffers);
} }
if (swapchain->context) wined3d_cs_destroy_object(swapchain->device->cs, wined3d_swapchain_destroy_object, swapchain);
{
if (swapchain->context[0])
{
context_destroy(device, swapchain->context[0]);
swapchain->num_contexts = 0;
}
HeapFree(GetProcessHeap(), 0, swapchain->context);
}
if (swapchain->front_buffer) if (swapchain->front_buffer)
{ {
......
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