diff --git a/Cargo.toml b/Cargo.toml index 1fcc489b4..975c39976 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ members = [ "examples/headless", "examples/with_winit", - "examples/with_bevy", + # "examples/with_bevy", # Disable for now until bevy is using wgpu 0.17 "examples/run_wasm", "examples/scenes", ] @@ -52,9 +52,9 @@ wgpu-profiler = { workspace = true, optional = true } [workspace.dependencies] bytemuck = { version = "1.12.1", features = ["derive"] } -fello = { git = "https://github.com/dfrg/fount", rev = "58a284eaae67512fb61cf76177c5d33238d79cb1" } +fello = { git = "https://github.com/dfrg/fount", rev = "dadbcf75695f035ca46766bfd60555d05bd421b1" } peniko = { git = "https://github.com/linebender/peniko", rev = "cafdac9a211a0fb2fec5656bd663d1ac770bcc81" } -wgpu = "0.16" # NOTE: Make sure to keep this in sync with the version badge in README.md +wgpu = "0.17" # NOTE: Make sure to keep this in sync with the version badge in README.md # Used for examples @@ -62,4 +62,4 @@ clap = "4.1.0" anyhow = "1.0" instant = { version = "0.1.12", features = ["wasm-bindgen"] } pollster = "0.3.0" -wgpu-profiler = "0.12.1" +wgpu-profiler = "0.13" diff --git a/README.md b/README.md index 97f68614e..89ca52651 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![Xi Zulip](https://img.shields.io/badge/Xi%20Zulip-%23gpu-blue?logo=Zulip)](https://xi.zulipchat.com/#narrow/stream/197075-gpu) [![dependency status](https://deps.rs/repo/github/linebender/vello/status.svg)](https://deps.rs/repo/github/linebender/vello) [![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)](#license) -[![wgpu version](https://img.shields.io/badge/wgpu-v0.16-orange.svg)](https://crates.io/crates/wgpu) +[![wgpu version](https://img.shields.io/badge/wgpu-v0.17-orange.svg)](https://crates.io/crates/wgpu) diff --git a/crates/encoding/Cargo.toml b/crates/encoding/Cargo.toml index c93d8171d..324453eda 100644 --- a/crates/encoding/Cargo.toml +++ b/crates/encoding/Cargo.toml @@ -1,8 +1,9 @@ [package] name = "vello_encoding" version = "0.1.0" -edition = "2021" +edition.workspace = true license.workspace = true +repository.workspace = true [features] default = ["full"] diff --git a/crates/encoding/src/resolve.rs b/crates/encoding/src/resolve.rs index a1d3eed58..dfd89bc8d 100644 --- a/crates/encoding/src/resolve.rs +++ b/crates/encoding/src/resolve.rs @@ -415,7 +415,9 @@ impl Resolver { let run = &resources.glyph_runs[*index]; let font_id = run.font.data.id(); let font_size_u32 = run.font_size.to_bits(); - let Ok(font_file) = fello::raw::FileRef::new(run.font.data.as_ref()) else { continue }; + let Ok(font_file) = fello::raw::FileRef::new(run.font.data.as_ref()) else { + continue; + }; let font = match font_file { fello::raw::FileRef::Font(font) => Some(font), fello::raw::FileRef::Collection(collection) => { diff --git a/crates/shaders/Cargo.toml b/crates/shaders/Cargo.toml index 369f5a197..bb534f956 100644 --- a/crates/shaders/Cargo.toml +++ b/crates/shaders/Cargo.toml @@ -1,8 +1,9 @@ [package] name = "vello_shaders" version = "0.1.0" -edition = "2021" +edition.workspace = true license.workspace = true +repository.workspace = true [features] default = ["compile", "wgsl", "msl"] @@ -11,10 +12,10 @@ wgsl = [] msl = [] [dependencies] -naga = { version = "0.12", features = ["wgsl-in", "msl-out", "validate"], optional = true } +naga = { version = "0.13", features = ["wgsl-in", "msl-out", "validate"], optional = true } thiserror = { version = "1.0.40", optional = true } [build-dependencies] -naga = { version = "0.12", features = ["wgsl-in", "msl-out", "validate"] } +naga = { version = "0.13", features = ["wgsl-in", "msl-out", "validate"] } thiserror = "1.0.40" diff --git a/crates/shaders/src/compile/mod.rs b/crates/shaders/src/compile/mod.rs index 98d116d71..5325902b6 100644 --- a/crates/shaders/src/compile/mod.rs +++ b/crates/shaders/src/compile/mod.rs @@ -5,8 +5,7 @@ use { naga::{ front::wgsl, valid::{Capabilities, ModuleInfo, ValidationError, ValidationFlags}, - AddressSpace, ArraySize, ConstantInner, ImageClass, Module, ScalarValue, StorageAccess, - WithSpan, + AddressSpace, ArraySize, ImageClass, Module, StorageAccess, WithSpan, }, std::{ collections::{HashMap, HashSet}, @@ -76,25 +75,15 @@ impl ShaderInfo { wg_buffer_idx += 1; let size_in_bytes = match binding_ty { naga::TypeInner::Array { - size: ArraySize::Constant(const_handle), + size: ArraySize::Constant(size), stride, .. - } => { - let size: u32 = match module.constants[*const_handle].inner { - ConstantInner::Scalar { value, width: _ } => match value { - ScalarValue::Uint(value) => value.try_into().unwrap(), - ScalarValue::Sint(value) => value.try_into().unwrap(), - _ => continue, - }, - ConstantInner::Composite { .. } => continue, - }; - size * stride - }, + } => u32::from(*size) * stride, naga::TypeInner::Struct { span, .. } => *span, - naga::TypeInner::Scalar { width, ..} => *width as u32, - naga::TypeInner::Vector { width, ..} => *width as u32, - naga::TypeInner::Matrix { width, ..} => *width as u32, - naga::TypeInner::Atomic { width, ..} => *width as u32, + naga::TypeInner::Scalar { width, .. } => *width as u32, + naga::TypeInner::Vector { width, .. } => *width as u32, + naga::TypeInner::Matrix { width, .. } => *width as u32, + naga::TypeInner::Atomic { width, .. } => *width as u32, _ => { // Not a valid workgroup variable type. At least not one that is used // in our shaders. diff --git a/examples/with_winit/src/lib.rs b/examples/with_winit/src/lib.rs index 961c5fca9..62737df34 100644 --- a/examples/with_winit/src/lib.rs +++ b/examples/with_winit/src/lib.rs @@ -131,7 +131,9 @@ fn run( ref event, window_id, } => { - let Some(render_state) = &mut render_state else { return }; + let Some(render_state) = &mut render_state else { + return; + }; if render_state.window.id() != window_id { return; } @@ -307,7 +309,9 @@ fn run( } } Event::RedrawRequested(_) => { - let Some(render_state) = &mut render_state else { return }; + let Some(render_state) = &mut render_state else { + return; + }; let width = render_state.surface.config.width; let height = render_state.surface.config.height; let device_handle = &render_cx.devices[render_state.surface.dev_id]; @@ -436,7 +440,9 @@ fn run( Event::UserEvent(event) => match event { #[cfg(not(any(target_arch = "wasm32", target_os = "android")))] UserEvent::HotReload => { - let Some(render_state) = &mut render_state else { return }; + let Some(render_state) = &mut render_state else { + return; + }; let device_handle = &render_cx.devices[render_state.surface.dev_id]; eprintln!("==============\nReloading shaders"); let start = Instant::now(); diff --git a/shader/coarse.wgsl b/shader/coarse.wgsl index aeb85c20e..e497c85b4 100644 --- a/shader/coarse.wgsl +++ b/shader/coarse.wgsl @@ -155,15 +155,11 @@ fn main( // Exit early if prior stages failed, as we can't run this stage. // We need to check only prior stages, as if this stage has failed in another workgroup, // we still want to know this workgroup's memory requirement. -#ifdef have_uniform if local_id.x == 0u { // Reuse sh_part_count to hold failed flag, shmem is tight sh_part_count[0] = atomicLoad(&bump.failed); } let failed = workgroupUniformLoad(&sh_part_count[0]); -#else - let failed = atomicLoad(&bump.failed); -#endif if (failed & (STAGE_BINNING | STAGE_TILE_ALLOC | STAGE_PATH_COARSE)) != 0u { return; } @@ -223,12 +219,7 @@ fn main( workgroupBarrier(); } sh_part_count[local_id.x] = part_start_ix + count; -#ifdef have_uniform ready_ix = workgroupUniformLoad(&sh_part_count[WG_SIZE - 1u]); -#else - workgroupBarrier(); - ready_ix = sh_part_count[WG_SIZE - 1u]; -#endif partition_ix += WG_SIZE; } // use binary search to find draw object to read diff --git a/shader/tile_alloc.wgsl b/shader/tile_alloc.wgsl index 1f7a4bcc1..a407d6424 100644 --- a/shader/tile_alloc.wgsl +++ b/shader/tile_alloc.wgsl @@ -29,9 +29,7 @@ let WG_SIZE = 256u; var sh_tile_count: array; var sh_tile_offset: u32; -#ifdef have_uniform var sh_atomic_failed: u32; -#endif @compute @workgroup_size(256) fn main( @@ -41,14 +39,10 @@ fn main( // Exit early if prior stages failed, as we can't run this stage. // We need to check only prior stages, as if this stage has failed in another workgroup, // we still want to know this workgroup's memory requirement. -#ifdef have_uniform if local_id.x == 0u { sh_atomic_failed = atomicLoad(&bump.failed); } let failed = workgroupUniformLoad(&sh_atomic_failed); -#else - let failed = atomicLoad(&bump.failed); -#endif if (failed & STAGE_BINNING) != 0u { return; } diff --git a/src/shaders.rs b/src/shaders.rs index 1083374da..02aed8134 100644 --- a/src/shaders.rs +++ b/src/shaders.rs @@ -82,11 +82,6 @@ pub fn full_shaders(device: &Device, engine: &mut Engine) -> Result Result Result) -> Option { - let adapter = wgpu::util::initialize_adapter_from_env_or_default( - &self.instance, - wgpu::Backends::PRIMARY, - compatible_surface, - ) - .await?; + let adapter = + wgpu::util::initialize_adapter_from_env_or_default(&self.instance, compatible_surface) + .await?; let features = adapter.features(); let limits = Limits::default(); let mut maybe_features = wgpu::Features::CLEAR_TEXTURE;