diff options
Diffstat (limited to 'src/glsl/link_uniform_blocks.cpp')
-rw-r--r-- | src/glsl/link_uniform_blocks.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/glsl/link_uniform_blocks.cpp b/src/glsl/link_uniform_blocks.cpp index 72d6c5323a6..1a0e6431805 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); |