[Mesa-dev] [Mesa-stable] [PATCH 1/2] glsl: Generate unique names for each const array lowered to uniforms

Chris Forbes chrisf at ijw.co.nz
Sun Nov 23 18:02:32 PST 2014


Just fallen through the cracks. I'll land them after work (a few hours).

On Mon, Nov 24, 2014 at 2:01 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> Hi Chris,
>
> These two patches haven't landed in master. Did they fall through the
> cracks or you're planning to do more work on them ? Afaics Ken is happy
> with their current state.
>
> Thanks
> Emil
>
> On 18/11/14 08:15, Chris Forbes wrote:
>> 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 <chrisf at ijw.co.nz>
>> Cc: "10.4" <mesa-stable at lists.freedesktop.org>
>> ---
>>  src/glsl/lower_const_arrays_to_uniforms.cpp | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/glsl/lower_const_arrays_to_uniforms.cpp b/src/glsl/lower_const_arrays_to_uniforms.cpp
>> index b3c0ee2..700e903 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;
>>
>


More information about the mesa-dev mailing list