const struct link_uniform_block_active *const b,
unsigned *block_index,
unsigned *binding_offset,
+ unsigned linearized_index,
struct gl_context *ctx,
struct gl_shader_program *prog);
+/**
+ *
+ * \param first_index Value of \c block_index for the first element of the
+ * array.
+ */
static void
process_block_array(struct uniform_block_array_elements *ub_array, char **name,
size_t name_length, gl_uniform_block *blocks,
ubo_visitor *parcel, gl_uniform_buffer_variable *variables,
const struct link_uniform_block_active *const b,
unsigned *block_index, unsigned *binding_offset,
- struct gl_context *ctx, struct gl_shader_program *prog)
+ struct gl_context *ctx, struct gl_shader_program *prog,
+ unsigned first_index)
{
for (unsigned j = 0; j < ub_array->num_array_elements; j++) {
size_t new_length = name_length;
if (ub_array->array) {
process_block_array(ub_array->array, name, new_length, blocks,
parcel, variables, b, block_index,
- binding_offset, ctx, prog);
+ binding_offset, ctx, prog, first_index);
} else {
process_block_array_leaf(name, blocks,
parcel, variables, b, block_index,
- binding_offset, ctx, prog);
+ binding_offset, *block_index - first_index,
+ ctx, prog);
}
}
}
ubo_visitor *parcel, gl_uniform_buffer_variable *variables,
const struct link_uniform_block_active *const b,
unsigned *block_index, unsigned *binding_offset,
+ unsigned linearized_index,
struct gl_context *ctx, struct gl_shader_program *prog)
{
unsigned i = *block_index;
blocks[i].UniformBufferSize = 0;
blocks[i]._Packing = gl_uniform_block_packing(type->interface_packing);
blocks[i]._RowMajor = type->get_interface_row_major();
+ blocks[i].linearized_array_index = linearized_index;
parcel->process(type, blocks[i].Name);
assert(b->has_instance_name);
process_block_array(b->array, &name, name_length, blocks, &parcel,
- variables, b, &i, &binding_offset, ctx, prog);
+ variables, b, &i, &binding_offset, ctx, prog,
+ i);
ralloc_free(name);
} else {
blocks[i].Name = ralloc_strdup(blocks, block_type->name);