mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-22 06:20:22 +01:00
glsl: add mark_array_elements_referenced() fast path
Add a fast path for single dimension arrays. This is around 3x faster on large arrays. For example when testing a shader from issue 9953 compile time went from ~12 seconds down to ~4 seconds. Issue: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9953 Acked-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36366>
This commit is contained in:
parent
8579c21798
commit
cb558b2b88
1 changed files with 18 additions and 0 deletions
|
|
@ -129,6 +129,24 @@ mark_array_elements_referenced(const struct array_deref_range *dr,
|
|||
if (count != array_depth)
|
||||
return;
|
||||
|
||||
/* Single dimension array fast path. This is the most common path as most
|
||||
* arrays are only one dimension. This path is around 3x faster on large
|
||||
* arrays than _mark_array_elements_referenced().
|
||||
*/
|
||||
if (count == 1) {
|
||||
if (dr[0].size == 0)
|
||||
return;
|
||||
|
||||
if (dr[0].index < dr[0].size) {
|
||||
BITSET_SET(bits, dr[0].index);
|
||||
} else {
|
||||
/* Accessed by non-constant index so set everything as referenced */
|
||||
BITSET_SET_RANGE(bits, 0, dr[0].size - 1);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
_mark_array_elements_referenced(dr, count, 1, 0, bits);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue