[5/13] WineD3D: Clean up sampler usage in UpdateSurface

Stefan Dösinger stefan at codeweavers.com
Tue Feb 20 15:44:45 CST 2007


-------------- next part --------------
From fb691960fa846da30580c2e313d65808ad98e03a Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Mon, 19 Feb 2007 17:16:00 +0100
Subject: [PATCH] WineD3D: Clean up sampler usage in UpdateSurface

UpdateSurface has to modify one gl texture unit to bind the texture to
load.  To restore the correct properties for drawing gl texture unit 0
is activated and dirtified.
---
 dlls/wined3d/device.c |   23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 07f91ce..c039798 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4701,8 +4701,6 @@ static HRESULT  WINAPI  IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
     int offset    = 0;
     int rowoffset = 0; /* how many bytes to add onto the end of a row to wraparound to the beginning of the next */
     glDescriptor *glDescription = NULL;
-    GLenum textureDimensions = GL_TEXTURE_2D;
-    IWineD3DBaseTexture *baseTexture;
 
     WINED3DSURFACE_DESC  winedesc;
 
@@ -4736,13 +4734,17 @@ static HRESULT  WINAPI  IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
         IWineD3DSurface_GetDesc(pDestinationSurface, &winedesc);
     }
 
+    ENTER_GL();
+    if (GL_SUPPORT(ARB_MULTITEXTURE)) {
+        GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB));
+        checkGLcall("glActiveTextureARB");
+    }
+
     /* Make sure the surface is loaded and up to date */
     IWineD3DSurface_PreLoad(pDestinationSurface);
 
     IWineD3DSurface_GetGlDesc(pDestinationSurface, &glDescription);
 
-    ENTER_GL();
-
     /* this needs to be done in lines if the sourceRect != the sourceWidth */
     srcWidth   = pSourceRect ? pSourceRect->right - pSourceRect->left   : srcSurfaceWidth;
     srcHeight  = pSourceRect ? pSourceRect->top   - pSourceRect->bottom : srcSurfaceHeight;
@@ -4847,19 +4849,12 @@ static HRESULT  WINAPI  IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
         }
      }
     checkGLcall("glTexSubImage2D");
-    ((IWineD3DSurfaceImpl *)pDestinationSurface)->Flags |= SFLAG_GLDIRTY;
-
-    /* I only need to look up baseTexture here, so it may be a good idea to hava a GL_TARGET ->
-     * GL_DIMENSIONS lookup, or maybe store the dimensions on the surface (but that's making the
-     * surface bigger than it needs to be hmm.. */
-    if (WINED3D_OK == IWineD3DSurface_GetContainer(pDestinationSurface, &IID_IWineD3DBaseTexture, (void **)&baseTexture)) {
-        textureDimensions = IWineD3DBaseTexture_GetTextureDimensions(baseTexture);
-        IWineD3DBaseTexture_Release(baseTexture);
-    }
 
-    glDisable(textureDimensions); /* This needs to be managed better.... */
     LEAVE_GL();
 
+    ((IWineD3DSurfaceImpl *)pDestinationSurface)->Flags |= SFLAG_GLDIRTY;
+    IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SAMPLER(0));
+
     return WINED3D_OK;
 }
 
-- 
1.4.4.3



More information about the wine-patches mailing list