changed websys features in core and hal to align with used features #2922
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist
cargo clippy
.RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown
if applicable.Connections
addresses #2894
Description
if using wgpu-core or wgpu-hal as a dependency with target
wasm32-unknown-unknown
without specifying the web-sys feature:OffscreenCanvas
in the dependencies, both wgpu-core and wgpu-hal would fail to compile (wgpu-hal only when using the gles feature which is effectively implied by the target). The trivial fix to this is addingOffscreenCanvas
to the web-sys features in wgpu-hal, as wgpu-core also depends on it whenever needing to use web-sys, however, for semantics sake, the feature is in use in wgpu-core as well, so has been added, however behind a more restrictive target as that's the only time web-sys is in use.Testing
inside wgpu/wgpu-core:
cargo build --target wasm32-unknown-unknown
cargo build --target wasm32-unknown-emscripten
inside wgpu/wgpu-hal
cargo build --target wasm32-unknown-unknown --features gles
cargo build --target wasm32-unknown-emscripten --features emscripten
all builds succeed, whereas previously the wasm32-unknown-unknown target builds would fail