Skip to content
Snippets Groups Projects
Commit 7e47ae31 authored by Chris Forbes's avatar Chris Forbes Committed by Emil Velikov
Browse files

glsl: Generate unique names for each const array lowered to uniforms


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: default avatarChris Forbes <chrisf@ijw.co.nz>
Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke's avatarKenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 12917889)
parent 9e94c059
No related branches found
No related tags found
Loading
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment