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

Stefan Dösinger stefandoesinger at gmx.at
Tue Jan 2 15:55:31 CST 2007


From 3a86b38895056858ad9333b10ac3759a9edc465f Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Stefan_D=C3=B6singer?= <stefan at imac.local>
Date: Tue, 2 Jan 2007 20:33:47 +0100
Subject: [PATCH] WineD3D: Proper texture setup in LockRect

---
 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 d9ad860..22c2eda 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



More information about the wine-patches mailing list