=?UTF-8?Q?Ri=C4=8Dardas=20Barkauskas=20?=: wined3d: Don' t leave leftover textures when destroying and creating dxgi swapchains.
Alexandre Julliard
julliard at winehq.org
Tue Sep 25 15:13:37 CDT 2012
Module: wine
Branch: master
Commit: 06a8cbcc352a8ad92413a30e8a3f00e2c76110a9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=06a8cbcc352a8ad92413a30e8a3f00e2c76110a9
Author: Ričardas Barkauskas <rbarkauskas at codeweavers.com>
Date: Mon Sep 24 21:01:18 2012 +0300
wined3d: Don't leave leftover textures when destroying and creating dxgi swapchains.
---
dlls/wined3d/swapchain.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index c4fc409..6be89af 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -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);
}
}
More information about the wine-cvs
mailing list