Mesa (7.10): glsl: Don' t choke when printing an anonymous function parameter

Ian Romanick idr at kemper.freedesktop.org
Thu Jul 7 21:18:34 UTC 2011


Module: Mesa
Branch: 7.10
Commit: cd73c06eed3e8ff517d8741eb91b2d3356cfd214
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cd73c06eed3e8ff517d8741eb91b2d3356cfd214

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Wed Jul  6 17:24:54 2011 -0700

glsl: Don't choke when printing an anonymous function parameter

This is based on commit 174cef7fee7d400fc89a3ce68b7791d2aa3eb90f, but
the code is heavily changed.  The original commit modifies
ir_print_visitor::unique_name, but there is no such method in 7.10.
Instead, this code just modifies ir_print_visitor::visit(ir_variable
*ir) to "do the right thing" when ir_variable::name is NULL.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38584

---

 src/glsl/ir_print_visitor.cpp |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp
index 0aa0b0a..04927e7 100644
--- a/src/glsl/ir_print_visitor.cpp
+++ b/src/glsl/ir_print_visitor.cpp
@@ -104,7 +104,11 @@ void ir_print_visitor::visit(ir_variable *ir)
 	  cent, inv, mode[ir->mode], interp[ir->interpolation]);
 
    print_type(ir->type);
-   printf(" %s@%p)", ir->name, (void *) ir);
+   if (ir->name == NULL) {
+      static unsigned arg = 1;
+      printf(" parameter@%u)", arg++);
+   } else
+      printf(" %s@%p)", ir->name, (void *) ir);
 }
 
 




More information about the mesa-commit mailing list