[6/8] WineD3D: Move decoding the streams to their own inline function

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


Nothing fancy, this is just a patch to make patch 8 a little smaller.  
The diff looks strange though, diff moves the rest of the function  
around and leaves the original code at the same position it seems...
-------------- next part --------------
From d8da64139c1c5b1710ac6c0de6b575add52eec93 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Stefan_D=C3=B6singer?= <stefan at imac.local>
Date: Wed, 3 Jan 2007 18:36:23 +0100
Subject: [PATCH] WineD3D: Move decoding streams to their own inline function

---
 dlls/wined3d/state.c |   54 ++++++++++++++++++++++++++++----------------------
 1 files changed, 30 insertions(+), 24 deletions(-)

diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 38d7883..a3586ec 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -1973,36 +1973,15 @@ static void transform_projection(DWORD s
     }
 }
 
-static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock) {
-    BOOL useVertexShaderFunction = FALSE, updateFog = FALSE;
-    BOOL transformed;
-    /* Some stuff is in the device until we have per context tracking */
+/* Helper for vertexdeclaration() */
+static inline void handleStreams(IWineD3DStateBlockImpl *stateblock, BOOL useVertexShaderFunction) {
     IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
-    BOOL wasrhw = device->last_was_rhw;
-
-    device->streamFixedUp = FALSE;
- 	
-    /* Shaders can be implemented using ARB_PROGRAM, GLSL, or software -
-     * here simply check whether a shader was set, or the user disabled shaders
-     */
-    if (device->vs_selected_mode != SHADER_NONE && stateblock->vertexShader &&
-       ((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->baseShader.function != NULL) {
-        useVertexShaderFunction = TRUE;
-
-        if(((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->usesFog != device->last_was_foggy_shader) {
-            updateFog = TRUE;
-        }
-    } else if(device->last_was_foggy_shader) {
-        updateFog = TRUE;
-    }
 
     if(device->up_strided) {
-
         /* Note: this is a ddraw fixed-function code path */
         TRACE("================ Strided Input ===================\n");
         memcpy(&device->strided_streams, device->up_strided, sizeof(device->strided_streams));
-    }
-    else if (stateblock->vertexDecl || stateblock->vertexShader) {
+    } else if (stateblock->vertexDecl || stateblock->vertexShader) {
         /* Note: This is a fixed function or shader codepath.
          * This means it must handle both types of strided data.
          * Shaders must go through here to zero the strided data, even if they
@@ -2027,6 +2006,33 @@ static void vertexdeclaration(DWORD stat
         primitiveConvertToStridedData((IWineD3DDevice *) device, &device->strided_streams,
 									   &device->streamFixedUp);
      }
+}
+
+static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock) {
+    BOOL useVertexShaderFunction = FALSE, updateFog = FALSE;
+    BOOL transformed;
+    /* Some stuff is in the device until we have per context tracking */
+    IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
+    BOOL wasrhw = device->last_was_rhw;
+
+    device->streamFixedUp = FALSE;
+ 	
+    /* Shaders can be implemented using ARB_PROGRAM, GLSL, or software -
+     * here simply check whether a shader was set, or the user disabled shaders
+     */
+    if (device->vs_selected_mode != SHADER_NONE && stateblock->vertexShader &&
+       ((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->baseShader.function != NULL) {
+        useVertexShaderFunction = TRUE;
+
+        if(((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->usesFog != device->last_was_foggy_shader) {
+            updateFog = TRUE;
+        }
+    } else if(device->last_was_foggy_shader) {
+        updateFog = TRUE;
+    }
+
+    handleStreams(stateblock, useVertexShaderFunction);
+
     /* Do I have to use ? TRUE : FALSE ? Or can I rely on 15==15 beeing equal to TRUE(=1)? */
     transformed = ((device->strided_streams.u.s.position.lpData != NULL ||
                     device->strided_streams.u.s.position.VBO != 0) &&
-- 
1.4.2.4

-------------- next part --------------



More information about the wine-patches mailing list