mesa: Simplify uniform debug logging logic
authorIan Romanick <ian.d.romanick@intel.com>
Tue, 4 Oct 2011 23:58:21 +0000 (16:58 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 19 Oct 2011 00:26:37 +0000 (17:26 -0700)
This simplificiation was enabled by the earlier refactors that
eliminated the references to the assembly shaders stored in the
gl_shader_program structure.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/context.c
src/mesa/program/prog_print.c
src/mesa/program/prog_print.h

index fc52e8c1562d08c656d26d0e56d62aef368c4fbb..e0af6ee6749756740a91c8d97b44bd707a1f2b24 100644 (file)
@@ -1833,8 +1833,6 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
       shProg[MESA_SHADER_FRAGMENT] = ctx->Shader.CurrentFragmentProgram;
 
       for (i = 0; i < MESA_SHADER_TYPES; i++) {
-        struct gl_shader *sh;
-
         if (shProg[i] == NULL || shProg[i]->_Used
             || shProg[i]->_LinkedShaders[i] == NULL)
            continue;
@@ -1842,27 +1840,13 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
         /* This is the first time this shader is being used.
          * Append shader's constants/uniforms to log file.
          *
-         * The logic is a little odd here.  We only want to log data for each
-         * shader target that will actually be used, and we only want to log
-         * it once.  It's possible to have a program bound to the vertex
+         * Only log data for the program target that matches the shader
+         * target.  It's possible to have a program bound to the vertex
          * shader target that also supplied a fragment shader.  If that
          * program isn't also bound to the fragment shader target we don't
          * want to log its fragment data.
          */
-        sh = shProg[i]->_LinkedShaders[i];
-        switch (sh->Type) {
-        case GL_VERTEX_SHADER:
-           _mesa_append_uniforms_to_file(sh, sh->Program);
-           break;
-
-        case GL_GEOMETRY_SHADER_ARB:
-           _mesa_append_uniforms_to_file(sh, sh->Program);
-           break;
-
-        case GL_FRAGMENT_SHADER:
-           _mesa_append_uniforms_to_file(sh, sh->Program);
-           break;
-        }
+        _mesa_append_uniforms_to_file(shProg[i]->_LinkedShaders[i]);
       }
 
       for (i = 0; i < MESA_SHADER_TYPES; i++) {
index 70412b1fa6ae6157dc2b6c40c935f591c0ab42dd..dfccc60f694cb9969f7860623941482a2dbab480 100644 (file)
@@ -1068,9 +1068,9 @@ _mesa_write_shader_to_file(const struct gl_shader *shader)
  * _mesa_write_shader_to_file function.
  */
 void
-_mesa_append_uniforms_to_file(const struct gl_shader *shader,
-                              const struct gl_program *prog)
+_mesa_append_uniforms_to_file(const struct gl_shader *shader)
 {
+   const struct gl_program *const prog = shader->Program;
    const char *type;
    char filename[100];
    FILE *f;
index d962087db3869396adb8a334c9d9378a34afe18c..b95ec2be570cbc54a176bc4fbcf849661777f42a 100644 (file)
@@ -113,8 +113,7 @@ extern void
 _mesa_write_shader_to_file(const struct gl_shader *shader);
 
 extern void
-_mesa_append_uniforms_to_file(const struct gl_shader *shader,
-                              const struct gl_program *prog);
+_mesa_append_uniforms_to_file(const struct gl_shader *shader);
 
 
 #endif /* PROG_PRINT_H */