Mesa (staging/21.2): glsl: fix explicit-location ifc matching in presence of array types
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Aug 27 17:23:31 UTC 2021
Module: Mesa
Branch: staging/21.2
Commit: 18581c3a30f33694c29681f205e8878a5e405b94
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=18581c3a30f33694c29681f205e8878a5e405b94
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>
(cherry picked from commit 18962b94d31d82ae0a697c2afb731f4a447e1b54)
---
.pick_status.json | 2 +-
src/compiler/glsl/link_varyings.cpp | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 8fe665a2b9e..139cb6a71f1 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -832,7 +832,7 @@
"description": "glsl: fix explicit-location ifc matching in presence of array types",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": "c4545676d7f4e5f898bdc54d5574cd56ca7b9aad"
},
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