-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Implement WASM support for bevy_winit #503
Conversation
Also, replaced wasm_timer::Instant with instant::Instant as it is used by winit WASM implementation.
Mmmm I love waking up to more wasm support :) |
Do you actually need cfg macros for |
I thought a bit about this before approving. Instant is actually just a type alias for std::Instant on native platforms. But not using the |
Also, replaced wasm_timer::Instant with instant::Instant as it is used by winit WASM implementation.
…n wasm. (#5863) # Objective #503 added these. I don't know what problem it solved, the PR doesn't say and the code didn't make it obvious to me. ## Solution AFAIK removing unsafe `Send`/`Sync` impls can't introduce unsoundness. Yeet. ## Migration Guide Why tho. Co-authored-by: devil-ira <[email protected]>
…n wasm. (bevyengine#5863) # Objective bevyengine#503 added these. I don't know what problem it solved, the PR doesn't say and the code didn't make it obvious to me. ## Solution AFAIK removing unsafe `Send`/`Sync` impls can't introduce unsoundness. Yeet. ## Migration Guide Why tho. Co-authored-by: devil-ira <[email protected]>
…n wasm. (bevyengine#5863) # Objective bevyengine#503 added these. I don't know what problem it solved, the PR doesn't say and the code didn't make it obvious to me. ## Solution AFAIK removing unsafe `Send`/`Sync` impls can't introduce unsoundness. Yeet. ## Migration Guide Why tho. Co-authored-by: devil-ira <[email protected]>
…n wasm. (#5863) # Objective bevyengine/bevy#503 added these. I don't know what problem it solved, the PR doesn't say and the code didn't make it obvious to me. ## Solution AFAIK removing unsafe `Send`/`Sync` impls can't introduce unsoundness. Yeet. ## Migration Guide Why tho. Co-authored-by: devil-ira <[email protected]>
This modifies the rest of default plugins to build for
wasm32
and twistsbevy_winit
to run.The main problem is that winit Window is not Send + Sync, but since our WASM runtime is single threaded,
we can safely fake it.
Also, replaced wasm_timer::Instant with instant::Instant as it is used by winit WASM implementation, so the code won't duplicate.
To build the example use:
and modify
index.html
to run it.