Stefan Dösinger : wined3d: Implement IWineD3DTexture:: UnLoad.

Alexandre Julliard julliard at winehq.org
Mon Jan 14 09:33:20 CST 2008


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Tue Jan  8 15:33:24 2008 +0100

wined3d: Implement IWineD3DTexture::UnLoad.

---

 dlls/wined3d/texture.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 5cac35c..eb16700 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -143,7 +143,27 @@ static void WINAPI IWineD3DTextureImpl_PreLoad(IWineD3DTexture *iface) {
 }
 
 static void WINAPI IWineD3DTextureImpl_UnLoad(IWineD3DTexture *iface) {
-    IWineD3DResourceImpl_UnLoad((IWineD3DResource *)iface);
+    unsigned int i;
+    IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
+    IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
+    TRACE("(%p)\n", This);
+
+    /* Unload all the surfaces and reset the texture name. If UnLoad was called on the
+     * surface before, this one will be a NOP and vice versa. Unloading an unloaded
+     * surface is fine
+     */
+    for (i = 0; i < This->baseTexture.levels; i++) {
+        IWineD3DSurface_UnLoad(This->surfaces[i]);
+        IWineD3DSurface_SetGlTextureDesc(This->surfaces[i], 0, IWineD3DTexture_GetTextureDimensions(iface));
+    }
+
+    if(This->baseTexture.textureName) {
+        ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
+        ENTER_GL();
+        glDeleteTextures(1, &This->baseTexture.textureName);
+        This->baseTexture.textureName = 0;
+        LEAVE_GL();
+    }
 }
 
 static WINED3DRESOURCETYPE WINAPI IWineD3DTextureImpl_GetType(IWineD3DTexture *iface) {




More information about the wine-cvs mailing list