[Mesa-dev] [PATCH 2/4] glsl: Add SSBO's load/store/unsize-array-length-calculation support for AoA

Timothy Arceri t_arceri at yahoo.com.au
Tue Oct 6 04:14:52 PDT 2015


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>


I haven't looked at this too hard yet but just fyi I sent a v6 of my
patchseries that added UBO AoA support that this patch might clash
with. Also you remove some of the changes here in the next patch.

You can get v7 (branch AoA_v7) here which just rebases v6 on master
from today:

https://github.com/tarceri/Mesa_arrays_of_arrays


> ---
>  src/glsl/lower_ubo_reference.cpp | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/src/glsl/lower_ubo_reference.cpp
> b/src/glsl/lower_ubo_reference.cpp
> index 183435e..f4150df 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->array->type->is_matrix() && *row_major) {
> +         if (deref_array->type->without_array()->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->array->type->is_double())
> +            if (deref_array->type->without_array()->is_double())
>                 array_stride *= 2;
>              *matrix_columns = deref_array->array->type
> ->matrix_columns;
> -         } else if (deref_array->type->is_interface()) {
> +         } else if (deref_array->type->without_array()
> ->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
> @@ -649,10 +649,10 @@ lower_ubo_reference_visitor::emit_access(bool
> is_write,
>  
>     if (deref->type->is_array()) {
>        unsigned array_stride = packing ==
> GLSL_INTERFACE_PACKING_STD430 ?
> -         deref->type->fields.array->std430_array_stride(row_major) :
> -         glsl_align(deref->type->fields.array
> ->std140_size(row_major), 16);
> +         deref->type->without_array()
> ->std430_array_stride(row_major) :
> +         glsl_align(deref->type->without_array()
> ->std140_size(row_major), 16);
>  
> -      for (unsigned i = 0; i < deref->type->length; i++) {
> +      for (unsigned i = 0; i < deref->type->arrays_of_arrays_size();
> i++) {
>           ir_constant *element = new(mem_ctx) ir_constant(i);
>           ir_dereference *element_deref =
>              new(mem_ctx) ir_dereference_array(deref->clone(mem_ctx,
> NULL),


More information about the mesa-dev mailing list