[Mesa-dev] [RFC PATCH 09/12] glsl: add AoA support for linking interface blocks

Ilia Mirkin imirkin at alum.mit.edu
Mon Mar 23 05:59:39 PDT 2015


On Sat, Mar 21, 2015 at 11:37 PM, Timothy Arceri <t_arceri at yahoo.com.au> wrote:
> On Sat, 2015-03-21 at 19:51 -0400, Ilia Mirkin wrote:
>> On Sat, Mar 21, 2015 at 5:49 AM, Timothy Arceri <t_arceri at yahoo.com.au> wrote:
>> > Adds support for linking AoA interface blocks
>> > which countain unsized arrays
>> > ---
>> >  src/glsl/ir.cpp     | 4 ++--
>> >  src/glsl/linker.cpp | 9 +++++----
>> >  2 files changed, 7 insertions(+), 6 deletions(-)
>> >
>> > diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
>> > index 54656f8..2e1442f 100644
>> > --- a/src/glsl/ir.cpp
>> > +++ b/src/glsl/ir.cpp
>> > @@ -1663,8 +1663,8 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name,
>> >
>> >        if (type->is_interface())
>> >           this->init_interface_type(type);
>> > -      else if (type->is_array() && type->fields.array->is_interface())
>> > -         this->init_interface_type(type->fields.array);
>> > +      else if (type->without_array()->is_interface())
>> > +         this->init_interface_type(type->without_array());
>> >     }
>> >  }
>> >
>> > diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
>> > index 0c44677..eb25163 100644
>> > --- a/src/glsl/linker.cpp
>> > +++ b/src/glsl/linker.cpp
>> > @@ -1201,7 +1201,9 @@ public:
>> >
>> >     virtual ir_visitor_status visit(ir_variable *var)
>> >     {
>> > +      const glsl_type *type_without_array;
>> >        fixup_type(&var->type, var->data.max_array_access);
>> > +      type_without_array = var->type->without_array();
>> >        if (var->type->is_interface()) {
>> >           if (interface_contains_unsized_arrays(var->type)) {
>> >              const glsl_type *new_type =
>> > @@ -1210,11 +1212,10 @@ public:
>> >              var->type = new_type;
>> >              var->change_interface_type(new_type);
>> >           }
>> > -      } else if (var->type->is_array() &&
>> > -                 var->type->fields.array->is_interface()) {
>> > -         if (interface_contains_unsized_arrays(var->type->fields.array)) {
>> > +      } else if (type_without_array->is_interface()) {
>> > +         if (interface_contains_unsized_arrays(type_without_array)) {
>> >              const glsl_type *new_type =
>> > -               resize_interface_members(var->type->fields.array,
>> > +               resize_interface_members(type_without_array,
>> >                                          var->get_max_ifc_array_access());
>>
>> Will this work? I assume this max_ifc_array_access will only take one
>> dimension into account, whereas you want several...
>
> max_ifc_array_access is just used to give the unsized dimension (which
> can only be outermost dimension) a size. So we only need to worry about
> that one dimension.

Ah right, of course. This is "max array access along the unsized
dimension", not a per-dimension maximum to keep track of the usages.

>
>>
>> >              var->change_interface_type(new_type);
>> >              var->type =
>> > --
>> > 2.1.0
>> >
>> > _______________________________________________
>> > 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