intel/compiler: Fix missing tie-breaker in brw_nir_analyze_ubo_ranges() ordering code

Per Ken suggestion, use ascending order for the start offset.

Fixes: 6d28c6e52c ("i965: Select ranges of UBO data to be uploaded as push constants.")
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19731>
(cherry picked from commit 494e2edb90)
This commit is contained in:
Caio Oliveira
2022-11-13 16:19:48 -08:00
committed by Dylan Baker
parent 6922ca94b3
commit 2828fae0cf
2 changed files with 5 additions and 5 deletions

View File

@@ -949,7 +949,7 @@
"description": "intel/compiler: Fix missing tie-breaker in brw_nir_analyze_ubo_ranges() ordering code",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "6d28c6e52cfd76855c1368560dd90f12493e2580"
},

View File

@@ -67,16 +67,16 @@ cmp_ubo_range_entry(const void *va, const void *vb)
const struct ubo_range_entry *a = va;
const struct ubo_range_entry *b = vb;
/* Rank based on scores */
/* Rank based on scores, descending order */
int delta = score(b) - score(a);
/* Then use the UBO block index as a tie-breaker */
/* Then use the UBO block index as a tie-breaker, descending order */
if (delta == 0)
delta = b->range.block - a->range.block;
/* Finally use the UBO offset as a second tie-breaker */
/* Finally use the start offset as a second tie-breaker, ascending order */
if (delta == 0)
delta = b->range.block - a->range.block;
delta = a->range.start - b->range.start;
return delta;
}