glsl: Don't allocate a name for ir_var_temporary variables
[mesa.git] / src / glsl / ir.cpp
index 9c58f869dc46495a76426da3333dee37d835f13c..c712c6a7bd98b6e1b47ce9a08371ff8526c96f01 100644 (file)
@@ -1543,6 +1543,8 @@ ir_swizzle::variable_referenced() const
 }
 
 
+bool ir_variable::temporaries_allocate_names = false;
+
 const char ir_variable::tmp_name[] = "compiler_temp";
 
 ir_variable::ir_variable(const struct glsl_type *type, const char *name,
@@ -1551,6 +1553,9 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name,
 {
    this->type = type;
 
+   if (mode == ir_var_temporary && !ir_variable::temporaries_allocate_names)
+      name = NULL;
+
    /* The ir_variable clone method may call this constructor with name set to
     * tmp_name.
     */