wined3d: Reserve two varyings for ATI DX10 cards

Henri Verbeet hverbeet at gmail.com
Mon Jun 15 13:39:48 CDT 2009


2009/6/15 Robert Key <hpestilence at gmail.com>:
> This is what it looks like fixed, before it was doing IN[15] +
> gl_FrontColor + gl_FrontSecondaryColor.
>
We should probably just avoid writing to gl_FrontColor /
gl_FrontSecondaryColor if they're not read. How does the attached
patch work?
-------------- next part --------------
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 846044f..e859f0f 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -3422,7 +3422,8 @@ static void handle_ps3_input(SHADER_BUFFER *buffer, const WineD3D_GL_Info *gl_in
      * varyings. It shouldn't result in any real code executed on the GPU, since all read
      * input varyings are assigned above, if the optimizer works properly.
      */
-    for(i = 0; i < in_count + 2; i++) {
+    for (i = 0; i < in_count; ++i)
+    {
         if(set[i] != WINED3DSP_WRITEMASK_ALL) {
             unsigned int size = 0;
             memset(reg_mask, 0, sizeof(reg_mask));
@@ -3443,18 +3444,10 @@ static void handle_ps3_input(SHADER_BUFFER *buffer, const WineD3D_GL_Info *gl_in
                 size++;
             }
 
-            if (i == in_count) {
-                sprintf(destination, "gl_FrontColor");
-            } else if (i == in_count + 1) {
-                sprintf(destination, "gl_FrontSecondaryColor");
-            } else {
-                sprintf(destination, "IN[%u]", i);
-            }
-
             if (size == 1) {
-                shader_addline(buffer, "%s.%s = 0.0;\n", destination, reg_mask);
+                shader_addline(buffer, "IN[%u].%s = 0.0;\n", i, reg_mask);
             } else {
-                shader_addline(buffer, "%s.%s = vec%u(0.0);\n", destination, reg_mask, size);
+                shader_addline(buffer, "IN[%u].%s = vec%u(0.0);\n", i, reg_mask, size);
             }
         }
     }


More information about the wine-devel mailing list