Mesa (glsl2): ir_to_mesa: Pretty up the printing of MESA_GLSL=dump

Eric Anholt anholt at kemper.freedesktop.org
Thu Jul 22 20:13:58 UTC 2010


Module: Mesa
Branch: glsl2
Commit: 748c343f8bdbbc8c5f00403b790ad7130424c35f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=748c343f8bdbbc8c5f00403b790ad7130424c35f

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Jul 22 12:25:39 2010 -0700

ir_to_mesa: Pretty up the printing of MESA_GLSL=dump

---

 src/mesa/shader/ir_to_mesa.cpp |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp
index c92fe49..ba45c87 100644
--- a/src/mesa/shader/ir_to_mesa.cpp
+++ b/src/mesa/shader/ir_to_mesa.cpp
@@ -1885,19 +1885,29 @@ print_program(struct prog_instruction *mesa_instructions,
 {
    ir_instruction *last_ir = NULL;
    int i;
+   int indent = 0;
 
    for (i = 0; i < num_instructions; i++) {
       struct prog_instruction *mesa_inst = mesa_instructions + i;
       ir_instruction *ir = mesa_instruction_annotation[i];
 
+      fprintf(stdout, "%3d: ", i);
+
       if (last_ir != ir && ir) {
-	 ir_print_visitor print;
-	 ir->accept(&print);
+	 int j;
+
+	 for (j = 0; j < indent; j++) {
+	    fprintf(stdout, " ");
+	 }
+	 ir->print();
 	 printf("\n");
 	 last_ir = ir;
+
+	 fprintf(stdout, "     "); /* line number spacing. */
       }
 
-      _mesa_print_instruction(mesa_inst);
+      indent = _mesa_fprint_instruction_opt(stdout, mesa_inst, indent,
+					    PROG_PRINT_DEBUG, NULL);
    }
 }
 




More information about the mesa-commit mailing list