Fix building wgpu with --no-default-feautures on web (wasm32-unknown-unknown) (#6946)

* Fix wasm build without features

* silence unused warnings if wgc & webgpu are disabled

* add no-features check for web ci

* add changelog entry
This commit is contained in:
Andreas Reich 2025-01-18 21:05:57 +01:00 committed by GitHub
parent dcdb10348b
commit e2d14c677a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 0 deletions

View File

@ -254,6 +254,9 @@ jobs:
cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} --tests --features glsl,spirv
cargo doc --target ${{ matrix.target }} ${{ matrix.extra-flags }} --no-deps --features glsl,spirv
# check with no features
cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} --no-default-features
# all features
cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} --tests --all-features
cargo doc --target ${{ matrix.target }} ${{ matrix.extra-flags }} --no-deps --all-features

View File

@ -63,6 +63,7 @@ By @brodycj in [#6925](https://github.com/gfx-rs/wgpu/pull/6925).
### Bug Fixes
* Avoid overflow in query set bounds check validation. By @ErichDonGubler in [#????].
* Fix `wgpu` not building with `--no-default-features` on when targeting `wasm32-unknown-unknown`. By @wumpf in [#6946](https://github.com/gfx-rs/wgpu/pull/6946).
## v24.0.0 (2025-01-15)

View File

@ -636,6 +636,8 @@ macro_rules! dispatch_types_inner {
Self::Core(value) => value.as_ref(),
#[cfg(webgpu)]
Self::WebGPU(value) => value.as_ref(),
#[cfg(not(any(wgpu_core, webgpu)))]
_ => panic!("No context available. You need to enable one of wgpu's backend feature build flags."),
}
}
}
@ -765,6 +767,8 @@ macro_rules! dispatch_types_inner {
Self::Core(value) => value,
#[cfg(webgpu)]
Self::WebGPU(value) => value,
#[cfg(not(any(wgpu_core, webgpu)))]
_ => panic!("No context available. You need to enable one of wgpu's backend feature build flags."),
}
}
}
@ -777,6 +781,8 @@ macro_rules! dispatch_types_inner {
Self::Core(value) => value,
#[cfg(webgpu)]
Self::WebGPU(value) => value,
#[cfg(not(any(wgpu_core, webgpu)))]
_ => panic!("No context available. You need to enable one of wgpu's backend feature build flags."),
}
}
}

View File

@ -23,6 +23,7 @@
unsafe_op_in_unsafe_fn
)]
#![allow(clippy::arc_with_non_send_sync)]
#![cfg_attr(not(any(wgpu_core, webgpu)), allow(unused))]
//
//