H. Verbeet : wined3d: Always select the correct shader pair in the vertexdeclaration() state handler.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Feb 14 09:25:32 CST 2007


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

Author: H. Verbeet <hverbeet at gmail.com>
Date:   Tue Feb 13 19:53:11 2007 +0100

wined3d: Always select the correct shader pair in the vertexdeclaration() state handler.

---

 dlls/wined3d/state.c |   25 +++++++++++--------------
 1 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index ee5ba98..b4a1ab9 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -2663,6 +2663,8 @@ static inline void handleStreams(IWineD3DStateBlockImpl *stateblock, BOOL useVer
 
 static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
     BOOL useVertexShaderFunction = FALSE, updateFog = FALSE;
+    BOOL usePixelShaderFunction = stateblock->wineD3DDevice->ps_selected_mode != SHADER_NONE && stateblock->pixelShader
+            && ((IWineD3DPixelShaderImpl *)stateblock->pixelShader)->baseShader.function;
     BOOL transformed;
     /* Some stuff is in the device until we have per context tracking */
     IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
@@ -2758,24 +2760,19 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, W
         IWineD3DVertexShader_CompileShader(stateblock->vertexShader);
     }
 
-    if(useVertexShaderFunction || context->last_was_vshader) {
-        BOOL usePixelShaderFunction = device->ps_selected_mode != SHADER_NONE && 
-                                      stateblock->pixelShader &&
-                                      ((IWineD3DPixelShaderImpl *)stateblock->pixelShader)->baseShader.function;
-
-        /* Vertex and pixel shaders are applied together for now, so let the last dirty state do the
-         * application
-         */
-        if(!isStateDirty(context, STATE_PIXELSHADER)) {
-            device->shader_backend->shader_select((IWineD3DDevice *) device, usePixelShaderFunction, useVertexShaderFunction);
+    /* Vertex and pixel shaders are applied together for now, so let the last dirty state do the
+     * application
+     */
+    if (!isStateDirty(context, STATE_PIXELSHADER)) {
+        device->shader_backend->shader_select((IWineD3DDevice *)device, usePixelShaderFunction, useVertexShaderFunction);
 
-            if(!isStateDirty(context, STATE_VERTEXSHADERCONSTANT) && (useVertexShaderFunction || usePixelShaderFunction)) {
-                shaderconstant(STATE_VERTEXSHADERCONSTANT, stateblock, context);
-            }
+        if (!isStateDirty(context, STATE_VERTEXSHADERCONSTANT) && (useVertexShaderFunction || usePixelShaderFunction)) {
+            shaderconstant(STATE_VERTEXSHADERCONSTANT, stateblock, context);
         }
-        context->last_was_vshader = useVertexShaderFunction;
     }
 
+    context->last_was_vshader = useVertexShaderFunction;
+
     if(updateFog) {
         state_fog(STATE_RENDER(WINED3DRS_FOGENABLE), stateblock, context);
     }




More information about the wine-cvs mailing list