[Mesa-dev] [PATCH 1/8] glsl: Move is_array_or_matrix outside visitor class

Kenneth Graunke kenneth at whitecape.org
Thu Jul 21 13:02:19 PDT 2011


On 07/18/2011 02:15 PM, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
> 
> There's no reason for it to be there, and another class that may not
> have access to the visitor will need it soon.
> ---
>  src/glsl/lower_variable_index_to_cond_assign.cpp |   11 ++++++-----
>  1 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/src/glsl/lower_variable_index_to_cond_assign.cpp b/src/glsl/lower_variable_index_to_cond_assign.cpp
> index 8eb1612..45adb26 100644
> --- a/src/glsl/lower_variable_index_to_cond_assign.cpp
> +++ b/src/glsl/lower_variable_index_to_cond_assign.cpp
> @@ -37,6 +37,12 @@
>  #include "glsl_types.h"
>  #include "main/macros.h"
>  
> +static inline bool
> +is_array_or_matrix(const ir_instruction *ir)
> +{
> +   return (ir->type->is_array() || ir->type->is_matrix());
> +}

Why not make this glsl_type::is_array_or_matrix() or possibly
glsl_type::can_subscript()?

>  struct assignment_generator
>  {
>     ir_instruction* base_ir;
> @@ -233,11 +239,6 @@ public:
>     bool lower_temps;
>     bool lower_uniforms;
>  
> -   bool is_array_or_matrix(const ir_instruction *ir) const
> -   {
> -      return (ir->type->is_array() || ir->type->is_matrix());
> -   }
> -
>     bool needs_lowering(ir_dereference_array *deref) const
>     {
>        if (deref == NULL || deref->array_index->as_constant()


More information about the mesa-dev mailing list