[Mesa-dev] [PATCH 1/4] glsl: add std430 layout support for AoA

Samuel Iglesias Gonsálvez siglesias at igalia.com
Tue Oct 6 05:04:57 PDT 2015



On 06/10/15 13:09, Timothy Arceri wrote:
> On Tue, 2015-10-06 at 10:26 +0200, Samuel Iglesias Gonsalvez wrote:
>> Signed-off-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
>> Cc: Timothy Arceri <t_arceri at yahoo.com.au>
> 
> This patch is Reviewed-by: Timothy Arceri <t_arceri at yahoo.com.au>
> 
> Feel free to push this before the rest of my patches land.
> 

OK, pushed.

Sam

>> ---
>>  src/glsl/glsl_types.cpp | 12 +++++++-----
>>  1 file changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
>> index c53ba20..3c7d257 100644
>> --- a/src/glsl/glsl_types.cpp
>> +++ b/src/glsl/glsl_types.cpp
>> @@ -1573,8 +1573,8 @@ glsl_type::std430_size(bool row_major) const
>>        unsigned int array_len;
>>  
>>        if (this->is_array()) {
>> -         element_type = this->fields.array;
>> -         array_len = this->length;
>> +         element_type = this->without_array();
>> +         array_len = this->arrays_of_arrays_size();
>>        } else {
>>           element_type = this;
>>           array_len = 1;
>> @@ -1597,10 +1597,12 @@ glsl_type::std430_size(bool row_major) const
>>     }
>>  
>>     if (this->is_array()) {
>> -      if (this->fields.array->is_record())
>> -         return this->length * this->fields.array
>> ->std430_size(row_major);
>> +      if (this->without_array()->is_record())
>> +         return this->arrays_of_arrays_size() *
>> +            this->without_array()->std430_size(row_major);
>>        else
>> -         return this->length * this->fields.array
>> ->std430_base_alignment(row_major);
>> +         return this->arrays_of_arrays_size() *
>> +            this->without_array()->std430_base_alignment(row_major);
>>     }
>>  
>>     if (this->is_record() || this->is_interface()) {
> 


More information about the mesa-dev mailing list