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