glsl: Mark the array access for whole-array comparisons.
authorEric Anholt <eric@anholt.net>
Wed, 1 Dec 2010 23:55:53 +0000 (15:55 -0800)
committerEric Anholt <eric@anholt.net>
Thu, 2 Dec 2010 00:14:34 +0000 (16:14 -0800)
By not doing so, the uniform contents of
glsl-uniform-non-uniform-array-compare.shader_test was getting thrown
out since nobody was recorded as dereferencing the array.

src/glsl/ast_to_hir.cpp

index 04b221e9b8d9f9cdff7d23bf43806d2002a6dde5..f5b1120f785fbe614337cfb6d890a883dc519dea 100644 (file)
@@ -745,6 +745,16 @@ ast_node::hir(exec_list *instructions,
    return NULL;
 }
 
+static void
+mark_whole_array_access(ir_rvalue *access)
+{
+   ir_dereference_variable *deref = access->as_dereference_variable();
+
+   if (deref) {
+      deref->var->max_array_access = deref->type->length - 1;
+   }
+}
+
 static ir_rvalue *
 do_comparison(void *mem_ctx, int operation, ir_rvalue *op0, ir_rvalue *op1)
 {
@@ -780,6 +790,10 @@ do_comparison(void *mem_ctx, int operation, ir_rvalue *op0, ir_rvalue *op1)
            last = result;
         }
       }
+
+      mark_whole_array_access(op0);
+      mark_whole_array_access(op1);
+
       return last;
    }