Mesa (glsl2): glsl2: Allow use of _mesa_print_ir without a parse state on hand.

Eric Anholt anholt at kemper.freedesktop.org
Thu Jul 29 23:18:10 UTC 2010


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

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Jul 29 15:04:45 2010 -0700

glsl2: Allow use of _mesa_print_ir without a parse state on hand.

---

 src/glsl/ir_print_visitor.cpp |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp
index 7df9d8a..73476e7 100644
--- a/src/glsl/ir_print_visitor.cpp
+++ b/src/glsl/ir_print_visitor.cpp
@@ -40,19 +40,21 @@ void
 _mesa_print_ir(exec_list *instructions,
 	       struct _mesa_glsl_parse_state *state)
 {
-   for (unsigned i = 0; i < state->num_user_structures; i++) {
-      const glsl_type *const s = state->user_structures[i];
+   if (state) {
+      for (unsigned i = 0; i < state->num_user_structures; i++) {
+	 const glsl_type *const s = state->user_structures[i];
 
-      printf("(structure (%s) (%s@%p) (%u) (\n",
-	     s->name, s->name, s, s->length);
+	 printf("(structure (%s) (%s@%p) (%u) (\n",
+		s->name, s->name, s, s->length);
 
-      for (unsigned j = 0; j < s->length; j++) {
-	 printf("\t((");
-	 print_type(s->fields.structure[j].type);
-	 printf(")(%s))\n", s->fields.structure[j].name);
-      }
+	 for (unsigned j = 0; j < s->length; j++) {
+	    printf("\t((");
+	    print_type(s->fields.structure[j].type);
+	    printf(")(%s))\n", s->fields.structure[j].name);
+	 }
 
-      printf(")\n");
+	 printf(")\n");
+      }
    }
 
    printf("(\n");




More information about the mesa-commit mailing list