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

Fabian Bieler fabianbieler at fastmail.fm
Fri Jun 14 04:37:08 PDT 2013


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.

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,
-- 
1.8.1.2



More information about the mesa-dev mailing list