Mesa (master): glsl: Fix linker bug in cross_validate_globals()

Chad Versace chadversary at kemper.freedesktop.org
Wed Dec 1 20:46:41 PST 2010


Module: Mesa
Branch: master
Commit: 7528f143dfb77e3e0486006676e990964392aebf
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7528f143dfb77e3e0486006676e990964392aebf

Author: Chad Versace <chad.versace at intel.com>
Date:   Wed Nov 17 14:34:38 2010 -0800

glsl: Fix linker bug in cross_validate_globals()

Cause linking to fail if a global has mismatching invariant qualifiers.

See https://bugs.freedesktop.org/show_bug.cgi?id=30261

---

 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 cde70ad..576b72a 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -411,6 +411,13 @@ cross_validate_globals(struct gl_shader_program *prog,
 		  existing->constant_value =
 		     var->constant_value->clone(talloc_parent(existing), NULL);
 	    }
+
+	    if (existing->invariant != var->invariant) {
+	       linker_error_printf(prog, "declarations for %s `%s' have "
+	                           "mismatching invariant qualifiers\n",
+	                           mode_string(var), var->name);
+	       return false;
+	    }
 	 } else
 	    variables.add_variable(var);
       }



More information about the mesa-commit mailing list