Skip to content

Commit

Permalink
Fix pathtag limit, add unlicense
Browse files Browse the repository at this point in the history
Adds Unlicense to the SPDX line, and also relaxes the 64k (or any) limit on the number of pathtags in the CPU case.

The CPU shaders don't exactly match the GPU in the "use_large_path_scan" case, but they do work.
  • Loading branch information
raphlinus committed Oct 10, 2023
1 parent d2c2a26 commit 5080af0
Show file tree
Hide file tree
Showing 19 changed files with 28 additions and 21 deletions.
7 changes: 4 additions & 3 deletions crates/encoding/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down
2 changes: 1 addition & 1 deletion src/cpu_shader/backdrop.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
2 changes: 1 addition & 1 deletion src/cpu_shader/bbox_clear.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
2 changes: 1 addition & 1 deletion src/cpu_shader/binning.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
2 changes: 1 addition & 1 deletion src/cpu_shader/clip_leaf.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
2 changes: 1 addition & 1 deletion src/cpu_shader/clip_reduce.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
2 changes: 1 addition & 1 deletion src/cpu_shader/coarse.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
2 changes: 1 addition & 1 deletion src/cpu_shader/draw_leaf.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
2 changes: 1 addition & 1 deletion src/cpu_shader/draw_reduce.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
2 changes: 1 addition & 1 deletion src/cpu_shader/fine.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
2 changes: 1 addition & 1 deletion src/cpu_shader/flatten.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/cpu_shader/mod.rs
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 1 addition & 1 deletion src/cpu_shader/path_count.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
2 changes: 1 addition & 1 deletion src/cpu_shader/path_count_setup.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
2 changes: 1 addition & 1 deletion src/cpu_shader/path_tiling.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
2 changes: 1 addition & 1 deletion src/cpu_shader/path_tiling_setup.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
2 changes: 1 addition & 1 deletion src/cpu_shader/pathtag_reduce.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
5 changes: 3 additions & 2 deletions src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/shaders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down Expand Up @@ -324,6 +327,7 @@ pub fn full_shaders(device: &Device, engine: &mut WgpuEngine) -> Result<FullShad
path_tiling_setup,
path_tiling,
fine,
pathtag_is_cpu: false,
})
}

Expand Down Expand Up @@ -355,6 +359,7 @@ impl FullShaders {
engine.set_cpu_shader(self.coarse, cpu_shader::coarse);
engine.set_cpu_shader(self.path_tiling_setup, cpu_shader::path_tiling_setup);
engine.set_cpu_shader(self.path_tiling, cpu_shader::path_tiling);
self.pathtag_is_cpu = true;
}
}

Expand Down

0 comments on commit 5080af0

Please sign in to comment.