[Mesa-dev] [PATCH 2/2] glsl: Always copy the index when cloning a variable.

Ian Romanick idr at freedesktop.org
Thu Apr 26 09:29:19 PDT 2012


On 04/26/2012 08:26 AM, Kenneth Graunke wrote:
> On 04/25/2012 04:07 PM, Eric Anholt wrote:
>> The index is also used for GL_ARB_blend_func_extended. Cloning in
>> i965 was dropping a non-ARB_explicit_attrib_location index.
>> ---
>> src/glsl/ir_clone.cpp | 7 +------
>> 1 file changed, 1 insertion(+), 6 deletions(-)
>>
>> diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp
>> index 5a7a71c..5046ac3 100644
>> --- a/src/glsl/ir_clone.cpp
>> +++ b/src/glsl/ir_clone.cpp
>> @@ -53,6 +53,7 @@ ir_variable::clone(void *mem_ctx, struct hash_table
>> *ht) const
>> var->invariant = this->invariant;
>> var->interpolation = this->interpolation;
>> var->location = this->location;
>> + var->index = this->index;
>> var->warn_extension = this->warn_extension;
>> var->origin_upper_left = this->origin_upper_left;
>> var->pixel_center_integer = this->pixel_center_integer;
>> @@ -72,12 +73,6 @@ ir_variable::clone(void *mem_ctx, struct hash_table
>> *ht) const
>> sizeof(this->state_slots[0]) * var->num_state_slots);
>> }
>>
>> - if (this->explicit_location)
>> - var->location = this->location;
>> -
>> - if (this->explicit_index)
>> - var->index = this->index;
>> -
>> if (this->constant_value)
>> var->constant_value = this->constant_value->clone(mem_ctx, ht);
>>
>
> I'm rather baffled as to why Ian added the explicit_location code you're
> deleting in the first place. Cloning shouldn't do magic; it should just
> clone.

I *believe* this was so that cloning a variable in a linked shader 
wouldn't copy the location assigned by the linker.  That said, I don't 
recall why I thought that was necessary, and I'm struggling to come up 
with a new reason.

> Hopefully this won't break things. If it does, I think we should fix the
> callers.
>
> Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list