Update wgpu to v0.19.3 and unpin web-sys. (#12247)

This PR unpins `web-sys` so that unrelated projects that have
`bevy_render` in their workspace can finally update their `web-sys`.
More details in and fixes #12246.

* Update `wgpu` from 0.19.1 to 0.19.3.
* Remove the `web-sys` pin.
* Update docs and wasm helper to remove the now-stale
`--cfg=web_sys_unstable_apis` Rust flag.

---

Updated `wgpu` to v0.19.3 and removed `web-sys` pin.
This commit is contained in:
Kaur Kuut 2024-03-02 02:44:51 +02:00 committed by François
parent 7caa026806
commit f4df8b8545
7 changed files with 5 additions and 26 deletions

View file

@ -142,8 +142,6 @@ jobs:
target: wasm32-unknown-unknown
- name: Check wasm
run: cargo check --target wasm32-unknown-unknown
env:
RUSTFLAGS: --cfg=web_sys_unstable_apis
markdownlint:
runs-on: ubuntu-latest

View file

@ -289,7 +289,7 @@ pbr_transmission_textures = ["bevy_internal/pbr_transmission_textures"]
# Enable some limitations to be able to use WebGL2. Please refer to the [WebGL2 and WebGPU](https://github.com/bevyengine/bevy/tree/latest/examples#webgl2-and-webgpu) section of the examples README for more information on how to run Wasm builds with WebGPU.
webgl2 = ["bevy_internal/webgl"]
# Enable support for WebGPU in Wasm. When enabled, this feature will override the `webgl2` feature and you won't be able to run Wasm builds with WebGL2, only with WebGPU. Requires the `RUSTFLAGS` environment variable to be set to `--cfg=web_sys_unstable_apis` when building.
# Enable support for WebGPU in Wasm. When enabled, this feature will override the `webgl2` feature and you won't be able to run Wasm builds with WebGL2, only with WebGPU.
webgpu = ["bevy_internal/webgpu"]
# Enables the built-in asset processor for processed assets.

View file

@ -64,7 +64,7 @@ image = { version = "0.24", default-features = false }
codespan-reporting = "0.11.0"
# `fragile-send-sync-non-atomic-wasm` feature means we can't use WASM threads for rendering
# It is enabled for now to avoid having to do a significant overhaul of the renderer just for wasm
wgpu = { version = "0.19.1", default-features = false, features = [
wgpu = { version = "0.19.3", default-features = false, features = [
"wgsl",
"dx12",
"metal",
@ -105,9 +105,7 @@ naga_oil = { version = "0.13", default-features = false, features = [
[target.'cfg(target_arch = "wasm32")'.dependencies]
naga_oil = "0.13"
js-sys = "0.3"
# web-sys doesn't follow semver for the WebGPU APIs as they are unstable
# Make sure that WebGPU builds work when changing this!
web-sys = { version = "=0.3.67", features = [
web-sys = { version = "0.3.67", features = [
'Blob',
'Document',
'Element',

View file

@ -239,13 +239,6 @@ ruby -run -ehttpd examples/wasm
Bevy support for WebGPU is being worked on, but is currently experimental.
To build for WebGPU, you'll need to enable the `webgpu` feature. This will override the `webgl2` feature, and builds with the `webgpu` feature enabled won't be able to run on browsers that don't support WebGPU.
WebGPU depends on unstable APIs so you will also need to pass the `web_sys_unstable_apis` flag to your builds. For example:
```sh
RUSTFLAGS=--cfg=web_sys_unstable_apis cargo build ...
```
Check `wasm-bindgen` [docs on Unstable APIs](https://rustwasm.github.io/wasm-bindgen/web-sys/unstable-apis.html) for more details.
Bevy has an helper to build its examples:

View file

@ -81,7 +81,7 @@ The default feature set enables most of the expected features of a game engine,
|trace_tracy_memory|Tracing support, with memory profiling, exposing a port for Tracy|
|wav|WAV audio format support|
|wayland|Wayland display server support|
|webgpu|Enable support for WebGPU in Wasm. When enabled, this feature will override the `webgl2` feature and you won't be able to run Wasm builds with WebGL2, only with WebGPU. Requires the `RUSTFLAGS` environment variable to be set to `--cfg=web_sys_unstable_apis` when building.|
|webgpu|Enable support for WebGPU in Wasm. When enabled, this feature will override the `webgl2` feature and you won't be able to run Wasm builds with WebGL2, only with WebGPU.|
|webp|WebP image format support|
|wgpu_trace|Save a trace of all wgpu calls|
|zlib|For KTX2 supercompression|

View file

@ -576,13 +576,6 @@ ruby -run -ehttpd examples/wasm
Bevy support for WebGPU is being worked on, but is currently experimental.
To build for WebGPU, you'll need to enable the `webgpu` feature. This will override the `webgl2` feature, and builds with the `webgpu` feature enabled won't be able to run on browsers that don't support WebGPU.
WebGPU depends on unstable APIs so you will also need to pass the `web_sys_unstable_apis` flag to your builds. For example:
```sh
RUSTFLAGS=--cfg=web_sys_unstable_apis cargo build ...
```
Check `wasm-bindgen` [docs on Unstable APIs](https://rustwasm.github.io/wasm-bindgen/web-sys/unstable-apis.html) for more details.
Bevy has an helper to build its examples:

View file

@ -71,13 +71,10 @@ fn main() {
parameters.push("--features");
parameters.push(&features_string);
}
let mut cmd = cmd!(
let cmd = cmd!(
sh,
"cargo build {parameters...} --profile release --target wasm32-unknown-unknown --example {example}"
);
if matches!(cli.api, WebApi::Webgpu) {
cmd = cmd.env("RUSTFLAGS", "--cfg=web_sys_unstable_apis");
}
cmd.run().expect("Error building example");
cmd!(