[Mesa-dev] [PATCH] glsl: Fail linking if a global is both a uniform and non-uniform.

Kenneth Graunke kenneth at whitecape.org
Thu Aug 25 08:26:39 PDT 2011


Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/glsl/linker.cpp |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index f970bce..7337c11 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -366,6 +366,13 @@ cross_validate_globals(struct gl_shader_program *prog,
 	       }
 	    }
 
+	    if ((var->mode == ir_var_uniform) != (existing->mode == ir_var_uniform)) {
+	       linker_error_printf(prog, "%s is declared both as %s and %s\n",
+				   var->name,
+				   mode_string(var), mode_string(existing));
+	       return false;
+	    }
+
 	    if (var->explicit_location) {
 	       if (existing->explicit_location
 		   && (var->location != existing->location)) {
-- 
1.7.6



More information about the mesa-dev mailing list