summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChris Forbes <[email protected]>2014-11-18 21:15:05 +1300
committerChris Forbes <[email protected]>2014-11-24 21:07:56 +1300
commit129178893b2260df22db96327c5ca9c2ce7db046 (patch)
tree678cc494d49f73a39dcef55e3be0a224e61c8ad7 /src
parentadefccd12a534f0deac7b78db73693fe1dcef2ec (diff)
Uniform names (even for hidden uniforms) are required to be unique; some parts of the compiler assume they can be looked up by name. Fixes the piglit test: tests/spec/glsl-1.20/linker/array-initializers-1 Signed-off-by: Chris Forbes <[email protected]> Cc: "10.4" <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/glsl/lower_const_arrays_to_uniforms.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/glsl/lower_const_arrays_to_uniforms.cpp b/src/glsl/lower_const_arrays_to_uniforms.cpp
index b3c0ee29fba..700e9039f74 100644
--- a/src/glsl/lower_const_arrays_to_uniforms.cpp
+++ b/src/glsl/lower_const_arrays_to_uniforms.cpp
@@ -49,6 +49,7 @@ public:
{
instructions = insts;
progress = false;
+ index = 0;
}
bool run()
@@ -62,6 +63,7 @@ public:
private:
exec_list *instructions;
bool progress;
+ unsigned index;
};
void
@@ -76,8 +78,10 @@ lower_const_array_visitor::handle_rvalue(ir_rvalue **rvalue)
void *mem_ctx = ralloc_parent(con);
+ char *uniform_name = ralloc_asprintf(mem_ctx, "constarray__%d", index++);
+
ir_variable *uni =
- new(mem_ctx) ir_variable(con->type, "constarray", ir_var_uniform);
+ new(mem_ctx) ir_variable(con->type, uniform_name, ir_var_uniform);
uni->constant_initializer = con;
uni->constant_value = con;
uni->data.has_initializer = true;