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

This commit is contained in:
Ričardas Barkauskas 2012-09-24 21:01:18 +03:00 committed by Alexandre Julliard
parent f98c896e8a
commit 06a8cbcc35

View File

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