WineD3D: Compile pixel shaders in drawprim

Stefan Dösinger stefan at codeweavers.com
Thu Aug 24 16:55:23 CDT 2006


Certain states affect the gl shader program we have to generate, and those 
aren't known before the shader is used. This patch moves pixel shader 
generation and compilation to drawprim to allow the shader cross compilation 
code to reference those states
-------------- next part --------------
From nobody Mon Sep 17 00:00:00 2001
From: Stefan Dösinger <stefan at codeweavers.com>
Date: Thu Aug 24 23:52:44 2006 +0200
Subject: [PATCH] Coalescing 4b9d59b4c375c40651e6e098d516728c7a51df67 and 288d957b82bc435ed134f48ced1d2f83419b7eef
First commit:

WineD3D: Compile pixel shaders in drawprim

Second commit:

glsl fix

---

 dlls/wined3d/drawprim.c    |    7 +++++++
 dlls/wined3d/pixelshader.c |    3 ---
 2 files changed, 7 insertions(+), 3 deletions(-)

0fdcb58f8fb63edc70f6a58181752c23996f0f18
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index c2ed58c..aa022e2 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -1796,6 +1796,13 @@ inline static void drawPrimitiveDrawStri
         useDrawStridedSlow = TRUE;
     }
 
+    if(usePixelShaderFunction) {
+        /* We compile the shader here because it depends on the texture stage state
+         * setup of the bound textures. If the shader is already compiled and the texture stage
+         * state setup matches the program this function will do nothing
+         */
+        IWineD3DPixelShader_CompileShader(This->stateBlock->pixelShader);
+    }
     /* If GLSL is used for either pixel or vertex shaders, make a GLSL program 
      * Otherwise set NULL, to restore fixed function */
     if ((wined3d_settings.vs_selected_mode == SHADER_GLSL && useVertexShaderFunction) ||
diff --git a/dlls/wined3d/pixelshader.c b/dlls/wined3d/pixelshader.c
index f5d6462..ab05dbb 100644
--- a/dlls/wined3d/pixelshader.c
+++ b/dlls/wined3d/pixelshader.c
@@ -949,9 +949,6 @@ static HRESULT WINAPI IWineD3DPixelShade
         This->baseShader.function = NULL;
     }
 
-    /* Compile the shader. */
-    IWineD3DPixelShader_CompileShader(iface);
-
     return WINED3D_OK;
 }
 
-- 
1.2.4



More information about the wine-patches mailing list