[Mesa-dev] [PATCH] glsl: check if implicitly sized arrays dont match explicitly sized arrays across the same stage

Timothy Arceri t_arceri at yahoo.com.au
Tue Nov 25 04:32:37 PST 2014


Signed-off-by: Timothy Arceri <t_arceri at yahoo.com.au>
---
 src/glsl/linker.cpp | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index de6b1fb..a3a43a0 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -732,8 +732,25 @@ 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' and type `%s'\n",
+                                     mode_string(var),
+                                     var->name, var->type->name,
+                                     existing->type->name);
+                        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' and type `%s'\n",
+                                  mode_string(var),
+                                  var->name, existing->type->name,
+                                  var->type->name);
+                     return;
+                  }
                } else if (var->type->is_record()
 		   && existing->type->is_record()
 		   && existing->type->record_compare(var->type)) {
-- 
1.9.3



More information about the mesa-dev mailing list