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: 1e93b0caa1 ("mesa/st: add support for NIR as possible driver IR")

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16208>
This commit is contained in:
Timothy Arceri
2022-04-28 13:24:06 +10:00
committed by Marge Bot
parent 067023dce2
commit 180398f785

View File

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