ir_to_mesa: Add support for MESA_GLSL=dump environment var.
authorEric Anholt <eric@anholt.net>
Thu, 22 Jul 2010 19:11:36 +0000 (12:11 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 22 Jul 2010 19:11:36 +0000 (12:11 -0700)
src/mesa/shader/ir_to_mesa.cpp

index bfb8e3201ac961b085979f8c1680bafc4fddf2bd..c92fe49a2079537a19b85617b6ed2237e183741d 100644 (file)
@@ -2030,12 +2030,21 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program,
    int i;
    struct gl_program *prog;
    GLenum target;
+   const char *target_string;
    GLboolean progress;
 
    switch (shader->Type) {
-   case GL_VERTEX_SHADER:   target = GL_VERTEX_PROGRAM_ARB; break;
-   case GL_FRAGMENT_SHADER: target = GL_FRAGMENT_PROGRAM_ARB; break;
-   default: assert(!"should not be reached"); break;
+   case GL_VERTEX_SHADER:
+      target = GL_VERTEX_PROGRAM_ARB;
+      target_string = "vertex";
+      break;
+   case GL_FRAGMENT_SHADER:
+      target = GL_FRAGMENT_PROGRAM_ARB;
+      target_string = "fragment";
+      break;
+   default:
+      assert(!"should not be reached");
+      break;
    }
 
    validate_ir_tree(shader->ir);
@@ -2127,7 +2136,8 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program,
    }
 
    set_branchtargets(&v, mesa_instructions, num_instructions);
-   if (0) {
+   if (ctx->Shader.Flags & GLSL_DUMP) {
+      printf("Mesa %s program:\n", target_string);
       print_program(mesa_instructions, mesa_instruction_annotation,
                    num_instructions);
    }