Henri Verbeet : wined3d: Vertex state stateblocks should also record the vertex declaration.

Alexandre Julliard julliard at winehq.org
Tue Oct 13 10:52:53 CDT 2009


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Oct 13 10:38:00 2009 +0200

wined3d: Vertex state stateblocks should also record the vertex declaration.

---

 dlls/wined3d/stateblock.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index cd70605..258fea0 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -301,6 +301,7 @@ static void stateblock_savedstates_set_vertex(SAVEDSTATES *states, const struct
     WORD sampler_mask = 0;
     unsigned int i;
 
+    states->vertexDecl = 1;
     states->vertexShader = 1;
 
     for (i = 0; i < sizeof(vertex_states_render) / sizeof(*vertex_states_render); ++i)
@@ -974,6 +975,12 @@ static HRESULT  WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
                 This->streamSource[i] = targetStateBlock->streamSource[i];
             }
         }
+        if (This->vertexDecl != targetStateBlock->vertexDecl)
+        {
+            if (targetStateBlock->vertexDecl) IWineD3DVertexDeclaration_AddRef(targetStateBlock->vertexDecl);
+            if (This->vertexDecl) IWineD3DVertexDeclaration_Release(This->vertexDecl);
+            This->vertexDecl = targetStateBlock->vertexDecl;
+        }
         if(This->vertexShader != targetStateBlock->vertexShader) {
             if(targetStateBlock->vertexShader) IWineD3DVertexShader_AddRef(targetStateBlock->vertexShader);
             if(This->vertexShader) IWineD3DVertexShader_Release(This->vertexShader);
@@ -1176,6 +1183,7 @@ should really perform a delta so that only the changes get updated*/
         }
     } else if(This->blockType == WINED3DSBT_VERTEXSTATE) {
         IWineD3DDevice_SetVertexShader(pDevice, This->vertexShader);
+        IWineD3DDevice_SetVertexDeclaration(pDevice, This->vertexDecl);
         for (i = 0; i < GL_LIMITS(vshader_constantsF); i++) {
             IWineD3DDevice_SetVertexShaderConstantF(pDevice, i,
                     This->vertexShaderConstantF + i * 4, 1);
@@ -1751,7 +1759,7 @@ HRESULT stateblock_init(IWineD3DStateBlockImpl *stateblock, IWineD3DDeviceImpl *
 
         if (stateblock->vertexShader) IWineD3DVertexShader_AddRef(stateblock->vertexShader);
 
-        stateblock->vertexDecl = NULL;
+        if (stateblock->vertexDecl) IWineD3DVertexDeclaration_AddRef(stateblock->vertexDecl);
         stateblock->pIndexData = NULL;
         stateblock->pixelShader = NULL;
     }




More information about the wine-cvs mailing list