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
# Conflicts:
#	CHANGELOG.md
This commit is contained in:
Andreas Reich 2025-01-18 21:05:57 +01:00 committed by Connor Fitzgerald
parent fb3cb547fd
commit 0fcae47274
No known key found for this signature in database
GPG Key ID: 7D3FA445BAD3008D
4 changed files with 17 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

@ -40,6 +40,13 @@ Bottom level categories:
## Unreleased
### v24.0.1 (2025-01-22)
#### Bug Fixes
* 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).
* Implement `Clone` on `ShaderModule`. By @a1phyr in [#6937](https://github.com/gfx-rs/wgpu/pull/6937).
## v24.0.0 (2025-01-15)
### Major changes

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))]
//
//