Commit c30ca431 authored by Jordan Justen's avatar Jordan Justen

glsl link_varyings: link interface blocks using the block name

Signed-off-by: default avatarJordan Justen <jordan.l.justen@intel.com>
Reviewed-by: default avatarKenneth Graunke <kenneth@whitecape.org>
parent 5ebf5473
...@@ -993,6 +993,8 @@ assign_varying_locations(struct gl_context *ctx, ...@@ -993,6 +993,8 @@ assign_varying_locations(struct gl_context *ctx,
= hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare); = hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare);
hash_table *consumer_inputs hash_table *consumer_inputs
= hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare); = hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare);
hash_table *consumer_interface_inputs
= hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare);
/* Operate in a total of three passes. /* Operate in a total of three passes.
* *
...@@ -1011,8 +1013,17 @@ assign_varying_locations(struct gl_context *ctx, ...@@ -1011,8 +1013,17 @@ assign_varying_locations(struct gl_context *ctx,
((ir_instruction *) node)->as_variable(); ((ir_instruction *) node)->as_variable();
if ((input_var != NULL) && (input_var->mode == ir_var_shader_in)) { if ((input_var != NULL) && (input_var->mode == ir_var_shader_in)) {
hash_table_insert(consumer_inputs, input_var, if (input_var->interface_type != NULL) {
ralloc_strdup(mem_ctx, input_var->name)); char *const iface_field_name =
ralloc_asprintf(mem_ctx, "%s.%s",
input_var->interface_type->name,
input_var->name);
hash_table_insert(consumer_interface_inputs, input_var,
iface_field_name);
} else {
hash_table_insert(consumer_inputs, input_var,
ralloc_strdup(mem_ctx, input_var->name));
}
} }
} }
} }
...@@ -1026,8 +1037,19 @@ assign_varying_locations(struct gl_context *ctx, ...@@ -1026,8 +1037,19 @@ assign_varying_locations(struct gl_context *ctx,
tfeedback_candidate_generator g(mem_ctx, tfeedback_candidates); tfeedback_candidate_generator g(mem_ctx, tfeedback_candidates);
g.process(output_var); g.process(output_var);
ir_variable *input_var = ir_variable *input_var;
(ir_variable *) hash_table_find(consumer_inputs, output_var->name); if (output_var->interface_type != NULL) {
char *const iface_field_name =
ralloc_asprintf(mem_ctx, "%s.%s",
output_var->interface_type->name,
output_var->name);
input_var =
(ir_variable *) hash_table_find(consumer_interface_inputs,
iface_field_name);
} else {
input_var =
(ir_variable *) hash_table_find(consumer_inputs, output_var->name);
}
if (input_var && input_var->mode != ir_var_shader_in) if (input_var && input_var->mode != ir_var_shader_in)
input_var = NULL; input_var = NULL;
...@@ -1047,6 +1069,7 @@ assign_varying_locations(struct gl_context *ctx, ...@@ -1047,6 +1069,7 @@ assign_varying_locations(struct gl_context *ctx,
if (matched_candidate == NULL) { if (matched_candidate == NULL) {
hash_table_dtor(tfeedback_candidates); hash_table_dtor(tfeedback_candidates);
hash_table_dtor(consumer_inputs); hash_table_dtor(consumer_inputs);
hash_table_dtor(consumer_interface_inputs);
return false; return false;
} }
...@@ -1064,12 +1087,14 @@ assign_varying_locations(struct gl_context *ctx, ...@@ -1064,12 +1087,14 @@ assign_varying_locations(struct gl_context *ctx,
if (!tfeedback_decls[i].assign_location(ctx, prog)) { if (!tfeedback_decls[i].assign_location(ctx, prog)) {
hash_table_dtor(tfeedback_candidates); hash_table_dtor(tfeedback_candidates);
hash_table_dtor(consumer_inputs); hash_table_dtor(consumer_inputs);
hash_table_dtor(consumer_interface_inputs);
return false; return false;
} }
} }
hash_table_dtor(tfeedback_candidates); hash_table_dtor(tfeedback_candidates);
hash_table_dtor(consumer_inputs); hash_table_dtor(consumer_inputs);
hash_table_dtor(consumer_interface_inputs);
if (ctx->Const.DisableVaryingPacking) { if (ctx->Const.DisableVaryingPacking) {
/* Transform feedback code assumes varyings are packed, so if the driver /* Transform feedback code assumes varyings are packed, so if the driver
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment