[Mesa-dev] [PATCH 22/27] glsl: add helper for comparing arrays in varying packing pass

eocallaghan at alterapraxis.com eocallaghan at alterapraxis.com
Fri Apr 22 04:29:41 UTC 2016


On 2016-03-31 21:57, Timothy Arceri wrote:
> ---
>  src/compiler/glsl/lower_packed_varyings.cpp | 25 
> +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/src/compiler/glsl/lower_packed_varyings.cpp
> b/src/compiler/glsl/lower_packed_varyings.cpp
> index ad766bb..6e7a289 100644
> --- a/src/compiler/glsl/lower_packed_varyings.cpp
> +++ b/src/compiler/glsl/lower_packed_varyings.cpp
> @@ -152,6 +152,31 @@
> 
>  using namespace ir_builder;
> 
> +/**
> + * If the var is an array check if it matches the array attributes of 
> the
> + * packed var.
> + */
> +static bool
> +check_for_matching_arrays(ir_variable *packed_var, ir_variable *var)
> +{
> +   const glsl_type *pt = packed_var->type;
> +   const glsl_type *vt = var->type;

I suppose its ok to always assume the call site always does the right 
thing with
this helper? Either way,

Reviewed-by: Edward O'Callaghan <eocallaghan at alterapraxis.com>

> +   bool array_match = true;
> +
> +   while (pt->is_array() || vt->is_array()) {
> +      if (pt->is_array() != vt->is_array() ||
> +          pt->length != vt->length) {
> +         array_match = false;
> +         break;
> +      } else {
> +         pt = pt->fields.array;
> +         vt = vt->fields.array;
> +      }
> +   }
> +
> +   return array_match;
> +}
> +
>  static bool
>  needs_lowering(ir_variable *var, bool has_enhanced_layouts,
>                 bool disable_varying_packing)



More information about the mesa-dev mailing list