Skip to content

Commit

Permalink
[encoding] Fix path_reduced_scan buffer size (#551)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
armansito authored Apr 19, 2024
1 parent a9ede86 commit b1dc07e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/encoding/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b1dc07e

Please sign in to comment.