diff --git a/CHANGELOG.md b/CHANGELOG.md index 170c33b4e4..53e5bd45d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,11 @@ This release has an [MSRV][] of 1.86. - `push_luminance_mask_layer`, content within which is used as a luminance mask. ([#1183][] by [@DJMcNab][]). This is a breaking change to Vello Encoding. +## Changed + +- Breaking: Put `wgpu`'s default features behind a `wgpu_default` feature flag. ([#1229][] by [@StT191][]) + If you're using Vello with default features enabled, then no change is needed. + ## Fixed - Examples crashing when window is resized to zero. ([#1182][] by [@xStrom][]) @@ -44,7 +49,7 @@ This release has an [MSRV][] of 1.85. - Implement `Default` for `RendererOptions`. ([#524][] by [@DJMcNab][]) ```diff - RendererOptions { + RendererOptions { // ... + ..Default::default() } @@ -233,6 +238,7 @@ This release has an [MSRV][] of 1.75. [@ratmice]: https://github.com/ratmice [@simbleau]: https://github.com/simbleau [@songhuaixu]: https://github.com/songhuaixu +[@StT191]: https://github.com/StT191 [@TheNachoBIT]: https://github.com/TheNachoBIT [@timtom-dev]: https://github.com/timtom-dev [@tomcur]: https://github.com/tomcur @@ -320,6 +326,7 @@ This release has an [MSRV][] of 1.75. [#1182]: https://github.com/linebender/vello/pull/1182 [#1183]: https://github.com/linebender/vello/pull/1183 [#1187]: https://github.com/linebender/vello/pull/1187 +[#1229]: https://github.com/linebender/vello/pull/1229 [Unreleased]: https://github.com/linebender/vello/compare/v0.5.0...HEAD diff --git a/Cargo.toml b/Cargo.toml index c2d0bc3be6..60f9fd1e4f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -127,7 +127,7 @@ vello_hybrid_scenes = { path = "sparse_strips/vello_hybrid/examples/scenes" } vello_dev_macros = { path = "sparse_strips/vello_dev_macros" } # NOTE: Make sure to keep this in sync with the version badge in README.md and vello/README.md -wgpu = { version = "26.0.1" } +wgpu = { version = "26.0.1", default-features = false, features = ["std", "wgsl"] } log = "0.4.27" image = { version = "0.25.6", default-features = false } diff --git a/sparse_strips/vello_cpu/examples/wasm_cpu/Cargo.toml b/sparse_strips/vello_cpu/examples/wasm_cpu/Cargo.toml index 7b368173e7..14561773ec 100644 --- a/sparse_strips/vello_cpu/examples/wasm_cpu/Cargo.toml +++ b/sparse_strips/vello_cpu/examples/wasm_cpu/Cargo.toml @@ -35,7 +35,7 @@ web-sys = { version = "0.3.77", features = [ "KeyboardEvent", "CanvasRenderingContext2d", ] } -wgpu = { workspace = true, features = ["webgl"] } +wgpu = { workspace = true, features = ["webgl"], default-features = true } [target.'cfg(target_arch = "wasm32")'.dependencies] parley = { version = "0.5.0", default-features = false, features = ["std"] } diff --git a/sparse_strips/vello_hybrid/Cargo.toml b/sparse_strips/vello_hybrid/Cargo.toml index 6ae3aaf16e..8ccf8d1472 100644 --- a/sparse_strips/vello_hybrid/Cargo.toml +++ b/sparse_strips/vello_hybrid/Cargo.toml @@ -18,7 +18,7 @@ workspace = true bytemuck = { workspace = true, features = ["derive"] } thiserror = { workspace = true } vello_common = { workspace = true, features = ["std", "text"] } -wgpu = { workspace = true, optional = true } +wgpu = { workspace = true, default-features = false, optional = true } vello_sparse_shaders = { workspace = true, optional = true } log = { workspace = true } guillotiere = "0.6.2" @@ -51,7 +51,11 @@ vello_common = { workspace = true, features = ["pico_svg"] } roxmltree = "0.20.0" [features] -default = ["wgpu"] +default = ["wgpu", "wgpu_default"] std = ["wgpu", "vello_common/std"] wgpu = ["dep:wgpu", "dep:vello_sparse_shaders"] +# Enable wgpu with its default features. If you need to customise the set of enabled wgpu features, +# please disable this crate's default features, enable its "wgpu" feature, then depend on wgpu directly +# with the features which you need enabled. +wgpu_default = ["wgpu", "wgpu/default"] webgl = ["dep:js-sys", "dep:web-sys", "dep:vello_sparse_shaders", "vello_sparse_shaders/glsl"] diff --git a/sparse_strips/vello_hybrid/examples/wgpu_webgl/Cargo.toml b/sparse_strips/vello_hybrid/examples/wgpu_webgl/Cargo.toml index 7665162463..9ef3a62c50 100644 --- a/sparse_strips/vello_hybrid/examples/wgpu_webgl/Cargo.toml +++ b/sparse_strips/vello_hybrid/examples/wgpu_webgl/Cargo.toml @@ -35,7 +35,7 @@ web-sys = { version = "0.3.77", features = [ "WheelEvent", "KeyboardEvent", ] } -wgpu = { workspace = true, features = ["webgl"] } +wgpu = { workspace = true, default-features = true, features = ["webgl"] } [dev-dependencies] wasm-bindgen-test = "0.3.50" diff --git a/sparse_strips/vello_hybrid/examples/winit/Cargo.toml b/sparse_strips/vello_hybrid/examples/winit/Cargo.toml index 824b48ac7a..c1f83900f1 100644 --- a/sparse_strips/vello_hybrid/examples/winit/Cargo.toml +++ b/sparse_strips/vello_hybrid/examples/winit/Cargo.toml @@ -11,7 +11,7 @@ workspace = true [dependencies] winit = { workspace = true } -wgpu = { workspace = true } +wgpu = { workspace = true, default-features = true } vello_common = { workspace = true } vello_hybrid = { workspace = true } vello_hybrid_scenes = { workspace = true } diff --git a/sparse_strips/vello_sparse_tests/Cargo.toml b/sparse_strips/vello_sparse_tests/Cargo.toml index 6dc66d2711..012ad601fb 100644 --- a/sparse_strips/vello_sparse_tests/Cargo.toml +++ b/sparse_strips/vello_sparse_tests/Cargo.toml @@ -19,7 +19,7 @@ vello_api = { workspace = true } vello_common = { workspace = true, features = ["std"] } vello_cpu = { workspace = true, features = ["multithreading", "std"] } vello_hybrid = { workspace = true } -wgpu = { workspace = true } +wgpu = { workspace = true, default-features = true } pollster = { workspace = true } vello_dev_macros = { workspace = true } bytemuck = { workspace = true } diff --git a/vello/Cargo.toml b/vello/Cargo.toml index 2c506b895b..ae024ce518 100644 --- a/vello/Cargo.toml +++ b/vello/Cargo.toml @@ -16,13 +16,17 @@ default-target = "x86_64-unknown-linux-gnu" targets = [] [features] -default = ["wgpu"] +default = ["wgpu", "wgpu_default"] # Enables GPU memory usage estimation. This performs additional computations # in order to estimate the minimum required allocations for buffers backing # bump-allocated GPU memory. # TODO: Turn this into a runtime option used at resolve time and remove the feature. bump_estimate = ["vello_encoding/bump_estimate"] wgpu = ["dep:wgpu", "dep:vello_shaders", "dep:futures-intrusive"] +# Enable wgpu with its default features. If you need to customise the set of enabled wgpu features, +# please disable this crate's default features, enable its "wgpu" feature, then depend on wgpu directly +# with the features which you need enabled. +wgpu_default = ["wgpu", "wgpu/default"] # Development only features @@ -46,7 +50,7 @@ vello_shaders = { workspace = true, optional = true } bytemuck = { workspace = true } skrifa = { workspace = true, features = ["std"] } peniko = { workspace = true, default-features = true } -wgpu = { workspace = true, optional = true } +wgpu = { workspace = true, default-features = false, optional = true } log = { workspace = true } static_assertions = { workspace = true } futures-intrusive = { workspace = true, optional = true } diff --git a/vello/src/wgpu_engine.rs b/vello/src/wgpu_engine.rs index 0d74c91835..9d134d65b2 100644 --- a/vello/src/wgpu_engine.rs +++ b/vello/src/wgpu_engine.rs @@ -767,10 +767,8 @@ impl WgpuEngine { } } for id in free_images { - if let Some((texture, view)) = self.bind_map.image_map.remove(&id) { + if let Some((_texture, _view)) = self.bind_map.image_map.remove(&id) { // TODO: have a pool to avoid needless re-allocation - drop(texture); - drop(view); } } Ok(())