diff options
author | Ian Romanick <[email protected]> | 2013-10-02 15:57:03 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2014-05-02 07:19:40 -0700 |
commit | 5699220cd5719be6fbafdefd75025a817bcb200a (patch) | |
tree | 13eb1d5646321306f23822670a1bcd270c528f43 /src/glsl/link_varyings.cpp | |
parent | ba7195d126ce20bf74a27725224662aaca4d90ef (diff) |
glsl: Exit when the shader IR contains an interface block instance
While writing the link_varyings::single_interface_input test, I
discovered that populate_consumer_input_sets assumes that all shader
interface blocks have been lowered to discrete variables. Since there
is a pass that does this, it is a reasonable assumption. It was,
however, non-obvious. Make the code fail when it encounters such a
thing, and add a test to verify that behavior.
Signed-off-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/glsl/link_varyings.cpp')
-rw-r--r-- | src/glsl/link_varyings.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp index 3a6dfc87148..8935c89fdb0 100644 --- a/src/glsl/link_varyings.cpp +++ b/src/glsl/link_varyings.cpp @@ -1038,7 +1038,7 @@ private: namespace linker { -void +bool populate_consumer_input_sets(void *mem_ctx, exec_list *ir, hash_table *consumer_inputs, hash_table *consumer_interface_inputs) @@ -1047,6 +1047,9 @@ populate_consumer_input_sets(void *mem_ctx, exec_list *ir, ir_variable *const input_var = ((ir_instruction *) node)->as_variable(); if ((input_var != NULL) && (input_var->data.mode == ir_var_shader_in)) { + if (input_var->type->is_interface()) + return false; + if (input_var->get_interface_type() != NULL) { char *const iface_field_name = ralloc_asprintf(mem_ctx, "%s.%s", @@ -1060,6 +1063,8 @@ populate_consumer_input_sets(void *mem_ctx, exec_list *ir, } } } + + return true; } } @@ -1116,11 +1121,17 @@ assign_varying_locations(struct gl_context *ctx, * not being inputs. This lets the optimizer eliminate them. */ - if (consumer) - linker::populate_consumer_input_sets(mem_ctx, - consumer->ir, - consumer_inputs, - consumer_interface_inputs); + if (consumer + && !linker::populate_consumer_input_sets(mem_ctx, + consumer->ir, + consumer_inputs, + consumer_interface_inputs)) { + assert(!"populate_consumer_input_sets failed"); + hash_table_dtor(tfeedback_candidates); + hash_table_dtor(consumer_inputs); + hash_table_dtor(consumer_interface_inputs); + return false; + } foreach_list(node, producer->ir) { ir_variable *const output_var = ((ir_instruction *) node)->as_variable(); |