diff options
author | Timothy Arceri <[email protected]> | 2013-11-20 08:42:19 +1100 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2013-11-23 15:52:27 -0800 |
commit | 3c9f0096c75315ea73d44ec17bc90c4d4c0d8f77 (patch) | |
tree | 4a7c759a2a1c48d7547df82cf511d6804333a1c9 /src/glsl/ast_to_hir.cpp | |
parent | bd00c66500712b9eb594cd6a7ff501811f170f78 (diff) |
glsl: Improve error message when attemping assignment to unsized array
V2: Return after error to avoid cascading error messages and
removed redundant "to" from error message
Signed-off-by: Timothy Arceri <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/glsl/ast_to_hir.cpp')
-rw-r--r-- | src/glsl/ast_to_hir.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 01280478c95..43cf4974557 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -696,9 +696,15 @@ validate_assignment(struct _mesa_glsl_parse_state *state, * Note: Whole-array assignments are not permitted in GLSL 1.10, but this * is handled by ir_dereference::is_lvalue. */ - if (is_initializer && lhs_type->is_unsized_array() && rhs->type->is_array() + if (lhs_type->is_unsized_array() && rhs->type->is_array() && (lhs_type->element_type() == rhs->type->element_type())) { - return rhs; + if (is_initializer) { + return rhs; + } else { + _mesa_glsl_error(&loc, state, + "implicitly sized arrays cannot be assigned"); + return NULL; + } } /* Check for implicit conversion in GLSL 1.20 */ |