[Mesa-dev] [PATCH 05/20] glsl: calculate component size for arrays of arrays when varying packing disabled

Timothy Arceri t_arceri at yahoo.com.au
Wed Jul 29 06:56:47 PDT 2015


Signed-off-by: Timothy Arceri <t_arceri at yahoo.com.au>
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
 src/glsl/link_varyings.cpp | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
index 1c52ff3..5f42f8c 100644
--- a/src/glsl/link_varyings.cpp
+++ b/src/glsl/link_varyings.cpp
@@ -955,9 +955,16 @@ varying_matches::record(ir_variable *producer_var, ir_variable *consumer_var)
          type = type->fields.array;
       }
 
-      slots = (type->is_array()
-            ? (type->length * type->fields.array->matrix_columns)
-            : type->matrix_columns);
+      if (type->is_array()) {
+         slots = 1;
+         while (type->is_array()) {
+            slots *= type->length;
+            type = type->fields.array;
+         }
+         slots *= type->matrix_columns;
+      } else {
+         slots = var->type->matrix_columns;
+      }
       this->matches[this->num_matches].num_components = 4 * slots;
    } else {
       this->matches[this->num_matches].num_components
-- 
2.4.3



More information about the mesa-dev mailing list