-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve WebGPU unstable flags docs #10163
Conversation
@@ -539,10 +539,18 @@ ruby -run -ehttpd examples/wasm | |||
|
|||
#### WebGL2 and WebGPU | |||
|
|||
Bevy support for WebGPU is being worked on, but is currently experimental. | |||
Bevy ships with WebGPU by default, but it is being worked on and 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if this statement is still true... Wouldn't WebGPU be enabled by default if one does not define any features and roll with bevy defaults? I can verify this sometime this week but if someone knows... Please leave a comment!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still true. The webgl2
feature is included in our default features.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, thanks for the heads up. I re-reviewed the default feature list and now I understand. I'll adjust the language I've introduced in the previous paragraph accordingly.
The generated |
I realized I shouldn't update the |
Yep! Also, |
Thanks for clarifying! I'll make the changes tomorrow. Any suggestions to improve the language in the meantime will be welcomed. |
docs/cargo_features.md
Outdated
@@ -34,7 +34,7 @@ The default feature set enables most of the expected features of a game engine, | |||
|png|PNG image format support| | |||
|tonemapping_luts|Include tonemapping Look Up Tables KTX2 files| | |||
|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|Given the fact that WebGPU support in Bevy is experimental, this feature will enable some limitations to be able to use WebGL2. If not enabled, it will default to WebGPU in Wasm. Keep in mind that that WebGPU depends on unstable APIs so you will also need to pass the `web_sys_unstable_apis` flag to your builds (e.g. `RUSTFLAGS=--cfg=web_sys_unstable_apis cargo run ...`). Check `wasm-bindgen` [docs on Unstable APIs](https://rustwasm.github.io/wasm-bindgen/web-sys/unstable-apis.html) for more details.| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like a lot for this feature table. Maybe we could just link off to the WebGL2 and WebGPU
in the examples readme?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once @rparrett concerns are fixed, I think it can be merged.
You added a new feature but didn't update the readme. Please run |
Weird, since I didn't change the features this time 😆 |
Cargo.toml
Outdated
@@ -241,7 +241,7 @@ shader_format_glsl = ["bevy_internal/shader_format_glsl"] | |||
# Enable support for shaders in SPIR-V | |||
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](../examples/README.md) section of the examples README for more information on how to run Wasm builds with WebGPU. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doc is published here: https://docs.rs/bevy/latest/bevy/#default-features
how does that link works from docs.rs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I didn't know this. Would linking to the file on the latest
branch work better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, yeah. what about linking straight to to https://github.com/bevyengine/bevy/tree/latest/examples#webgl2-and-webgpu? edit: sorry, couple minutes late to the party.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No prob. And how did I miss adding the reference to the heading? 🤦🏻 My bad! I'll fix both suggestions in a moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 11a1caa
docs-template/EXAMPLE_README.md.tpl
Outdated
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 run ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RUSTFLAGS=--cfg=web_sys_unstable_apis cargo run ... | |
RUSTFLAGS=--cfg=web_sys_unstable_apis cargo build ... |
cargo run
doesn't work without extra config for wasm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in 2f1d566
# Objective - Fixes bevyengine#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.
# Objective - Fixes bevyengine#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.
Objective
--cfg=web_sys_unstable_apis
in WebGPU build instructions #9382Solution
cargo_features.md
and the examplesREADME.md
files.