Mesa (master): nir: fix assign_io_var_locations for vertex inputs
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Dec 19 21:40:53 UTC 2019
Module: Mesa
Branch: master
Commit: 06ae0674fd64215793878c4933065e1692d0e285
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=06ae0674fd64215793878c4933065e1692d0e285
Author: Jonathan Marek <jonathan at marek.ca>
Date: Sun Dec 15 18:50:29 2019 -0500
nir: fix assign_io_var_locations for vertex inputs
Also fixes fragment inputs using the wrong "base" value (which was working
only because FRAG_RESULT_DATA0 is less than VARYING_SLOT_VAR0)
Signed-off-by: Jonathan Marek <jonathan at marek.ca>
Reviewed-by: Eric Anholt <eric at anholt.net>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3108>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3108>
---
src/compiler/nir/nir_linking_helpers.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c
index 8d7302c93c1..e1cf58f3514 100644
--- a/src/compiler/nir/nir_linking_helpers.c
+++ b/src/compiler/nir/nir_linking_helpers.c
@@ -1007,9 +1007,6 @@ nir_assign_io_var_locations(struct exec_list *var_list, unsigned *size,
sort_varyings(var_list);
- const int base = stage == MESA_SHADER_FRAGMENT ?
- (int) FRAG_RESULT_DATA0 : (int) VARYING_SLOT_VAR0;
-
int UNUSED last_loc = 0;
bool last_partial = false;
nir_foreach_variable(var, var_list) {
@@ -1019,6 +1016,15 @@ nir_assign_io_var_locations(struct exec_list *var_list, unsigned *size,
type = glsl_get_array_element(type);
}
+ int base;
+ if (var->data.mode == nir_var_shader_in && stage == MESA_SHADER_VERTEX)
+ base = VERT_ATTRIB_GENERIC0;
+ else if (var->data.mode == nir_var_shader_out &&
+ stage == MESA_SHADER_FRAGMENT)
+ base = FRAG_RESULT_DATA0;
+ else
+ base = VARYING_SLOT_VAR0;
+
unsigned var_size;
if (var->data.compact) {
/* compact variables must be arrays of scalars */
More information about the mesa-commit
mailing list