[Mesa-dev] [PATCH 3/4] glsl: fix std430's array_stride calculation for AoA

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



On 06/10/15 13:17, 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>
>> ---
>>  src/glsl/link_uniforms.cpp       | 2 +-
>>  src/glsl/lower_ubo_reference.cpp | 6 +++---
>>  2 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
>> index 93a7df6..ef4a303 100644
>> --- a/src/glsl/link_uniforms.cpp
>> +++ b/src/glsl/link_uniforms.cpp
>> @@ -815,7 +815,7 @@ private:
>>           if (type->is_array()) {
>>              if (packing == GLSL_INTERFACE_PACKING_STD430)
>>                 this->uniforms[id].array_stride =
>> -                  type->fields.array
>> ->std430_array_stride(row_major);
>> +                  type->without_array()
>> ->std430_array_stride(row_major);
>>              else
>>                 this->uniforms[id].array_stride =
>>                    glsl_align(type->without_array()
>> ->std140_size(row_major), 16);
>> diff --git a/src/glsl/lower_ubo_reference.cpp
>> b/src/glsl/lower_ubo_reference.cpp
>> index f4150df..ea28d21 100644
>> --- a/src/glsl/lower_ubo_reference.cpp
>> +++ b/src/glsl/lower_ubo_reference.cpp
>> @@ -325,17 +325,17 @@
>> lower_ubo_reference_visitor::setup_for_load_or_store(ir_variable
>> *var,
>>        case ir_type_dereference_array: {
>>           ir_dereference_array *deref_array = (ir_dereference_array
>> *) deref;
>>           unsigned array_stride;
>> -         if (deref_array->type->without_array()->is_matrix() &&
>> *row_major) {
>> +         if (deref_array->array->type->is_matrix() && *row_major) {
>>              /* When loading a vector out of a row major matrix, the
>>               * step between the columns (vectors) is the size of a
>>               * float, while the step between the rows (elements of a
>>               * vector) is handled below in emit_ubo_loads.
>>               */
>>              array_stride = 4;
>> -            if (deref_array->type->without_array()->is_double())
>> +            if (deref_array->array->type->is_double())
>>                 array_stride *= 2;
>>              *matrix_columns = deref_array->array->type
>> ->matrix_columns;
>> -         } else if (deref_array->type->without_array()
>> ->is_interface()) {
>> +         } else if (deref_array->type->is_interface()) {
>>              /* We're processing an array dereference of an interface
>> instance
>>               * array. The thing being dereferenced *must* be a
>> variable
>>               * dereference because interfaces cannot be embedded in
>> other
> 
> Your undoing changes from the previous patch in the second hunk. With
> that hunk removed. 
> 
> This patch is: Reviewed-by: Timothy Arceri <t_arceri at yahoo.com.au>
> 

Yeah, I did a mistake when merging changes. By the way, the first hunk
(link_uniforms.cpp) was already done by you in your series, so we can
drop this patch entirely.

Sam


More information about the mesa-dev mailing list