glsl2: When dumping IR for debug, skip all the empty builtin prototypes.
authorEric Anholt <eric@anholt.net>
Thu, 29 Jul 2010 21:20:39 +0000 (14:20 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 29 Jul 2010 21:38:04 +0000 (14:38 -0700)
src/glsl/ir_print_visitor.cpp

index ee489cda7f3bfca9d116f83b144b77266522882f..88a0a6f0c8857255e82a944c3e223ee98a7e2373 100644 (file)
@@ -57,8 +57,10 @@ _mesa_print_ir(exec_list *instructions,
 
    printf("(\n");
    foreach_iter(exec_list_iterator, iter, *instructions) {
-      ((ir_instruction *)iter.get())->print();
-      printf("\n");
+      ir_instruction *ir = (ir_instruction *)iter.get();
+      ir->print();
+      if (ir->ir_type != ir_type_function)
+        printf("\n");
    }
    printf("\n)");
 }
@@ -122,6 +124,16 @@ void ir_print_visitor::visit(ir_function_signature *ir)
 
 void ir_print_visitor::visit(ir_function *ir)
 {
+   bool found_non_builtin_proto = false;
+
+   foreach_iter(exec_list_iterator, iter, *ir) {
+      ir_function_signature *const sig = (ir_function_signature *) iter.get();
+      if (sig->is_defined || !sig->is_built_in)
+        found_non_builtin_proto = true;
+   }
+   if (!found_non_builtin_proto)
+      return;
+
    printf("(function %s\n", ir->name);
    foreach_iter(exec_list_iterator, iter, *ir) {
       ir_function_signature *const sig = (ir_function_signature *) iter.get();
@@ -130,7 +142,7 @@ void ir_print_visitor::visit(ir_function *ir)
       printf("\n");
    }
 
-   printf(")\n");
+   printf(")\n\n");
 }