Mesa (master): ir_to_mesa: Print Mesa IR again after running _mesa_optimize_program

Ian Romanick idr at kemper.freedesktop.org
Sat Feb 12 00:46:34 UTC 2011


Module: Mesa
Branch: master
Commit: 7087cfad52e66e48745929ccca0607afb975f07d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7087cfad52e66e48745929ccca0607afb975f07d

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Fri Feb 11 12:39:31 2011 -0800

ir_to_mesa: Print Mesa IR again after running _mesa_optimize_program

---

 src/mesa/program/ir_to_mesa.cpp |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index f4d89f2..34ab491 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2384,7 +2384,8 @@ print_program(struct prog_instruction *mesa_instructions,
 
    for (i = 0; i < num_instructions; i++) {
       struct prog_instruction *mesa_inst = mesa_instructions + i;
-      ir_instruction *ir = mesa_instruction_annotation[i];
+      ir_instruction *ir = (mesa_instruction_annotation != NULL)
+	 ? mesa_instruction_annotation[i] : NULL;
 
       fprintf(stdout, "%3d: ", i);
 
@@ -3007,6 +3008,14 @@ get_mesa_program(struct gl_context *ctx,
 
    if ((ctx->Shader.Flags & GLSL_NO_OPT) == 0) {
       _mesa_optimize_program(ctx, prog);
+
+      if (ctx->Shader.Flags & GLSL_DUMP) {
+	 printf("\n");
+	 printf("Mesa IR for optimized %s program %d:\n", target_string,
+		shader_program->Name);
+	 print_program(prog->Instructions, NULL,
+		       prog->NumInstructions);
+      }
    }
 
    return prog;




More information about the mesa-commit mailing list