glsl: Fix wonkey indentation left from previous commit

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Ian Romanick
2016-12-12 11:58:06 -08:00
parent 8862fefba0
commit 300de78ab1

View File

@@ -217,23 +217,23 @@ process_block_array(struct uniform_block_array_elements *ub_array, char **name,
unsigned *block_index, unsigned *binding_offset, unsigned *block_index, unsigned *binding_offset,
struct gl_context *ctx, struct gl_shader_program *prog) struct gl_context *ctx, struct gl_shader_program *prog)
{ {
for (unsigned j = 0; j < ub_array->num_array_elements; j++) { for (unsigned j = 0; j < ub_array->num_array_elements; j++) {
size_t new_length = name_length; size_t new_length = name_length;
/* Append the subscript to the current variable name */ /* Append the subscript to the current variable name */
ralloc_asprintf_rewrite_tail(name, &new_length, "[%u]", ralloc_asprintf_rewrite_tail(name, &new_length, "[%u]",
ub_array->array_elements[j]); ub_array->array_elements[j]);
if (ub_array->array) { if (ub_array->array) {
process_block_array(ub_array->array, name, new_length, blocks, process_block_array(ub_array->array, name, new_length, blocks,
parcel, variables, b, block_index, parcel, variables, b, block_index,
binding_offset, ctx, prog); binding_offset, ctx, prog);
} else { } else {
process_block_array_leaf(name, blocks, process_block_array_leaf(name, blocks,
parcel, variables, b, block_index, parcel, variables, b, block_index,
binding_offset, ctx, prog); binding_offset, ctx, prog);
}
} }
}
} }
static void static void
@@ -244,44 +244,43 @@ process_block_array_leaf(char **name,
unsigned *block_index, unsigned *binding_offset, 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 i = *block_index; unsigned i = *block_index;
const glsl_type *type = b->type->without_array(); const glsl_type *type = b->type->without_array();
blocks[i].Name = ralloc_strdup(blocks, *name); blocks[i].Name = ralloc_strdup(blocks, *name);
blocks[i].Uniforms = &variables[(*parcel).index]; blocks[i].Uniforms = &variables[(*parcel).index];
/* The GL_ARB_shading_language_420pack spec says: /* The GL_ARB_shading_language_420pack spec says:
* *
* "If the binding identifier is used with a uniform block * "If the binding identifier is used with a uniform block instanced as
* instanced as an array then the first element of the array * an array then the first element of the array takes the specified
* takes the specified block binding and each subsequent * block binding and each subsequent element takes the next consecutive
* element takes the next consecutive uniform block binding * uniform block binding point."
* point." */
*/ blocks[i].Binding = (b->has_binding) ? b->binding + *binding_offset : 0;
blocks[i].Binding = (b->has_binding) ? b->binding + *binding_offset : 0;
blocks[i].UniformBufferSize = 0; blocks[i].UniformBufferSize = 0;
blocks[i]._Packing = gl_uniform_block_packing(type->interface_packing); blocks[i]._Packing = gl_uniform_block_packing(type->interface_packing);
blocks[i]._RowMajor = type->get_interface_row_major(); blocks[i]._RowMajor = type->get_interface_row_major();
parcel->process(type, blocks[i].Name); parcel->process(type, blocks[i].Name);
blocks[i].UniformBufferSize = parcel->buffer_size; blocks[i].UniformBufferSize = parcel->buffer_size;
/* Check SSBO size is lower than maximum supported size for SSBO */ /* Check SSBO size is lower than maximum supported size for SSBO */
if (b->is_shader_storage && if (b->is_shader_storage &&
parcel->buffer_size > ctx->Const.MaxShaderStorageBlockSize) { parcel->buffer_size > ctx->Const.MaxShaderStorageBlockSize) {
linker_error(prog, "shader storage block `%s' has size %d, " linker_error(prog, "shader storage block `%s' has size %d, "
"which is larger than than the maximum allowed (%d)", "which is larger than than the maximum allowed (%d)",
b->type->name, b->type->name,
parcel->buffer_size, parcel->buffer_size,
ctx->Const.MaxShaderStorageBlockSize); ctx->Const.MaxShaderStorageBlockSize);
} }
blocks[i].NumUniforms = blocks[i].NumUniforms =
(unsigned)(ptrdiff_t)(&variables[parcel->index] - blocks[i].Uniforms); (unsigned)(ptrdiff_t)(&variables[parcel->index] - blocks[i].Uniforms);
*block_index = *block_index + 1; *block_index = *block_index + 1;
*binding_offset = *binding_offset + 1; *binding_offset = *binding_offset + 1;
} }
/* This function resizes the array types of the block so that later we can use /* This function resizes the array types of the block so that later we can use