[12/19] WineD3D: Catch nop SetTextureStageState calls

Stefan Dösinger stefan at codeweavers.com
Tue Dec 19 16:12:26 CST 2006


Sent as a seperate patch to make catching regressions due to that easier. 
There shouldn't be any, but who knows.
-------------- next part --------------
From 5773593593814d1e341fc07cd1f41dd991ce024f Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Mon, 18 Dec 2006 11:39:15 +0100
Subject: [PATCH] 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 ef497c9..a624a64 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4351,7 +4351,7 @@ #endif
  *****/
 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? */
 
@@ -4372,6 +4372,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
@@ -4383,7 +4389,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
              *
@@ -4395,7 +4401,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).
-- 
1.4.2.4



More information about the wine-patches mailing list