i965: Dump linked shaders on MESA_GLSL=dump.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 19 Sep 2012 20:27:58 +0000 (13:27 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Sat, 29 Sep 2012 07:36:45 +0000 (00:36 -0700)
Often, the original shader IR isn't terribly interesting because a lot
of crucial optimizations haven't been done (such as inlining built-ins).

ir_to_mesa used to print this out for us, but since we don't use it, we
have to do it ourselves.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/brw_shader.cpp

index 54545c0df74db1dd3273f55f7bef0e6f2513ccfd..1cd9095f2ea1947628f8a2db1154423380d3a61d 100644 (file)
@@ -210,6 +210,15 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
       _mesa_associate_uniform_storage(ctx, shProg, prog->Parameters);
 
       _mesa_reference_program(ctx, &prog, NULL);
+
+      if (ctx->Shader.Flags & GLSL_DUMP) {
+         static const char *target_strings[]
+            = { "vertex", "fragment", "geometry" };
+         printf("\n");
+         printf("GLSL IR for linked %s program %d:\n", target_strings[stage],
+                shProg->Name);
+         _mesa_print_ir(shader->base.ir, NULL);
+      }
    }
 
    if (!brw_shader_precompile(ctx, shProg))