summaryrefslogtreecommitdiffstats
path: root/src/glsl/link_uniform_blocks.cpp
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2014-04-02 18:58:54 -0700
committerIan Romanick <ian.d.romanick@intel.com>2014-04-11 12:26:01 -0700
commit625cf8c874950a38e7afb404345611f0fad4d490 (patch)
tree29ccb5f5923f90fe2891443c3bce4d66c8926b6b /src/glsl/link_uniform_blocks.cpp
parent25a66568750c5826a077cbf549de92546c5fc6cf (diff)
downloadexternal_mesa3d-625cf8c874950a38e7afb404345611f0fad4d490.zip
external_mesa3d-625cf8c874950a38e7afb404345611f0fad4d490.tar.gz
external_mesa3d-625cf8c874950a38e7afb404345611f0fad4d490.tar.bz2
glsl: Propagate explicit binding information from the AST all the way to the linker
Information about the binding was not being properly communicated from the front-end compiler to the linker. As a result, the linker never knew that any UBOs had explicit bindings! Fixes the piglit test arb_shading_language_420pack-binding-layout. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76323 Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Tested-by: github@socker.lepus.uberspace.de [v0] Cc: "10.1" <mesa-stable@lists.freedesktop.org> Cc: github@socker.lepus.uberspace.de
Diffstat (limited to 'src/glsl/link_uniform_blocks.cpp')
-rw-r--r--src/glsl/link_uniform_blocks.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/glsl/link_uniform_blocks.cpp b/src/glsl/link_uniform_blocks.cpp
index 72d6c53..1a0e643 100644
--- a/src/glsl/link_uniform_blocks.cpp
+++ b/src/glsl/link_uniform_blocks.cpp
@@ -251,7 +251,17 @@ link_uniform_blocks(void *mem_ctx,
blocks[i].Name = ralloc_asprintf(blocks, "%s[%u]", name,
b->array_elements[j]);
blocks[i].Uniforms = &variables[parcel.index];
- blocks[i].Binding = 0;
+
+ /* The GL_ARB_shading_language_420pack spec says:
+ *
+ * "If the binding identifier is used with a uniform block
+ * instanced as an array then the first element of the array
+ * takes the specified block binding and each subsequent
+ * element takes the next consecutive uniform block binding
+ * point."
+ */
+ blocks[i].Binding = (b->has_binding) ? b->binding + j : 0;
+
blocks[i].UniformBufferSize = 0;
blocks[i]._Packing =
gl_uniform_block_packing(block_type->interface_packing);
@@ -269,7 +279,7 @@ link_uniform_blocks(void *mem_ctx,
} else {
blocks[i].Name = ralloc_strdup(blocks, block_type->name);
blocks[i].Uniforms = &variables[parcel.index];
- blocks[i].Binding = 0;
+ blocks[i].Binding = (b->has_binding) ? b->binding : 0;
blocks[i].UniformBufferSize = 0;
blocks[i]._Packing =
gl_uniform_block_packing(block_type->interface_packing);