Mesa (main): glsl: fix explicit-location ifc matching in presence of array types

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Aug 26 05:09:31 UTC 2021


Module: Mesa
Branch: main
Commit: 18962b94d31d82ae0a697c2afb731f4a447e1b54
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=18962b94d31d82ae0a697c2afb731f4a447e1b54

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Thu Aug 19 17:59:18 2021 -0400

glsl: fix explicit-location ifc matching in presence of array types

We were treating each field as if it took up a single slot. However
that's not the case. And with strict matching (GLSL 4.20+ / ES 3.1+) we
would end up not matching identical interfaces.

Fixes: c4545676d7 ("glsl/linker: fix location aliasing checks for interface variables")
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12479>

---

 src/compiler/glsl/link_varyings.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index 9954a731479..997513a636d 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -660,9 +660,11 @@ validate_explicit_variable_location(struct gl_context *ctx,
          glsl_struct_field *field = &type_without_array->fields.structure[i];
          unsigned field_location = field->location -
             (field->patch ? VARYING_SLOT_PATCH0 : VARYING_SLOT_VAR0);
+         unsigned field_slots = field->type->count_attribute_slots(false);
          if (!check_location_aliasing(explicit_locations, var,
                                       field_location,
-                                      0, field_location + 1,
+                                      0,
+                                      field_location + field_slots,
                                       field->type,
                                       field->interpolation,
                                       field->centroid,



More information about the mesa-commit mailing list