[2/8] WineD3D: Catch NOP vertex declaration changes

Stefan Dösinger stefan at codeweavers.com
Wed Jan 3 17:07:00 CST 2007


From 5bd9f8708b0ed539358a219e4845573ca12fba9a Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Stefan_D=C3=B6singer?= <stefan at imac.local>
Date: Wed, 3 Jan 2007 01:12:25 +0100
Subject: [PATCH] WineD3D: Catch nop vertex decl changes

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

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index db35a07..ac3e62a 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2151,10 +2151,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl
     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
 
     /* Update the current state block */
-    This->updateStateBlock->fvf              = fvf;
     This->updateStateBlock->changed.fvf      = TRUE;
     This->updateStateBlock->set.fvf          = TRUE;
 
+    if(This->updateStateBlock->fvf == fvf) {
+        TRACE("Application is setting the old fvf over, nothing to do\n");
+        return WINED3D_OK;
+    }
+    
+    This->updateStateBlock->fvf              = fvf;
     TRACE("(%p) : FVF Shader FVF set to %x\n", This, fvf);
     IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VDECL);
     return WINED3D_OK;
@@ -3218,6 +3223,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl
 
     if (This->isRecordingState) {
         TRACE("Recording... not performing anything\n");
+        return WINED3D_OK;
+    } else if(pDecl == oldDecl) {
+        /* Checked after the assignment to allow proper stateblock recording */
+        TRACE("Application is setting the old declaration over, nothing to do\n");
+        return WINED3D_OK;
     }
 
     if (NULL != pDecl) {
@@ -5822,13 +5832,15 @@ static void device_reapply_stateblock(IW
 
     /* Temporaryily mark all render states dirty to force reapplication
      * until the context management for is integrated with the state management
-     * The same for the pixel shader, sampler states and texture stage states are marked
-     * dirty my StateBlock::Apply already
+     * The same for the pixel shader, vertex declaration
+     * Sampler states and texture stage states are marked
+     * dirty my StateBlock::Apply already.
      */
     for(i = 1; i < WINEHIGHEST_RENDER_STATE; i++) {
         IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(i));
     }
     IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADER);
+    IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VDECL);
 
     /* Restore recording */
     This->isRecordingState = oldRecording;
-- 
1.4.2.4



More information about the wine-patches mailing list