Henri Verbeet : wined3d: Add a function to destroy dummy textures.

Alexandre Julliard julliard at winehq.org
Fri Dec 18 10:49:06 CST 2009


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Dec 17 19:14:34 2009 +0100

wined3d: Add a function to destroy dummy textures.

The next patch uses this.

---

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

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index d09655d..3dfc4e9 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1368,6 +1368,17 @@ static void create_dummy_textures(IWineD3DDeviceImpl *This)
     LEAVE_GL();
 }
 
+/* Context activation is done by the caller. */
+static void destroy_dummy_textures(IWineD3DDeviceImpl *device, const struct wined3d_gl_info *gl_info)
+{
+    ENTER_GL();
+    glDeleteTextures(gl_info->limits.textures, device->dummyTextureName);
+    checkGLcall("glDeleteTextures(gl_info->limits.textures, device->dummyTextureName)");
+    LEAVE_GL();
+
+    memset(device->dummyTextureName, 0, gl_info->limits.textures * sizeof(*device->dummyTextureName));
+}
+
 static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface,
         WINED3DPRESENT_PARAMETERS *pPresentationParameters)
 {
@@ -6240,7 +6251,6 @@ void delete_opengl_contexts(IWineD3DDevice *iface, IWineD3DSwapChain *swapchain_
     IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *) swapchain_iface;
     const struct wined3d_gl_info *gl_info;
     struct wined3d_context *context;
-    UINT i;
     IWineD3DBaseShaderImpl *shader;
 
     context = context_acquire(This, NULL, CTXUSAGE_RESOURCELOAD);
@@ -6267,16 +6277,7 @@ void delete_opengl_contexts(IWineD3DDevice *iface, IWineD3DSwapChain *swapchain_
     This->blitter->free_private(iface);
     This->frag_pipe->free_private(iface);
     This->shader_backend->shader_free_private(iface);
-
-    ENTER_GL();
-    for (i = 0; i < This->adapter->gl_info.limits.textures; ++i)
-    {
-        /* Textures are recreated below */
-        glDeleteTextures(1, &This->dummyTextureName[i]);
-        checkGLcall("glDeleteTextures(1, &This->dummyTextureName[i])");
-        This->dummyTextureName[i] = 0;
-    }
-    LEAVE_GL();
+    destroy_dummy_textures(This, gl_info);
 
     context_release(context);
 




More information about the wine-cvs mailing list