Mesa (7.9): glsl: Mark the array access for whole-array comparisons.

Ian Romanick idr at kemper.freedesktop.org
Fri Dec 17 02:21:28 UTC 2010


Module: Mesa
Branch: 7.9
Commit: d347b90b94c79f99ed87c2cf293426d93cc0b345
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d347b90b94c79f99ed87c2cf293426d93cc0b345

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Dec  1 15:55:53 2010 -0800

glsl: Mark the array access for whole-array comparisons.

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.
(cherry picked from commit b4f585665c31b1f80d909e38b3b2a9fab0c03076)

---

 src/glsl/ast_to_hir.cpp |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 9dcdab0..3bc9530 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -615,6 +615,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)
 {
@@ -650,6 +660,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;
    }
 




More information about the mesa-commit mailing list