diff options
author | Ian Romanick <[email protected]> | 2016-12-12 11:54:41 -0800 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2016-12-19 15:54:38 -0800 |
commit | 8862fefba068d07d04b08abd0a0bd09d59a04cdc (patch) | |
tree | 1952fbe8847719f2a3953c961cda13b6b5767370 /src/compiler/glsl | |
parent | 4c4d9e4f032d5753034361ee70aa88d16d3a04b4 (diff) |
glsl: Split process_block_array into two functions
One for the array parts and one for the leaf members. This will
simplify later changes.
The indentation is wonkey after this patch. This was done to make it
more obvious that the function is just getting split. The next patch
will fix the indentation.
Signed-off-by: Ian Romanick <[email protected]>
Cc: [email protected]
Reviewed-by: Timothy Arceri <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r-- | src/compiler/glsl/link_uniform_blocks.cpp | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/src/compiler/glsl/link_uniform_blocks.cpp b/src/compiler/glsl/link_uniform_blocks.cpp index a73b2d20937..8544b90db84 100644 --- a/src/compiler/glsl/link_uniform_blocks.cpp +++ b/src/compiler/glsl/link_uniform_blocks.cpp @@ -200,6 +200,15 @@ struct block { bool has_instance_name; }; +static void process_block_array_leaf(char **name, 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); + static void process_block_array(struct uniform_block_array_elements *ub_array, char **name, size_t name_length, gl_uniform_block *blocks, @@ -208,7 +217,6 @@ process_block_array(struct uniform_block_array_elements *ub_array, char **name, unsigned *block_index, unsigned *binding_offset, struct gl_context *ctx, struct gl_shader_program *prog) { - if (ub_array) { for (unsigned j = 0; j < ub_array->num_array_elements; j++) { size_t new_length = name_length; @@ -216,11 +224,26 @@ process_block_array(struct uniform_block_array_elements *ub_array, char **name, ralloc_asprintf_rewrite_tail(name, &new_length, "[%u]", ub_array->array_elements[j]); - process_block_array(ub_array->array, name, new_length, blocks, - parcel, variables, b, block_index, - binding_offset, ctx, prog); + if (ub_array->array) { + process_block_array(ub_array->array, name, new_length, blocks, + parcel, variables, b, block_index, + binding_offset, ctx, prog); + } else { + process_block_array_leaf(name, blocks, + parcel, variables, b, block_index, + binding_offset, ctx, prog); + } } - } else { +} + +static void +process_block_array_leaf(char **name, + 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) +{ unsigned i = *block_index; const glsl_type *type = b->type->without_array(); @@ -259,7 +282,6 @@ process_block_array(struct uniform_block_array_elements *ub_array, char **name, *block_index = *block_index + 1; *binding_offset = *binding_offset + 1; - } } /* This function resizes the array types of the block so that later we can use |