Improve WebGPU unstable flags docs (#10163)

# Objective

- Fixes #9382

## Solution

- Added a few extra notes in regards to WebGPU experimental state and
the need of enabling unstable APIs through certain attribute flags in
`cargo_features.md` and the examples `README.md` files.
This commit is contained in:
Martín Maita 2023-10-18 14:30:44 -03:00 committed by GitHub
parent d857cd6575
commit 0dc7e60d0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 2 deletions

View file

@ -241,7 +241,7 @@ shader_format_glsl = ["bevy_internal/shader_format_glsl"]
# Enable support for shaders in SPIR-V # Enable support for shaders in SPIR-V
shader_format_spirv = ["bevy_internal/shader_format_spirv"] shader_format_spirv = ["bevy_internal/shader_format_spirv"]
# Enable some limitations to be able to use WebGL2. If not enabled, it will default to WebGPU in Wasm # Enable some limitations to be able to use WebGL2. If not enabled, it will default to WebGPU in Wasm. 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"] webgl2 = ["bevy_internal/webgl"]
# Enables watching the filesystem for Bevy Asset hot-reloading # Enables watching the filesystem for Bevy Asset hot-reloading

View file

@ -240,6 +240,14 @@ Bevy support for WebGPU is being worked on, but is currently experimental.
To build for WebGPU, you'll need to disable default features and add all those you need, making sure to omit the `webgl2` feature. To build for WebGPU, you'll need to disable default features and add all those you need, making sure to omit the `webgl2` feature.
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: Bevy has an helper to build its examples:
- Build for WebGL2: `cargo run -p build-wasm-example -- --api webgl2 load_gltf` - Build for WebGL2: `cargo run -p build-wasm-example -- --api webgl2 load_gltf`

View file

@ -34,7 +34,7 @@ The default feature set enables most of the expected features of a game engine,
|png|PNG image format support| |png|PNG image format support|
|tonemapping_luts|Include tonemapping Look Up Tables KTX2 files| |tonemapping_luts|Include tonemapping Look Up Tables KTX2 files|
|vorbis|OGG/VORBIS audio format support| |vorbis|OGG/VORBIS audio format support|
|webgl2|Enable some limitations to be able to use WebGL2. If not enabled, it will default to WebGPU in Wasm| |webgl2|Enable some limitations to be able to use WebGL2. If not enabled, it will default to WebGPU in Wasm. 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.|
|x11|X11 display server support| |x11|X11 display server support|
|zstd|For KTX2 supercompression| |zstd|For KTX2 supercompression|

View file

@ -544,6 +544,14 @@ Bevy support for WebGPU is being worked on, but is currently experimental.
To build for WebGPU, you'll need to disable default features and add all those you need, making sure to omit the `webgl2` feature. To build for WebGPU, you'll need to disable default features and add all those you need, making sure to omit the `webgl2` feature.
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: Bevy has an helper to build its examples:
- Build for WebGL2: `cargo run -p build-wasm-example -- --api webgl2 load_gltf` - Build for WebGL2: `cargo run -p build-wasm-example -- --api webgl2 load_gltf`