Stefan Dösinger : wined3d: Catch nop SetTextureStageState calls.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Dec 20 12:24:46 CST 2006


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Tue Dec 19 23:12:26 2006 +0100

wined3d: Catch nop SetTextureStageState calls.

---

 dlls/wined3d/device.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index ce72266..3f1b1c4 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4355,7 +4355,7 @@ static void WINAPI IWineD3DDeviceImpl_Ap
  *****/
 static HRESULT WINAPI IWineD3DDeviceImpl_SetTextureStageState(IWineD3DDevice *iface, DWORD Stage, WINED3DTEXTURESTAGESTATETYPE Type, DWORD Value) {
     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    DWORD oldColorOp = This->updateStateBlock->textureState[Stage][WINED3DTSS_COLOROP];
+    DWORD oldValue = This->updateStateBlock->textureState[Stage][Type];
 
     /* FIXME: Handle 3d textures? What if TSS value set before set texture? Need to reapply all values? */
 
@@ -4376,6 +4376,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl
         return WINED3D_OK;
     }
 
+    /* Checked after the assignments to allow proper stateblock recording */
+    if(oldValue == Value) {
+        TRACE("App is setting the old value over, nothing to do\n");
+        return WINED3D_OK;
+    }
+
     if(Stage > This->stateBlock->lowest_disabled_stage &&
        StateTable[STATE_TEXTURESTAGE(0, Type)].representative == STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP)) {
         /* Colorop change above lowest disabled stage? That won't change anything in the gl setup
@@ -4387,7 +4393,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl
     if(Type == WINED3DTSS_COLOROP) {
         int i;
 
-        if(Value == WINED3DTOP_DISABLE && oldColorOp != WINED3DTOP_DISABLE) {
+        if(Value == WINED3DTOP_DISABLE && oldValue != WINED3DTOP_DISABLE) {
             /* Previously enabled stage disabled now. Make sure to dirtify all enabled stages above Stage,
              * they have to be disabled
              *
@@ -4399,7 +4405,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl
             }
             This->stateBlock->lowest_disabled_stage = Stage;
             TRACE("New lowest disabled: %d\n", Stage);
-        } else if(Value != WINED3DTOP_DISABLE && oldColorOp == WINED3DTOP_DISABLE) {
+        } else if(Value != WINED3DTOP_DISABLE && oldValue == WINED3DTOP_DISABLE) {
             /* Previously disabled stage enabled. Stages above it may need enabling
              * stage must be lowest_disabled_stage here, if it's bigger success is returned above,
              * and stages below the lowest disabled stage can't be enabled(because they are enabled already).




More information about the wine-cvs mailing list