From b8a21cc6df7e9da15a24ed3dbf60cd4aeb8effaa Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 1 Apr 2010 18:31:11 -0700 Subject: Track max accessed array element, reject additional out-of-bounds accesses For unsized arrays, we can't flag out-of-bounds accesses until the array is redeclared with a size. Track the maximum accessed element and generate an error if the declaration specifies a size that would cause that access to be out-of-bounds. This causes the following tests to pass: glslparsertest/shaders/array10.frag --- ir.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ir.h') diff --git a/ir.h b/ir.h index de6f09318a..8892f1dc1b 100644 --- a/ir.h +++ b/ir.h @@ -121,6 +121,7 @@ public: { ir_variable *var = new ir_variable(type, name); + var->max_array_access = this->max_array_access; var->read_only = this->read_only; var->centroid = this->centroid; var->invariant = this->invariant; @@ -132,6 +133,13 @@ public: const char *name; + /** + * Highest element accessed with a constant expression array index + * + * Not used for non-array variables. + */ + unsigned max_array_access; + unsigned read_only:1; unsigned centroid:1; unsigned invariant:1; -- cgit v1.2.3