[14/15] WineD3D: Do not activate / deactivate texture dimensions twice.

Stefan Dösinger stefan at codeweavers.com
Wed Jan 10 04:44:55 CST 2007


If STATE_SAMPLER(X) is dirty, then STATE_TEXTURESTAGE(X, WINED3DTSS_COLOROP) 
does not have to activate the texture dimensions because the sampler will do 
it again, and vice versa.
-------------- next part --------------
From 2a9353ede38d1e581d3627f376e6c595c1cf6400 Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Sun, 7 Jan 2007 14:18:54 +0100
Subject: [PATCH] WineD3D: Make sure not to activate / deactivate texture dimensions twice

per draw
---
 dlls/wined3d/state.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index b8b547e..5992457 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -1444,7 +1444,12 @@ static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock) {
         return;
     }
 
-    if (mapped_stage != -1) activate_dimensions(stage, stateblock);
+    /* The sampler will also activate the correct texture dimensions, so no need to do it here
+     * if the sampler for this stage is dirty
+     */
+    if(!isStateDirty(stateblock->wineD3DDevice, STATE_SAMPLER(stage))) {
+        if (mapped_stage != -1) activate_dimensions(stage, stateblock);
+    }
 
     /* Set the texture combiners */
     if (GL_SUPPORT(NV_REGISTER_COMBINERS)) {
@@ -1820,7 +1825,9 @@ static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock) {
             glEnable(stateblock->textureDimensions[sampler]);
             checkGLcall("glEnable(stateblock->textureDimensions[sampler])");
         } else if(sampler < stateblock->lowest_disabled_stage) {
-            activate_dimensions(sampler, stateblock);
+            if(!isStateDirty(stateblock->wineD3DDevice, STATE_TEXTURESTAGE(sampler, WINED3DTSS_COLOROP))) {
+                activate_dimensions(sampler, stateblock);
+            }
 
             if(stateblock->renderState[WINED3DRS_COLORKEYENABLE] && sampler == 0) {
                 /* If color keying is enabled update the alpha test, it depends on the existence
@@ -1831,10 +1838,10 @@ static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock) {
         }
     } else if(sampler < GL_LIMITS(texture_stages)) {
         if(sampler < stateblock->lowest_disabled_stage) {
-            /* TODO: Check if the colorop is dirty to do that job
-             * TODO: What should I do with pixel shaders here ???
-             */
-            activate_dimensions(sampler, stateblock);
+            /* TODO: What should I do with pixel shaders here ??? */
+            if(!isStateDirty(stateblock->wineD3DDevice, STATE_TEXTURESTAGE(sampler, WINED3DTSS_COLOROP))) {
+                activate_dimensions(sampler, stateblock);
+            }
         } /* Otherwise tex_colorop disables the stage */
         glBindTexture(GL_TEXTURE_1D, stateblock->wineD3DDevice->dummyTextureName[sampler]);
         checkGLcall("glBindTexture(GL_TEXTURE_1D, stateblock->wineD3DDevice->dummyTextureName[sampler])");
-- 
1.4.4.3



More information about the wine-patches mailing list