From a721abfbd1724e83381b46fc670bb38fbde76f69 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Aug 2010 10:32:01 -0700 Subject: glsl: Trim the size of uniform arrays to the maximum element used. Fixes glsl-getactiveuniform-array-size. --- src/glsl/ast_to_hir.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/glsl/ast_to_hir.cpp') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index b60bb2f0a0..8e4c3299aa 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) -- cgit v1.2.3