[Mesa-dev] [PATCH 2/5] glsl: Only call mark_whole_array_access for arrays.

Ian Romanick idr at freedesktop.org
Tue Jun 18 02:10:14 PDT 2013


On 06/03/2013 01:23 PM, Fabian Bieler wrote:
> Otherwise the max_array_access field of scalar variables is set to 0xffffffff.
> This doesn't lead to any errors since that field isn't used for scalar
> variables but leaving it at zero is probably better.

I think this is okay.  We don't rely on that field for matrices, which 
would be the only other possibly meaningful case.

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

> Signed-off-by: Fabian Bieler <fabianbieler at fastmail.fm>
> ---
>   src/glsl/ast_to_hir.cpp | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
> index e918ade..f14a5b1 100644
> --- a/src/glsl/ast_to_hir.cpp
> +++ b/src/glsl/ast_to_hir.cpp
> @@ -656,6 +656,8 @@ validate_assignment(struct _mesa_glsl_parse_state *state,
>   static void
>   mark_whole_array_access(ir_rvalue *access)
>   {
> +   assert(access->type->is_array());
> +
>      ir_dereference_variable *deref = access->as_dereference_variable();
>
>      if (deref && deref->var) {
> @@ -763,8 +765,10 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state,
>   						   rhs->type->array_size());
>   	 d->type = var->type;
>         }
> -      mark_whole_array_access(rhs);
> -      mark_whole_array_access(lhs);
> +      if (rhs->type->is_array()) {
> +	 mark_whole_array_access(rhs);
> +	 mark_whole_array_access(lhs);
> +      }
>      }
>
>      /* Most callers of do_assignment (assign, add_assign, pre_inc/dec,
>



More information about the mesa-dev mailing list