aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl/linker.cpp
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2014-11-25 23:04:23 +1100
committerTimothy Arceri <[email protected]>2014-12-23 19:32:56 +1100
commitda4fb3e7a11765725a4aaee41de6c79b40637209 (patch)
tree5d96cc3ab2cdc630150643ee745b165927b5df72 /src/glsl/linker.cpp
parent414be86c96836b35571185da776d2bce1b620c6a (diff)
glsl: check if implicitly sized arrays match explicitly sized arrays across the same stage
V2: Improve error message. Signed-off-by: Timothy Arceri <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
Diffstat (limited to 'src/glsl/linker.cpp')
-rw-r--r--src/glsl/linker.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 44468c78a15..3f5eac1e26c 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -731,8 +731,27 @@ cross_validate_globals(struct gl_shader_program *prog,
&& ((var->type->length == 0)
|| (existing->type->length == 0))) {
if (var->type->length != 0) {
+ if (var->type->length <= existing->data.max_array_access) {
+ linker_error(prog, "%s `%s' declared as type "
+ "`%s' but outermost dimension has an index"
+ " of `%i'\n",
+ mode_string(var),
+ var->name, var->type->name,
+ existing->data.max_array_access);
+ return;
+ }
existing->type = var->type;
- }
+ } else if (existing->type->length != 0
+ && existing->type->length <=
+ var->data.max_array_access) {
+ linker_error(prog, "%s `%s' declared as type "
+ "`%s' but outermost dimension has an index"
+ " of `%i'\n",
+ mode_string(var),
+ var->name, existing->type->name,
+ var->data.max_array_access);
+ return;
+ }
} else if (var->type->is_record()
&& existing->type->is_record()
&& existing->type->record_compare(var->type)) {