[Mesa-dev] [PATCH 2/2 v2] glsl: Don't choke when printing an anonymous function parameter

2011-06-27 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

NOTE: This is a candidate for the 7.10 and 7.11 branches.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38584
---
v2 actually fixes the bug.  Based on feedback in the bug report.

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

diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp
index 5b5409d..518910b 100644
--- a/src/glsl/ir_print_visitor.cpp
+++ b/src/glsl/ir_print_visitor.cpp
@@ -96,6 +96,16 @@ void ir_print_visitor::indent(void)
 const char *
 ir_print_visitor::unique_name(ir_variable *var)
 {
+   /* var-name can be NULL in function prototypes when a type is given for a
+* parameter but no name is given.  In that case, just return an empty
+* string.  Don't worry about tracking the generated name in the printable
+* names hash because this is the only scope where it can ever appear.
+*/
+   if (var-name == NULL) {
+  static unsigned arg = 1;
+  return ralloc_asprintf(this-mem_ctx, parameter@%u, arg++);
+   }
+
/* Do we already have a name for this variable? */
const char *name = (const char *) hash_table_find(this-printable_names, 
var);
if (name != NULL)
-- 
1.7.4.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2 v2] glsl: Don't choke when printing an anonymous function parameter

2011-06-27 Thread Kenneth Graunke

On 06/27/2011 02:25 PM, Ian Romanick wrote:

From: Ian Romanickian.d.roman...@intel.com

NOTE: This is a candidate for the 7.10 and 7.11 branches.

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


Strong work!  I hadn't thought about anonymous parameters in prototypes.

For both patch 1 and 2:
Reviewed-by: Kenneth Graunke kenn...@whitecape.org
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev