[Mesa-dev] [PATCH 01/25] glsl: calculate component size for arrays of arrays when varying packing disabled
Ian Romanick
idr at freedesktop.org
Thu Aug 20 10:25:45 PDT 2015
On 08/19/2015 09:37 PM, Timothy Arceri wrote:
> 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 f7a7b8c..0d343d6 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;
> + }
A comment that you are accumulating all the array sizes could be helpful
for future readers. Either way, this patch is
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
> this->matches[this->num_matches].num_components = 4 * slots;
> } else {
> this->matches[this->num_matches].num_components
>
More information about the mesa-dev
mailing list