mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-12-02 14:43:59 +08:00
glsl: Use a stable attr sort for VS in / FS out
This is a perpetual bug that hits Windows. In the MSVC CRT, qsort is unstable, where the glibc qsort is stable. So apps run fine on Windows IHV drivers, and on Linux Mesa drivers, and only break down when running on Windows Mesa drivers. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10922 Reviewed-by: Sil Vilerino <sivileri@microsoft.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28586>
This commit is contained in:
parent
6a7e576017
commit
acbf3ad1fb
@ -50,6 +50,7 @@
|
||||
/* Temporary storage for the set of attributes that need locations assigned. */
|
||||
struct temp_attr {
|
||||
unsigned slots;
|
||||
unsigned original_idx;
|
||||
nir_variable *var;
|
||||
};
|
||||
|
||||
@ -61,7 +62,10 @@ compare_attr(const void *a, const void *b)
|
||||
const struct temp_attr *const r = (const struct temp_attr *) b;
|
||||
|
||||
/* Reversed because we want a descending order sort below. */
|
||||
return r->slots - l->slots;
|
||||
if (r->slots != l->slots)
|
||||
return r->slots - l->slots;
|
||||
|
||||
return l->original_idx - r->original_idx;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1238,6 +1242,7 @@ assign_attribute_or_color_locations(void *mem_ctx,
|
||||
}
|
||||
to_assign[num_attr].slots = slots;
|
||||
to_assign[num_attr].var = var;
|
||||
to_assign[num_attr].original_idx = num_attr;
|
||||
num_attr++;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user