glsl: calculate component size for arrays of arrays when varying packing disabled
authorTimothy Arceri <t_arceri@yahoo.com.au>
Sun, 4 May 2014 11:13:25 +0000 (21:13 +1000)
committerTimothy Arceri <t_arceri@yahoo.com.au>
Sat, 26 Sep 2015 12:48:49 +0000 (22:48 +1000)
Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/link_varyings.cpp

index f7a7b8c4c5bb4e4ef39ba2d8e9d6ce8897b7c705..0d343d64a2effdd18517e65e357864e275a87ede 100644 (file)
@@ -956,9 +956,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