diff --git a/crates/encoding/src/config.rs b/crates/encoding/src/config.rs index 53a48a1..71dab31 100644 --- a/crates/encoding/src/config.rs +++ b/crates/encoding/src/config.rs @@ -1,6 +1,6 @@ use super::{ - BinHeader, Clip, ClipBbox, ClipBic, ClipElement, Cubic, DrawBbox, DrawMonoid, Encoding, Layout, - Path, PathBbox, PathMonoid, PathSegment, Tile, + BinHeader, Clip, ClipBbox, ClipBic, ClipElement, Cubic, DrawBbox, DrawMonoid, Layout, Path, + PathBbox, PathMonoid, PathSegment, Tile, }; use bytemuck::{Pod, Zeroable}; use std::mem; @@ -8,7 +8,8 @@ use std::mem; const TILE_WIDTH: u32 = 16; const TILE_HEIGHT: u32 = 16; -const PATH_REDUCE_WG: u32 = 256; +// TODO: Obtain these from the vello_shaders crate +pub(crate) const PATH_REDUCE_WG: u32 = 256; const PATH_BBOX_WG: u32 = 256; const PATH_COARSE_WG: u32 = 256; const CLIP_REDUCE_WG: u32 = 256; diff --git a/crates/encoding/src/resolve.rs b/crates/encoding/src/resolve.rs index d7d3dc6..644aea0 100644 --- a/crates/encoding/src/resolve.rs +++ b/crates/encoding/src/resolve.rs @@ -137,7 +137,6 @@ impl Resolver { &'a mut self, encoding: &Encoding, packed: &mut Vec, - workgroup_size: u32, ) -> (Layout, Ramps<'a>, Images<'a>) { let sizes = self.resolve_patches(encoding); self.resolve_pending_images(); @@ -149,7 +148,7 @@ impl Resolver { // Compute size of data buffer let n_path_tags = encoding.path_tags.len() + sizes.path_tags + encoding.n_open_clips as usize; - let path_tag_padded = align_up(n_path_tags, 4 * workgroup_size); + let path_tag_padded = align_up(n_path_tags, 4 * crate::config::PATH_REDUCE_WG); let capacity = path_tag_padded + slice_size_in_bytes(&encoding.path_data, sizes.path_data) + slice_size_in_bytes( diff --git a/src/render.rs b/src/render.rs index f7d80e0..600aded 100644 --- a/src/render.rs +++ b/src/render.rs @@ -75,8 +75,7 @@ impl Render { let mut recording = Recording::default(); let mut resolver = Resolver::new(); let mut packed = vec![]; - let (layout, ramps, images) = - resolver.resolve(encoding, &mut packed, shaders::PATHTAG_REDUCE_WG); + let (layout, ramps, images) = resolver.resolve(encoding, &mut packed); let gradient_image = if ramps.height == 0 { ResourceProxy::new_image(1, 1, ImageFormat::Rgba8) } else { diff --git a/src/shaders.rs b/src/shaders.rs index 92d1bb9..d1cc0dc 100644 --- a/src/shaders.rs +++ b/src/shaders.rs @@ -24,12 +24,6 @@ use wgpu::Device; use crate::engine::{BindType, Engine, Error, ImageFormat, ShaderId}; -pub const PATHTAG_REDUCE_WG: u32 = 256; -pub const PATH_BBOX_WG: u32 = 256; -pub const PATH_COARSE_WG: u32 = 256; -pub const PATH_DRAWOBJ_WG: u32 = 256; -pub const CLIP_REDUCE_WG: u32 = 256; - macro_rules! shader { ($name:expr) => {&{ let shader = include_str!(concat!(