Mesa (master): glsl: add AoA support for an inteface with unsized array members

Timothy Arceri tarceri at kemper.freedesktop.org
Thu Oct 15 10:43:38 UTC 2015


Module: Mesa
Branch: master
Commit: 132b9e9dd97a2ab7d3be7945b3d990e94fd1513a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=132b9e9dd97a2ab7d3be7945b3d990e94fd1513a

Author: Timothy Arceri <t_arceri at yahoo.com.au>
Date:   Sun Jul 19 14:08:44 2015 +1000

glsl: add AoA support for an inteface with unsized array members

Add support for setting the max access of an unsized member
of an interface array of arrays.

For example ifc[j][k].foo[i] where foo is unsized.

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/glsl/ast_array_index.cpp |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/glsl/ast_array_index.cpp b/src/glsl/ast_array_index.cpp
index 7855e0a..5927c91 100644
--- a/src/glsl/ast_array_index.cpp
+++ b/src/glsl/ast_array_index.cpp
@@ -61,21 +61,29 @@ update_max_array_access(ir_rvalue *ir, int idx, YYLTYPE *loc,
       }
    } else if (ir_dereference_record *deref_record =
               ir->as_dereference_record()) {
-      /* There are two possibilities we need to consider:
+      /* There are three possibilities we need to consider:
        *
        * - Accessing an element of an array that is a member of a named
        *   interface block (e.g. ifc.foo[i])
        *
        * - Accessing an element of an array that is a member of a named
        *   interface block array (e.g. ifc[j].foo[i]).
+       *
+       * - Accessing an element of an array that is a member of a named
+       *   interface block array of arrays (e.g. ifc[j][k].foo[i]).
        */
       ir_dereference_variable *deref_var =
          deref_record->record->as_dereference_variable();
       if (deref_var == NULL) {
-         if (ir_dereference_array *deref_array =
-             deref_record->record->as_dereference_array()) {
-            deref_var = deref_array->array->as_dereference_variable();
+         ir_dereference_array *deref_array =
+            deref_record->record->as_dereference_array();
+         ir_dereference_array *deref_array_prev = NULL;
+         while (deref_array != NULL) {
+            deref_array_prev = deref_array;
+            deref_array = deref_array->array->as_dereference_array();
          }
+         if (deref_array_prev != NULL)
+            deref_var = deref_array_prev->array->as_dereference_variable();
       }
 
       if (deref_var != NULL) {




More information about the mesa-commit mailing list