Skip to content

Commit

Permalink
Fix building wgpu with --no-default-feautures on web (`wasm32-unk…
Browse files Browse the repository at this point in the history
…nown-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
  • Loading branch information
Wumpf authored Jan 18, 2025
1 parent dcdb103 commit e2d14c6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 6 additions & 0 deletions wgpu/src/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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."),
}
}
}
Expand Down Expand Up @@ -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."),
}
}
}
Expand All @@ -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."),
}
}
}
Expand Down
1 change: 1 addition & 0 deletions wgpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]

//
//
Expand Down

0 comments on commit e2d14c6

Please sign in to comment.