mesa: glsl: remove reads of output regs from fragment shaders too
authorBrian Paul <brian.paul@tungstengraphics.com>
Tue, 12 Aug 2008 16:00:59 +0000 (10:00 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Tue, 12 Aug 2008 16:00:59 +0000 (10:00 -0600)
src/mesa/shader/slang/slang_compile.c

index 64c0dad611d449dafd73c67cba0a955b0441549e..9cf0f8b81a3f2966dbece837f14545d3a54ad4ff 100644 (file)
@@ -2431,19 +2431,20 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader)
    _slang_delete_mempool((slang_mempool *) ctx->Shader.MemPool);
    ctx->Shader.MemPool = NULL;
 
-   if (shader->Type == GL_VERTEX_SHADER) {
-      /* remove any reads of varying (output) registers */
+   /* remove any reads of output registers */
 #if 0
-      printf("Pre-remove output reads:\n");
-      _mesa_print_program(shader->Programs);
+   printf("Pre-remove output reads:\n");
+   _mesa_print_program(shader->Program);
 #endif
+   _mesa_remove_output_reads(shader->Program, PROGRAM_OUTPUT);
+   if (shader->Type == GL_VERTEX_SHADER) {
+      /* and remove writes to varying vars in vertex programs */
       _mesa_remove_output_reads(shader->Program, PROGRAM_VARYING);
-      _mesa_remove_output_reads(shader->Program, PROGRAM_OUTPUT);
+   }
 #if 0
-      printf("Post-remove output reads:\n");
-      _mesa_print_program(shader->Programs);
+   printf("Post-remove output reads:\n");
+   _mesa_print_program(shader->Program);
 #endif
-   }
 
    return success;
 }