summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/ir.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/glsl/ir.cpp')
-rw-r--r--src/compiler/glsl/ir.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp
index c5943e5fcaa..8e4b382ebd3 100644
--- a/src/compiler/glsl/ir.cpp
+++ b/src/compiler/glsl/ir.cpp
@@ -1523,6 +1523,10 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name,
if (mode == ir_var_temporary
&& (name == NULL || name == ir_variable::tmp_name)) {
this->name = ir_variable::tmp_name;
+ } else if (name == NULL ||
+ strlen(name) < ARRAY_SIZE(this->name_storage)) {
+ strcpy(this->name_storage, name ? name : "");
+ this->name = this->name_storage;
} else {
this->name = ralloc_strdup(this, name);
}