-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
std::time::Instant not supported by WebAssembly #1022
Comments
The same crate is already used by winit In other words, this does not really add a dependency as this is already being pulled in by winit itself as a non-optional dependency. |
Thanks for the PR! I have never tried |
I'm using wgpu for rendering, Unfortunately, my project requires compute shaders, so it won't work with wgpu's WebGL 2 backend and requires real WebGPU support by the browser. Note that due to some recent changes in WGSL, the application partially works in the latest Firefox Nightly right now but not in Chrome Canary. Hopefully, it will fully work again in a month or two when the browsers are updated. But on latest Firefox Nightly, you should see egui working using the commits from the pull request and the demo link below.
|
egui itself is rendered by https://github.com/hasenbanck/egui_wgpu_backend which I used in combination with https://github.com/hasenbanck/egui_winit_platform before but now migrated to egui-winit. |
Very cool, thanks for sharing! There seems to be some problems with input though, e.g. holding down modifiers and moving the cursor in the text edit field doesn't work as expected. Perhaps a limitation of running winit on the web? |
Hm which modifiers and OS? I can hold down alt, ctrl or shift on Windows and move the cursor using arrow keys just fine. Note that leaving the text field (losing focus) currently freezes the application because of said shader that uses the new |
I'm running firefox nightly on my macbook, and holding down alt,shift or cmd and pressing the arrow keys still only moves the cursor by a single character. Holding down |
Ah I misread the "doesn't work as expected" as just "doesn't work". :) Yeah I can reproduce that. 🤔 |
The
std::time::Instant
type used in the egui-winit crate is not supported when running through WebAssembly:WebAssembly could potentially be supported in egui-winit by using a crate such as https://github.com/sebcrozet/instant instead, which only re-exports the
std::time::Instant
type on native but implements a polyfill for WebAssembly targets.The text was updated successfully, but these errors were encountered: