Module: Mesa Branch: master Commit: ce5e2e21317d0bd29b4b46f8efd37985a62f5460 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ce5e2e21317d0bd29b4b46f8efd37985a62f5460
Author: James Park <[email protected]> Date: Sun Nov 1 15:34:28 2020 -0800 nir: Stabilize compact_components sort Incorporate location_frac into qsort comparison. qsort is not required to be stable, and MSVC implementation is not. Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7399> --- src/compiler/nir/nir_linking_helpers.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c index 2159e7c6886..249ec482e1c 100644 --- a/src/compiler/nir/nir_linking_helpers.c +++ b/src/compiler/nir/nir_linking_helpers.c @@ -475,7 +475,11 @@ cmp_varying_component(const void *comp1_v, const void *comp2_v) return comp1->interp_loc - comp2->interp_loc; /* If everything else matches just use the original location to sort */ - return comp1->var->data.location - comp2->var->data.location; + const struct nir_variable_data *const data1 = &comp1->var->data; + const struct nir_variable_data *const data2 = &comp2->var->data; + if (data1->location != data2->location) + return data1->location - data2->location; + return (int)data1->location_frac - (int)data2->location_frac; } static void _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
