From: Timothy Arceri Date: Sun, 4 May 2014 11:13:25 +0000 (+1000) Subject: glsl: calculate component size for arrays of arrays when varying packing disabled X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=abdab88b30ab;p=mesa.git glsl: calculate component size for arrays of arrays when varying packing disabled Signed-off-by: Timothy Arceri Reviewed-by: Ilia Mirkin Reviewed-by: Ian Romanick --- diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp index f7a7b8c4c5b..0d343d64a2e 100644 --- a/src/glsl/link_varyings.cpp +++ b/src/glsl/link_varyings.cpp @@ -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