mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 15:40:11 +01:00
glsl: simplify varying matching
Unnamed struct types are now equal if they have the same field. Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
parent
f97c92ae11
commit
d21a35d63c
1 changed files with 9 additions and 32 deletions
|
|
@ -184,25 +184,6 @@ process_xfb_layout_qualifiers(void *mem_ctx, const gl_linked_shader *sh,
|
||||||
return has_xfb_qualifiers;
|
return has_xfb_qualifiers;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
|
||||||
anonymous_struct_type_matches(const glsl_type *output_type,
|
|
||||||
const glsl_type *to_match)
|
|
||||||
{
|
|
||||||
while (output_type->is_array() && to_match->is_array()) {
|
|
||||||
/* if the lengths at each level don't match fail. */
|
|
||||||
if (output_type->length != to_match->length)
|
|
||||||
return false;
|
|
||||||
output_type = output_type->fields.array;
|
|
||||||
to_match = to_match->fields.array;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (output_type->is_array() || to_match->is_array())
|
|
||||||
return false;
|
|
||||||
return output_type->is_anonymous() &&
|
|
||||||
to_match->is_anonymous() &&
|
|
||||||
to_match->record_compare(output_type);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate the types and qualifiers of an output from one stage against the
|
* Validate the types and qualifiers of an output from one stage against the
|
||||||
* matching input to another stage.
|
* matching input to another stage.
|
||||||
|
|
@ -247,19 +228,15 @@ cross_validate_types_and_qualifiers(struct gl_shader_program *prog,
|
||||||
* fragment language."
|
* fragment language."
|
||||||
*/
|
*/
|
||||||
if (!output->type->is_array() || !is_gl_identifier(output->name)) {
|
if (!output->type->is_array() || !is_gl_identifier(output->name)) {
|
||||||
bool anon_matches = anonymous_struct_type_matches(output->type, type_to_match);
|
linker_error(prog,
|
||||||
|
"%s shader output `%s' declared as type `%s', "
|
||||||
if (!anon_matches) {
|
"but %s shader input declared as type `%s'\n",
|
||||||
linker_error(prog,
|
_mesa_shader_stage_to_string(producer_stage),
|
||||||
"%s shader output `%s' declared as type `%s', "
|
output->name,
|
||||||
"but %s shader input declared as type `%s'\n",
|
output->type->name,
|
||||||
_mesa_shader_stage_to_string(producer_stage),
|
_mesa_shader_stage_to_string(consumer_stage),
|
||||||
output->name,
|
input->type->name);
|
||||||
output->type->name,
|
return;
|
||||||
_mesa_shader_stage_to_string(consumer_stage),
|
|
||||||
input->type->name);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue