Commit 06a8cbcc authored by Ričardas Barkauskas's avatar Ričardas Barkauskas Committed by Alexandre Julliard

wined3d: Don't leave leftover textures when destroying and creating dxgi swapchains.

parent f98c896e
...@@ -42,6 +42,7 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain) ...@@ -42,6 +42,7 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain)
* is the last buffer to be destroyed, FindContext() depends on that. */ * is the last buffer to be destroyed, FindContext() depends on that. */
if (swapchain->front_buffer) if (swapchain->front_buffer)
{ {
if (swapchain->front_buffer->container.type == WINED3D_CONTAINER_SWAPCHAIN)
surface_set_container(swapchain->front_buffer, WINED3D_CONTAINER_NONE, NULL); surface_set_container(swapchain->front_buffer, WINED3D_CONTAINER_NONE, NULL);
if (wined3d_surface_decref(swapchain->front_buffer)) if (wined3d_surface_decref(swapchain->front_buffer))
WARN("Something's still holding the front buffer (%p).\n", swapchain->front_buffer); WARN("Something's still holding the front buffer (%p).\n", swapchain->front_buffer);
...@@ -54,6 +55,7 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain) ...@@ -54,6 +55,7 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain)
while (i--) while (i--)
{ {
if (swapchain->back_buffers[i]->container.type == WINED3D_CONTAINER_SWAPCHAIN)
surface_set_container(swapchain->back_buffers[i], WINED3D_CONTAINER_NONE, NULL); surface_set_container(swapchain->back_buffers[i], WINED3D_CONTAINER_NONE, NULL);
if (wined3d_surface_decref(swapchain->back_buffers[i])) if (wined3d_surface_decref(swapchain->back_buffers[i]))
WARN("Something's still holding back buffer %u (%p).\n", i, swapchain->back_buffers[i]); WARN("Something's still holding back buffer %u (%p).\n", i, swapchain->back_buffers[i]);
...@@ -917,6 +919,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, enum wined3d_ ...@@ -917,6 +919,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, enum wined3d_
goto err; goto err;
} }
if (swapchain->front_buffer->container.type == WINED3D_CONTAINER_NONE)
surface_set_container(swapchain->front_buffer, WINED3D_CONTAINER_SWAPCHAIN, swapchain); surface_set_container(swapchain->front_buffer, WINED3D_CONTAINER_SWAPCHAIN, swapchain);
if (surface_type == WINED3D_SURFACE_TYPE_OPENGL) if (surface_type == WINED3D_SURFACE_TYPE_OPENGL)
surface_modify_location(swapchain->front_buffer, SFLAG_INDRAWABLE, TRUE); surface_modify_location(swapchain->front_buffer, SFLAG_INDRAWABLE, TRUE);
...@@ -1025,7 +1028,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, enum wined3d_ ...@@ -1025,7 +1028,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, enum wined3d_
WARN("Failed to create back buffer %u, hr %#x.\n", i, hr); WARN("Failed to create back buffer %u, hr %#x.\n", i, hr);
goto err; goto err;
} }
if (swapchain->back_buffers[i]->container.type == WINED3D_CONTAINER_NONE)
surface_set_container(swapchain->back_buffers[i], WINED3D_CONTAINER_SWAPCHAIN, swapchain); surface_set_container(swapchain->back_buffers[i], WINED3D_CONTAINER_SWAPCHAIN, swapchain);
} }
} }
......
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