[15/20] WineD3D: Clean up drawprim a bit

Stefan Dösinger stefan at codeweavers.com
Sat Jan 6 11:28:42 CST 2007


Now that almost everything is gone from drawPrimitiveDrawStrided we don't need 
a subfunction for calling drawStridedSlow/Fast any longer
-------------- next part --------------
From cb7857eb55913bb412cdfcc6ce25cea3d14a31f2 Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Fri, 5 Jan 2007 20:32:14 +0100
Subject: [PATCH] WineD3D: Clean up drawPrimitive a bit

---
 dlls/wined3d/drawprim.c |   44 ++++++--------------------------------------
 1 files changed, 6 insertions(+), 38 deletions(-)

diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 8800c1e..469b5be 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -1092,29 +1092,6 @@ void drawStridedSoftwareVS(IWineD3DDevic
 
 #endif
 
-inline static void drawPrimitiveDrawStrided(
-    IWineD3DDevice *iface,
-    BOOL useVertexShaderFunction,
-    BOOL usePixelShaderFunction,
-    WineDirect3DVertexStridedData *dataLocations,
-    ULONG baseVIndex,
-    UINT numberOfvertices,
-    UINT numberOfIndicies,
-    GLenum glPrimType,
-    const void *idxData,
-    short idxSize,
-    int minIndex,
-    long StartIdx) {
-
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;    
-
-    /* Draw vertex-by-vertex */
-    if (This->useDrawStridedSlow)
-        drawStridedSlow(iface, dataLocations, numberOfIndicies, glPrimType, idxData, idxSize, minIndex, StartIdx, baseVIndex);
-    else
-        drawStridedFast(iface, numberOfIndicies, glPrimType, idxData, idxSize, minIndex, StartIdx, baseVIndex);
-}
-
 static void check_fbo_status(IWineD3DDevice *iface) {
     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
 
@@ -1230,23 +1207,11 @@ void drawPrimitive(IWineD3DDevice *iface
                    int   minIndex) {
 
     IWineD3DDeviceImpl           *This = (IWineD3DDeviceImpl *)iface;
-    BOOL                          useVertexShaderFunction = FALSE;
-    BOOL                          usePixelShaderFunction = FALSE;
     IWineD3DSwapChainImpl         *swapchain;
     int                           i;
     DWORD                         dirtyState, idx;
     BYTE                          shift;
 
-    /* Shaders can be implemented using ARB_PROGRAM, GLSL, or software -
-     * here simply check whether a shader was set, or the user disabled shaders */
-    if (This->vs_selected_mode != SHADER_NONE && This->stateBlock->vertexShader &&
-        ((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->baseShader.function != NULL) 
-        useVertexShaderFunction = TRUE;
-
-    if (This->ps_selected_mode != SHADER_NONE && This->stateBlock->pixelShader &&
-        ((IWineD3DPixelShaderImpl *)This->stateBlock->pixelShader)->baseShader.function) 
-        usePixelShaderFunction = TRUE;
-
     /* Invalidate the back buffer memory so LockRect will read it the next time */
     for(i = 0; i < IWineD3DDevice_GetNumberOfSwapChains(iface); i++) {
         IWineD3DDevice_GetSwapChain(iface, i, (IWineD3DSwapChain **) &swapchain);
@@ -1289,9 +1254,12 @@ void drawPrimitive(IWineD3DDevice *iface
         if (numberOfVertices == 0 )
             numberOfVertices = calculatedNumberOfindices;
 
-        drawPrimitiveDrawStrided(iface, useVertexShaderFunction, usePixelShaderFunction,
-            &This->strided_streams, StartVertexIndex, numberOfVertices, calculatedNumberOfindices, glPrimType,
-            idxData, idxSize, minIndex, StartIdx);
+        if (This->useDrawStridedSlow)
+            drawStridedSlow(iface, &This->strided_streams, calculatedNumberOfindices,
+                            glPrimType, idxData, idxSize, minIndex, StartIdx, StartVertexIndex);
+        else
+            drawStridedFast(iface, calculatedNumberOfindices, glPrimType,
+                            idxData, idxSize, minIndex, StartIdx, StartVertexIndex);
     }
 
     /* Finshed updating the screen, restore lock */
-- 
1.4.2.4



More information about the wine-patches mailing list