diff --git a/crates/encoding/src/path.rs b/crates/encoding/src/path.rs index b1d161525..b0a52b0b7 100644 --- a/crates/encoding/src/path.rs +++ b/crates/encoding/src/path.rs @@ -227,9 +227,10 @@ pub struct Path { pub struct Tile { /// Accumulated backdrop at the left edge of the tile. pub backdrop: i32, - /// An enum that can hold either a count or an index to the - /// beginning of an allocated slice. In the latter case, the - /// bits are inverted. + /// An enum that holds either the count of the number of path + /// segments in this tile, or an index to the beginning of an + /// allocated slice of `PathSegment` objects. In the latter case, + /// the bits are inverted. pub segment_count_or_ix: u32, } diff --git a/src/cpu_shader/backdrop.rs b/src/cpu_shader/backdrop.rs index 2a19fd843..746efdcde 100644 --- a/src/cpu_shader/backdrop.rs +++ b/src/cpu_shader/backdrop.rs @@ -1,5 +1,5 @@ // Copyright 2023 The Vello authors -// SPDX-License-Identifier: Apache-2.0 OR MIT +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense use vello_encoding::{ConfigUniform, Path, Tile}; diff --git a/src/cpu_shader/bbox_clear.rs b/src/cpu_shader/bbox_clear.rs index 014b905f5..1e02127d0 100644 --- a/src/cpu_shader/bbox_clear.rs +++ b/src/cpu_shader/bbox_clear.rs @@ -1,5 +1,5 @@ // Copyright 2023 The Vello authors -// SPDX-License-Identifier: Apache-2.0 OR MIT +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense use vello_encoding::{ConfigUniform, PathBbox}; diff --git a/src/cpu_shader/binning.rs b/src/cpu_shader/binning.rs index 8c2a79583..136e333c7 100644 --- a/src/cpu_shader/binning.rs +++ b/src/cpu_shader/binning.rs @@ -1,5 +1,5 @@ // Copyright 2023 The Vello authors -// SPDX-License-Identifier: Apache-2.0 OR MIT +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense use vello_encoding::{BinHeader, BumpAllocators, ConfigUniform, DrawMonoid, PathBbox}; diff --git a/src/cpu_shader/clip_leaf.rs b/src/cpu_shader/clip_leaf.rs index 63b528cf1..0f5fc6106 100644 --- a/src/cpu_shader/clip_leaf.rs +++ b/src/cpu_shader/clip_leaf.rs @@ -1,5 +1,5 @@ // Copyright 2023 The Vello authors -// SPDX-License-Identifier: Apache-2.0 OR MIT +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense use vello_encoding::{Clip, ConfigUniform, DrawMonoid, PathBbox}; diff --git a/src/cpu_shader/clip_reduce.rs b/src/cpu_shader/clip_reduce.rs index a8433bdee..96bc3582e 100644 --- a/src/cpu_shader/clip_reduce.rs +++ b/src/cpu_shader/clip_reduce.rs @@ -1,5 +1,5 @@ // Copyright 2023 The Vello authors -// SPDX-License-Identifier: Apache-2.0 OR MIT +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense use vello_encoding::{Clip, ClipBic, ClipElement, PathBbox}; diff --git a/src/cpu_shader/coarse.rs b/src/cpu_shader/coarse.rs index 69e5d5113..c54aa1076 100644 --- a/src/cpu_shader/coarse.rs +++ b/src/cpu_shader/coarse.rs @@ -1,5 +1,5 @@ // Copyright 2023 The Vello authors -// SPDX-License-Identifier: Apache-2.0 OR MIT +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense use vello_encoding::{BinHeader, BumpAllocators, ConfigUniform, DrawMonoid, DrawTag, Path, Tile}; diff --git a/src/cpu_shader/draw_leaf.rs b/src/cpu_shader/draw_leaf.rs index 4837d024e..1d699307b 100644 --- a/src/cpu_shader/draw_leaf.rs +++ b/src/cpu_shader/draw_leaf.rs @@ -1,5 +1,5 @@ // Copyright 2023 The Vello authors -// SPDX-License-Identifier: Apache-2.0 OR MIT +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense use vello_encoding::{Clip, ConfigUniform, DrawMonoid, DrawTag, Monoid, PathBbox}; diff --git a/src/cpu_shader/draw_reduce.rs b/src/cpu_shader/draw_reduce.rs index 9ec876e96..019b9416c 100644 --- a/src/cpu_shader/draw_reduce.rs +++ b/src/cpu_shader/draw_reduce.rs @@ -1,5 +1,5 @@ // Copyright 2023 The Vello authors -// SPDX-License-Identifier: Apache-2.0 OR MIT +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense use vello_encoding::{ConfigUniform, DrawMonoid, DrawTag, Monoid}; diff --git a/src/cpu_shader/fine.rs b/src/cpu_shader/fine.rs index a28cfe697..c64c87627 100644 --- a/src/cpu_shader/fine.rs +++ b/src/cpu_shader/fine.rs @@ -1,5 +1,5 @@ // Copyright 2023 The Vello authors -// SPDX-License-Identifier: Apache-2.0 OR MIT +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense use vello_encoding::{ConfigUniform, PathSegment, Tile}; diff --git a/src/cpu_shader/flatten.rs b/src/cpu_shader/flatten.rs index 41cc949d5..2cdf7256b 100644 --- a/src/cpu_shader/flatten.rs +++ b/src/cpu_shader/flatten.rs @@ -1,5 +1,5 @@ // Copyright 2023 The Vello authors -// SPDX-License-Identifier: Apache-2.0 OR MIT +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense use crate::cpu_dispatch::CpuBinding; diff --git a/src/cpu_shader/mod.rs b/src/cpu_shader/mod.rs index 6257aaf07..16d261f65 100644 --- a/src/cpu_shader/mod.rs +++ b/src/cpu_shader/mod.rs @@ -1,5 +1,5 @@ // Copyright 2023 The Vello authors -// SPDX-License-Identifier: Apache-2.0 OR MIT +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense //! CPU implementations of shader stages. diff --git a/src/cpu_shader/path_count.rs b/src/cpu_shader/path_count.rs index cc5f79f5a..b55cd1239 100644 --- a/src/cpu_shader/path_count.rs +++ b/src/cpu_shader/path_count.rs @@ -1,5 +1,5 @@ // Copyright 2023 The Vello authors -// SPDX-License-Identifier: Apache-2.0 OR MIT +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense use vello_encoding::{BumpAllocators, LineSoup, Path, SegmentCount, Tile}; diff --git a/src/cpu_shader/path_count_setup.rs b/src/cpu_shader/path_count_setup.rs index 1327d708d..6336cfd47 100644 --- a/src/cpu_shader/path_count_setup.rs +++ b/src/cpu_shader/path_count_setup.rs @@ -1,5 +1,5 @@ // Copyright 2023 The Vello authors -// SPDX-License-Identifier: Apache-2.0 OR MIT +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense use vello_encoding::{BumpAllocators, IndirectCount}; diff --git a/src/cpu_shader/path_tiling.rs b/src/cpu_shader/path_tiling.rs index fdd2d97db..53f5cd970 100644 --- a/src/cpu_shader/path_tiling.rs +++ b/src/cpu_shader/path_tiling.rs @@ -1,5 +1,5 @@ // Copyright 2023 The Vello authors -// SPDX-License-Identifier: Apache-2.0 OR MIT +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense use vello_encoding::{BumpAllocators, LineSoup, Path, PathSegment, SegmentCount, Tile}; diff --git a/src/cpu_shader/path_tiling_setup.rs b/src/cpu_shader/path_tiling_setup.rs index 8efee31b0..32e08f9ae 100644 --- a/src/cpu_shader/path_tiling_setup.rs +++ b/src/cpu_shader/path_tiling_setup.rs @@ -1,5 +1,5 @@ // Copyright 2023 The Vello authors -// SPDX-License-Identifier: Apache-2.0 OR MIT +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense use vello_encoding::{BumpAllocators, IndirectCount}; diff --git a/src/cpu_shader/pathtag_reduce.rs b/src/cpu_shader/pathtag_reduce.rs index 31979e8ed..58eb36c17 100644 --- a/src/cpu_shader/pathtag_reduce.rs +++ b/src/cpu_shader/pathtag_reduce.rs @@ -1,5 +1,5 @@ // Copyright 2023 The Vello authors -// SPDX-License-Identifier: Apache-2.0 OR MIT +// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense use vello_encoding::{ConfigUniform, Monoid, PathMonoid}; diff --git a/src/render.rs b/src/render.rs index 462563633..268007faa 100644 --- a/src/render.rs +++ b/src/render.rs @@ -139,7 +139,8 @@ impl Render { ); let mut pathtag_parent = reduced_buf; let mut large_pathtag_bufs = None; - if wg_counts.use_large_path_scan { + let use_large_path_scan = wg_counts.use_large_path_scan && !shaders.pathtag_is_cpu; + if use_large_path_scan { let reduced2_buf = ResourceProxy::new_buf( buffer_sizes.path_reduced2.size_in_bytes().into(), "reduced2_buf", @@ -166,7 +167,7 @@ impl Render { buffer_sizes.path_monoids.size_in_bytes().into(), "tagmonoid_buf", ); - let pathtag_scan = if wg_counts.use_large_path_scan { + let pathtag_scan = if use_large_path_scan { shaders.pathtag_scan_large } else { shaders.pathtag_scan diff --git a/src/shaders.rs b/src/shaders.rs index 0a73d2366..86e6ed7bd 100644 --- a/src/shaders.rs +++ b/src/shaders.rs @@ -79,6 +79,9 @@ pub struct FullShaders { pub path_tiling_setup: ShaderId, pub path_tiling: ShaderId, pub fine: ShaderId, + // 2-level dispatch works for CPU pathtag scan even for large + // inputs, 3-level is not yet implemented. + pub pathtag_is_cpu: bool, } #[cfg(feature = "wgpu")] @@ -324,6 +327,7 @@ pub fn full_shaders(device: &Device, engine: &mut WgpuEngine) -> Result