summaryrefslogtreecommitdiffstats
path: root/src/glsl/linker.cpp
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2013-07-16 12:18:57 -0700
committerKenneth Graunke <[email protected]>2013-07-18 16:57:24 -0700
commit9a9a830b445b5dbd70a4155e0e5e8b896abfb868 (patch)
treed1c62c46417581696665e7744d82b62f1192eadf /src/glsl/linker.cpp
parentd4375fc0166a2ca50c4786ea93b5a5ccdbc8eaf7 (diff)
glsl: Cross-validate explicit binding points.
All compilation units need to agree on the binding point, if they specify one at all. v2: Use binding, not constant_value. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
Diffstat (limited to 'src/glsl/linker.cpp')
-rw-r--r--src/glsl/linker.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index da5677067cd..ac010cfbb6a 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -541,6 +541,25 @@ cross_validate_globals(struct gl_shader_program *prog,
existing->explicit_location = true;
}
+ /* From the GLSL 4.20 specification:
+ * "A link error will result if two compilation units in a program
+ * specify different integer-constant bindings for the same
+ * opaque-uniform name. However, it is not an error to specify a
+ * binding on some but not all declarations for the same name"
+ */
+ if (var->explicit_binding) {
+ if (existing->explicit_binding &&
+ var->binding != existing->binding) {
+ linker_error(prog, "explicit bindings for %s "
+ "`%s' have differing values\n",
+ mode_string(var), var->name);
+ return false;
+ }
+
+ existing->binding = var->binding;
+ existing->explicit_binding = true;
+ }
+
/* Validate layout qualifiers for gl_FragDepth.
*
* From the AMD/ARB_conservative_depth specs: