Mesa (main): nir: fix sorting before assigning varying driver locations

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue May 3 00:52:19 UTC 2022


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

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Thu Apr 28 13:24:06 2022 +1000

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 <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16208>

---

 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;
       }



More information about the mesa-commit mailing list