Platforms: Readd support for WebGL2#26
Conversation
IVec2Uniform and UVec2Uniform are a simple wrappers for IVec2/UVec2 that ensure 16-byte alignment for use in uniform buffers. This is required for WebGL2
This comment was marked as resolved.
This comment was marked as resolved.
|
The stress_test not working as far as I can tell is because of issues in FpsOverlayPlugin. These have been resolved here: bevyengine/bevy#21885 When using https://github.com/leomeinel/bevy_lit/tree/bevy-0-18-webgl which uses Bevy 0.18 it is working on WebGL2: |
|
Hey, thanks for pulling this off. And sorry for not taking a look at it sooner (life 🤷♂️). I'll be reviewing this soon. |
Perfect, I'll be fixing conflicts in a few days. I'm currently busy with something else. If you want to however you can also just do this on your own :) I'm happy that you found the time to take a look at it. 👍 |
|
All examples are working and have been tested on
UpdateThis is ready to be merged. All examples including |
|
From a first glance this is looking good. Can you share your setup for testing the webgl2 target? |
Repo changesℹ️ This is needed to run the examples because wasm needs a custom runner and because of diff --git a/.cargo/config.toml b/.cargo/config.toml
new file mode 100644
index 0000000..bc39f05
--- /dev/null
+++ b/.cargo/config.toml
@@ -0,0 +1,2 @@
+[target.'cfg(all(target_family = "wasm", any(target_os = "unknown", target_os = "none")))']
+runner = "wasm-server-runner"
diff --git a/Cargo.toml b/Cargo.toml
index a5c09c2..352fc4f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -27,6 +27,9 @@ indexmap = "2"
bevy = { version = "0.19.0", features = ["bevy_dev_tools"] }
rand = { version = "0.10.1" }
+[target.'cfg(all(target_family = "wasm", any(target_os = "unknown", target_os = "none")))'.dev-dependencies]
+getrandom = { version = "0.4", features = ["wasm_js"] }
+
[profile.dev]
opt-level = 1Testing environment
One also has to install Running the exampleTo run any example one can now just do: cargo run --target wasm32-unknown-unknown --example texture_lightThis should create a local http server listening on http://127.0.0.1:1334/. The ip and port will also be printed after executing |

Purpose
This readds support for WebGL2 that has been removed in 124607d
Tested platforms
All examples have been tested and are working flawlessly on the following targets:
x86_64-unknown-linux-gnuwasm32-unknown-unknown(See: Platforms: Readd support for WebGL2 #26 (comment))Bevy 0.18
I also have https://github.com/leomeinel/bevy_lit/tree/bevy-0-18-webgl which includes changes from #23 but I wanted this to not depend on it.