From f6e9e7d3ce25a3e0460bd558886cf0e884eaee7a Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 16 Jul 2024 18:10:52 -0400 Subject: [PATCH] libagx: fix prefix sum kernel the calculation of workgroup reductions was wrong, giving nondeterministic results when prefix summing >= 1024 items. fixes misrendering in terraintessellation on honeykrisp. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/lib/shaders/geometry.cl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/asahi/lib/shaders/geometry.cl b/src/asahi/lib/shaders/geometry.cl index e672f931172..215557e04c2 100644 --- a/src/asahi/lib/shaders/geometry.cl +++ b/src/asahi/lib/shaders/geometry.cl @@ -587,7 +587,7 @@ libagx_work_group_scan_inclusive_add(uint x, local uint *scratch) uint prefix = base + sg; /* Reduce the workgroup using the prefix sum we already did */ - uint reduction = sub_group_broadcast(other_sums, 31) + other_sum; + uint reduction = sub_group_broadcast(other_sums + other_sum, 31); return (uint2)(prefix, reduction); }