[Mesa-dev] [PATCH] glsl: for anonymous struct matching use without_array() (v2)

Dave Airlie airlied at gmail.com
Mon Jun 6 01:09:02 UTC 2016


From: Dave Airlie <airlied at redhat.com>

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)

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/compiler/glsl/link_varyings.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index a286e77..2252cad 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -226,9 +226,12 @@ 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);
+         const struct glsl_type *to_match_wa = type_to_match->without_array();
+         const struct glsl_type *out_type_wa = output->type->without_array();
+         bool anon_matches = out_type_wa->is_anonymous() &&
+            to_match_wa->is_anonymous() &&
+            to_match_wa->record_compare(out_type_wa) &&
+            (type_to_match->array_size() == output->type->array_size());
 
          if (!anon_matches) {
             linker_error(prog,
-- 
2.7.4



More information about the mesa-dev mailing list