summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndres Gomez <[email protected]>2017-02-20 16:49:14 +0200
committerAndres Gomez <[email protected]>2017-03-27 12:47:00 +0300
commit40b09ed15c708629b7fb3f30baf0f73d376f8ca0 (patch)
tree568ed84c7bfac63f5eca705bbc9fbef1cfc9b343 /src
parentbf15b2b515d5f37fc67fea77dea9d2fbc1dc8bf1 (diff)
glsl: UBOs and SSBOs must match the binding qualifier too
From page 140 (page 147 of the PDF) of the GLSL ES 3.10 v.4 spec: " 9.2 Matching of Qualifiers The following tables summarize the requirements for matching of qualifiers. It applies whenever there are two or more matching variables in a shader interface. Notes: 1. Yes means the qualifiers must match. ... 9.2.1 Linked Shaders | Qualifier | Qualifier | in/out | Default | uniform | buffer| | Class | | | Uniforms | Block | Block | ... | Layout | binding | N/A | Yes | Yes | Yes |" From page 93 (page 110 of the PDF) of the GL 4.2 (Core Profile) spec: " 2.11.7 Uniform Variables ... Uniform Blocks ... When a named uniform block is declared by multiple shaders in a program, it must be declared identically in each shader. The uniforms within the block must be declared with the same names and types, and in the same order. If a program contains multiple shaders with different declarations for the same named uniform block differs between shader, the program will fail to link." From page 129 (page 150 of the PDF) of the GL 4.3 (Core Profile) spec: " 7.8 Shader Buffer Variables and Shader Storage Blocks ... When a named shader storage block is declared by multiple shaders in a program, it must be declared identically in each shader. The buffer variables within the block must be declared with the same names, types, qualification, and declaration order. If a program contains multiple shaders with different declarations for the same named shader storage block, the program will fail to link." Therefore, if the binding qualifier differs between two linked Uniform or Shader Storage Blocks of the same name, a link error should happen. This patch will make that a link error will be reported on a program like this: "# VS layout(binding = 1) Block { vec4 color; } uni_block1; ... # FS layout(binding = 2) Block { vec4 color; } uni_block2; ..." Signed-off-by: Andres Gomez <[email protected]> Cc: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/glsl/link_uniform_blocks.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/compiler/glsl/link_uniform_blocks.cpp b/src/compiler/glsl/link_uniform_blocks.cpp
index 839fd07fa4b..249a767636c 100644
--- a/src/compiler/glsl/link_uniform_blocks.cpp
+++ b/src/compiler/glsl/link_uniform_blocks.cpp
@@ -504,6 +504,9 @@ link_uniform_blocks_are_compatible(const gl_uniform_block *a,
if (a->_RowMajor != b->_RowMajor)
return false;
+ if (a->Binding != b->Binding)
+ return false;
+
for (unsigned i = 0; i < a->NumUniforms; i++) {
if (strcmp(a->Uniforms[i].Name, b->Uniforms[i].Name) != 0)
return false;