From 612f3db2a99ee978925a4dea46d09ef147f75fde Mon Sep 17 00:00:00 2001 From: Arman Uguray Date: Fri, 19 Apr 2024 09:43:04 -0700 Subject: [PATCH] [encoding] Fix path_reduced_scan buffer size This is the intermediate TagMonoid buffer that is used by the two-stage scan in the "use_large_path_scan" case. This needs to be the same size as the overall path_reduce output buffer, which gets rounded up to a multiple of the path_reduce workgroup size. This hasn't been a problem until now because src/wgpu_engine.rs allocates Buffers that are generally larger than the entries returned in the BufferSizes structure, due its quantized size class / pooling strategy. The bindings get their view size assigned based on the whole size of the buffer. Skia uses a similar allocation strategy but assigns view size to be the precise value from BufferSizes. This causes incorrect behavior as WGSL clamps buffer accesses to the view size. The now corrected buffer size fixes this issue. --- crates/encoding/src/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/encoding/src/config.rs b/crates/encoding/src/config.rs index 78c9d7f0f..8b44bb9ba 100644 --- a/crates/encoding/src/config.rs +++ b/crates/encoding/src/config.rs @@ -368,7 +368,7 @@ impl BufferSizes { }; let path_reduced = BufferSize::new(reduced_size); let path_reduced2 = BufferSize::new(PATH_REDUCE_WG); - let path_reduced_scan = BufferSize::new(path_tag_wgs); + let path_reduced_scan = BufferSize::new(reduced_size); let path_monoids = BufferSize::new(path_tag_wgs * PATH_REDUCE_WG); let path_bboxes = BufferSize::new(n_paths); let binning_wgs = workgroups.binning.0;