summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2016-06-06 10:33:51 +1000
committerDave Airlie <[email protected]>2016-06-06 12:54:41 +1000
commit1f66a4b68955b9d6cae629cec90e5e0f301c6a7a (patch)
tree18730c9efbe155967fa2e5957caead782220032f /src/compiler/glsl
parent6702c1581092bce230742d02ebf9325f68bd247a (diff)
glsl: for anonymous struct matching use without_array() (v3)
With tessellation shaders we can have cases where we have arrays of anon structs, so make sure we match using without_array(). Fixes: GL45-CTS.tessellation_shader.tessellation_control_to_tessellation_evaluation.gl_in v2: test lengths match as well (Ilia) v3: descend array lengths to check for matches as well (Ilia) Reviewed-by: Ilia Mirkin <[email protected]> Cc: "12.0" <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r--src/compiler/glsl/link_varyings.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index a286e773b30..5a5adc0a410 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -182,6 +182,25 @@ process_xfb_layout_qualifiers(void *mem_ctx, const gl_shader *sh,
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
* matching input to another stage.
@@ -226,9 +245,7 @@ cross_validate_types_and_qualifiers(struct gl_shader_program *prog,
* fragment language."
*/
if (!output->type->is_array() || !is_gl_identifier(output->name)) {
- bool anon_matches = output->type->is_anonymous() &&
- type_to_match->is_anonymous() &&
- type_to_match->record_compare(output->type);
+ bool anon_matches = anonymous_struct_type_matches(output->type, type_to_match);
if (!anon_matches) {
linker_error(prog,