diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2010-04-05 14:35:47 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-04-05 14:35:47 -0700 |
commit | 63f394203a8be9b87f8617cd7a56a0806c0870b3 (patch) | |
tree | 14d2d784c0289ccbd27b7c2ec941894a0897644f /ast_to_hir.cpp | |
parent | 63038e18ad44e4e021da9a6dbe7a075e57ff6415 (diff) |
Set lower bound on size implied by whole-array assignment
When an unsized array is accessed with a constant extension index this
sets a lower bound on the allowable sizes. When the unsized array
gets a size set due to a whole-array assignment, this size must be at
least as large as the implied lower bound.
This causes the following tests to pass:
glslparsertest/glsl2/array-16.vert
Diffstat (limited to 'ast_to_hir.cpp')
-rw-r--r-- | ast_to_hir.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp index c9f93cbcc4..9d067be02d 100644 --- a/ast_to_hir.cpp +++ b/ast_to_hir.cpp @@ -489,6 +489,13 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state, assert(var != NULL); + if (var->max_array_access >= unsigned(rhs->type->array_size())) { + /* FINISHME: This should actually log the location of the RHS. */ + _mesa_glsl_error(& lhs_loc, state, "array size must be > %u due to " + "previous access", + var->max_array_access); + } + var->type = glsl_type::get_array_instance(lhs->type->element_type(), rhs->type->array_size()); } |