Stefan Dösinger : wined3d: Put some ARB declarations in the right place.

Alexandre Julliard julliard at winehq.org
Wed May 27 09:26:53 CDT 2009


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Tue May 26 12:58:02 2009 +0200

wined3d: Put some ARB declarations in the right place.

TMP_POS is only used in vertex shaders, declare it in the vshader
specific code. The sRGB constants are only used by pixel shaders, so
move them to the ps specific code, and avoid reading the stateblock.

---

 dlls/wined3d/arb_program_shader.c |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index d0382bb..1a10355 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -328,7 +328,6 @@ static void shader_generate_arb_declarations(IWineD3DBaseShader *iface, const sh
         SHADER_BUFFER *buffer, const WineD3D_GL_Info *gl_info, DWORD *lconst_map)
 {
     IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
-    IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) This->baseShader.device;
     DWORD i, cur, next_local = 0;
     char pshader = shader_is_pshader_version(reg_maps->shader_version.type);
     unsigned max_constantsF;
@@ -352,8 +351,6 @@ static void shader_generate_arb_declarations(IWineD3DBaseShader *iface, const sh
         } else {
             max_constantsF = GL_LIMITS(vshader_constantsF) - 1;
         }
-        /* Temporary Output register */
-        shader_addline(buffer, "TEMP TMP_OUT;\n");
     }
 
     for(i = 0; i < This->baseShader.limits.temporary; i++) {
@@ -373,13 +370,6 @@ static void shader_generate_arb_declarations(IWineD3DBaseShader *iface, const sh
         }
     }
 
-    if(device->stateBlock->renderState[WINED3DRS_SRGBWRITEENABLE] && pshader) {
-        shader_addline(buffer, "PARAM srgb_consts1 = {%f, %f, %f, %f};\n",
-                       srgb_mul_low, srgb_cmp, srgb_pow, srgb_mul_high);
-        shader_addline(buffer, "PARAM srgb_consts2 = {%f, %f, %f, %f};\n",
-                       srgb_sub_high, 0.0, 0.0, 0.0);
-    }
-
     /* Load local constants using the program-local space,
      * this avoids reloading them each time the shader is used
      */
@@ -2097,6 +2087,13 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShader *iface,
         }
     }
 
+    if(args->srgb_correction) {
+        shader_addline(buffer, "PARAM srgb_consts1 = {%f, %f, %f, %f};\n",
+                       srgb_mul_low, srgb_cmp, srgb_pow, srgb_mul_high);
+        shader_addline(buffer, "PARAM srgb_consts2 = {%f, %f, %f, %f};\n",
+                       srgb_sub_high, 0.0, 0.0, 0.0);
+    }
+
     /* Base Declarations */
     shader_generate_arb_declarations( (IWineD3DBaseShader*) This, reg_maps, buffer, &GLINFO_LOCATION, lconst_map);
 
@@ -2168,6 +2165,7 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShader *iface,
         priv_ctx.target_version = ARB;
     }
 
+    shader_addline(buffer, "TEMP TMP_OUT;\n");
     if(need_helper_const(gl_info)) {
         shader_addline(buffer, "PARAM helper_const = { 2.0, -1.0, %d.0, 0.0 };\n", This->rel_offset);
     }




More information about the wine-cvs mailing list