[15/16] WineD3D: Select a proper texture unit in LockRect, and dirtify the state

Stefan Dösinger stefandoesinger at gmx.at
Mon Jan 1 18:40:28 CST 2007


Does not really belong to the other patches, but I stumbled uppon  
this. LockRect binds the texture to the selected texture unit. This  
patch selects unit 0 and marks sampler 0 dirty to force an update on  
the next draw.

-------------- next part --------------
From 3a4f69fa54b749abb18f3762b3da53b3b608c447 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Stefan_D=C3=B6singer?= <stefan at imac.local>
Date: Mon, 1 Jan 2007 18:50:10 +0100
Subject: [PATCH] WineD3D: Select a proper texture unit in LockRect and mark the sampler dirty

---
 dlls/wined3d/surface.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 96fc96e..a349c35 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -633,9 +633,16 @@ static HRESULT WINAPI IWineD3DSurfaceImp
                 This->Flags |= SFLAG_ACTIVELOCK; /* When this flag is set to true, loading the surface again won't free THis->resource.allocatedMemory */
                 /* TODO: make activeLock a bit more intelligent, maybe implement a method to purge the texture memory. */
 
-                /* Make sure that the texture is loaded */
-                IWineD3DSurface_PreLoad(iface); /* Make sure there is a texture to bind! */
-
+                /* Make sure that a proper texture unit is selected, bind the texture and dirtify the sampler to restore the texture on the next draw */
+                if (GL_SUPPORT(ARB_MULTITEXTURE)) {
+                    ENTER_GL();
+                    GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB));
+                    checkGLcall("glActiveTextureARB");
+                    LEAVE_GL();
+                }
+                IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, STATE_SAMPLER(0));
+                IWineD3DSurface_PreLoad(iface);
+                
                 surface_download_data(This);
             }
         } else { /* Nothing to do */
-- 
1.4.2.4

-------------- next part --------------



More information about the wine-patches mailing list