glsl: add AoA support for linking interface blocks with unsized members
authorTimothy Arceri <t_arceri@yahoo.com.au>
Thu, 12 Mar 2015 08:52:47 +0000 (19:52 +1100)
committerTimothy Arceri <t_arceri@yahoo.com.au>
Thu, 15 Oct 2015 10:42:24 +0000 (21:42 +1100)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/ir.cpp
src/glsl/linker.cpp

index 4c228437d15ef27e00c0451ccc1675b8d174ef8b..8933b2301770e458322b8de9a3e3b8df9f4ae78b 100644 (file)
@@ -1689,8 +1689,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());
    }
 }
 
index c15034ba90451729b300ba6ff59fbeea5cc87045..25ca928aa43169bdefd5a14b510c778c8fdfc253 100644 (file)
@@ -1387,8 +1387,10 @@ public:
 
    virtual ir_visitor_status visit(ir_variable *var)
    {
+      const glsl_type *type_without_array;
       fixup_type(&var->type, var->data.max_array_access,
                  var->data.from_ssbo_unsized_array);
+      type_without_array = var->type->without_array();
       if (var->type->is_interface()) {
          if (interface_contains_unsized_arrays(var->type)) {
             const glsl_type *new_type =
@@ -1398,11 +1400,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(),
                                         var->is_in_shader_storage_block());
             var->change_interface_type(new_type);