[Mesa-dev] [PATCH] glsl: binding qualifier must match with opaque-uniforms only

Andres Gomez agomez at igalia.com
Sun Feb 5 18:53:15 UTC 2017


The binding point is a valid layout qualifier for Uniform Blocks,
Shader Storage Blocks and Opaque-Uniforms.

>From page 60 (page 66 of the PDF) of the GLSL 4.20 spec, v11:

  " 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, as
    shown in the examples below."

As we see, this restriction applies to Opaque-Uniforms only, not to
Uniform Blocks nor Shader Storage Blocks.

Fixes GL45-CTS.enhanced_layouts.ssb_layout_qualifier_conflict

Signed-off-by: Andres Gomez <agomez at igalia.com>
---
 src/compiler/glsl/linker.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index b768a6e5285..ae13a45d22b 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -962,7 +962,7 @@ cross_validate_globals(struct gl_shader_program *prog,
           *  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->data.explicit_binding) {
+         if (var->type->contains_opaque() && var->data.explicit_binding) {
             if (existing->data.explicit_binding &&
                 var->data.binding != existing->data.binding) {
                linker_error(prog, "explicit bindings for %s "
-- 
2.11.0



More information about the mesa-dev mailing list