summaryrefslogtreecommitdiffstats
path: root/src/glsl/ast_to_hir.cpp
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-08-23 10:32:01 -0700
committerEric Anholt <[email protected]>2010-08-23 10:34:31 -0700
commita721abfbd1724e83381b46fc670bb38fbde76f69 (patch)
treed6ecf823c668122e3c6179a2db31fea69774d690 /src/glsl/ast_to_hir.cpp
parent001a7bfdfc8b3c8930d5ced21982dbdfb8cd35b3 (diff)
glsl: Trim the size of uniform arrays to the maximum element used.
Fixes glsl-getactiveuniform-array-size.
Diffstat (limited to 'src/glsl/ast_to_hir.cpp')
-rw-r--r--src/glsl/ast_to_hir.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index b60bb2f0a0a..8e4c3299aa6 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1258,6 +1258,11 @@ ast_expression::hir(exec_list *instructions,
}
} else if (array->type->array_size() == 0) {
_mesa_glsl_error(&loc, state, "unsized array index must be constant");
+ } else {
+ if (array->type->is_array()) {
+ ir_variable *v = array->whole_variable_referenced();
+ v->max_array_access = array->type->array_size();
+ }
}
if (error_emitted)