From 180398f7851a01d9cb2879a426f3cf1b4686c917 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Thu, 28 Apr 2022 13:24:06 +1000 Subject: [PATCH] nir: fix sorting before assigning varying driver locations We need to make sure we also properly sort varyings sharing a single slot otherwise we can end up assigning earlier components to the next slot if we have already processed later components. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6392 Fixes: 1e93b0caa10d ("mesa/st: add support for NIR as possible driver IR") Reviewed-by: Emma Anholt Part-of: --- src/compiler/nir/nir_linking_helpers.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c index 1d056fc97b1..7c21b63dc19 100644 --- a/src/compiler/nir/nir_linking_helpers.c +++ b/src/compiler/nir/nir_linking_helpers.c @@ -1433,7 +1433,9 @@ insert_sorted(struct exec_list *var_list, nir_variable *new_var) */ if (new_var->data.per_primitive < var->data.per_primitive || (new_var->data.per_primitive == var->data.per_primitive && - var->data.location > new_var->data.location)) { + (var->data.location > new_var->data.location || + (var->data.location == new_var->data.location && + var->data.location_frac > new_var->data.location_frac)))) { exec_node_insert_node_before(&var->node, &new_var->node); return; }