[Mesa-dev] [PATCH 3/6] glsl: Accept nonconstant array references in lower_ubo_reference

Chris Forbes chrisf at ijw.co.nz
Tue Jul 15 03:29:17 PDT 2014


Oh dear. This hunk should have been squashed together with the change
to it later. By itself, it doesn't get us anywhere.

On Tue, Jul 15, 2014 at 10:26 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> On Sat, Jul 12, 2014 at 9:51 PM, Chris Forbes <chrisf at ijw.co.nz> wrote:
>> Instead of falling back to just the block name (which we won't find),
>> look for the first element of the block array. We'll deal with the rest
>> in the backend by arranging for the blocks to be laid out contiguously.
>>
>> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
>> ---
>>  src/glsl/lower_ubo_reference.cpp | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/src/glsl/lower_ubo_reference.cpp b/src/glsl/lower_ubo_reference.cpp
>> index 90e65bd..85e9c7d 100644
>> --- a/src/glsl/lower_ubo_reference.cpp
>> +++ b/src/glsl/lower_ubo_reference.cpp
>> @@ -102,6 +102,16 @@ interface_field_name(void *mem_ctx, char *base_name, ir_dereference *d)
>>
>>           d = a->array->as_dereference();
>>           previous_index = a->array_index->as_constant();
>> +
>> +         if (!previous_index) {
>> +            /* The array index is not a constant, so let's find
>> +             * the first element of the array. Elsewhere we guarantee
>> +             * that the entire array is valid if used with a non-constant
>> +             * index.
>> +             */
>> +            previous_index = new(mem_ctx) ir_constant(0u);
>> +         }
>
> You remove this code in 5/6 -- what's the point of this patch?
>
>> +
>>           break;
>>        }
>>
>> --
>> 2.0.1
>>
>> _______________________________________________
>> 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