Stefan Dösinger : wined3d: Tear down the dummy textures before resetting.

Alexandre Julliard julliard at winehq.org
Wed Feb 6 07:27:48 CST 2008


Module: wine
Branch: master
Commit: cb6de00c86fd958aeab624088325ca7a1bd32002
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=cb6de00c86fd958aeab624088325ca7a1bd32002

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Tue Feb  5 21:56:46 2008 +0100

wined3d: Tear down the dummy textures before resetting.

In theory the opengl library should release the gl resources when we
destroy the context, and the stateblock reset will recreate the dummy
textures, but I think it is cleaner to do this explicitly.

---

 dlls/wined3d/device.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 7b924da..10d11b8 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -6777,6 +6777,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice* iface, WINED3DPRE
     WINED3DDISPLAYMODE mode;
     IWineD3DBaseShaderImpl *shader;
     IWineD3DSurfaceImpl *target;
+    UINT i;
     TRACE("(%p)\n", This);
 
     hr = IWineD3DDevice_GetSwapChain(iface, 0, (IWineD3DSwapChain **) &swapchain);
@@ -6839,14 +6840,21 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice* iface, WINED3DPRE
         This->shader_backend->shader_destroy((IWineD3DBaseShader *) shader);
     }
 
+    ENTER_GL();
     if(This->depth_blt_texture) {
-        ENTER_GL();
         glDeleteTextures(1, &This->depth_blt_texture);
-        LEAVE_GL();
         This->depth_blt_texture = 0;
     }
     This->shader_backend->shader_destroy_depth_blt(iface);
 
+    for (i = 0; i < GL_LIMITS(textures); i++) {
+        /* The stateblock initialization below will recreate them */
+        glDeleteTextures(1, &This->dummyTextureName[i]);
+        checkGLcall("glDeleteTextures(1, &This->dummyTextureName[i])");
+        This->dummyTextureName[i] = 0;
+    }
+    LEAVE_GL();
+
     while(This->numContexts) {
         DestroyContext(This, This->contexts[0]);
     }




More information about the wine-cvs mailing list