Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upSupport wasm32-unknown-unknown backend? #395
Comments
This comment has been minimized.
This comment has been minimized.
|
Supporting It could be possible to support it by making the user create the glue manually. However if you want a glue, you might as well use emscripten since this is the whole purpose of it. |
This comment has been minimized.
This comment has been minimized.
|
Yeah you're correct there. However I really want to be able to avoid emscripten, since I never manage to get it to work consistently, and if people are making games with ggez then I really want to make life easy for them as well. Requiring them to install emscripten kinda sucks. So what seems like a reasonable path forward here? We more or less have a glue library in the form of |
This comment has been minimized.
This comment has been minimized.
OvermindDL1
commented
Apr 17, 2018
Especially as there are non-webbrowser interpreters for webassembly that don't have a web api at all. |
This comment has been minimized.
This comment has been minimized.
Is that something anyone's working on? If it's the obvious right thing, then it would be good to move towards that. That said, if that's likely to take a long time, it doesn't seem ideal to wait from a strategic perspective. People are excited about WebAssembly right now, and you seem to want to work on winit's support for it right now, so it seems like a good way to make people happy. I imagine there's a way we can handle this that would be reasonably correct, but I truthfully know very little about WebAssembly. It's something that interests me (the bulk of my past experience is in web dev), but I'm too busy with the other backends to be able to provide any insights here yet. |
This comment has been minimized.
This comment has been minimized.
|
Yep. My current tentative plan is to make a prototype web backend for Winit
using stdweb or wasm-bindgen, then use it as an example to show people why
we need a new target.
…On Thu, Apr 26, 2018, 12:14 Francesca Frangipane ***@***.***> wrote:
@icefoxen <https://github.com/icefoxen>
Getting a new wasm32-unknown-webapi OS target into the compiler seems the
obvious right thing
Is that something anyone's working on? If it's the obvious right thing,
then it would be good to move towards that.
That said, if that's likely to take a long time, it doesn't seem ideal to
wait from a strategic perspective. People are excited about WebAssembly
right now, and you seem to want to work on winit's support for it right
now, so it seems like a good way to make people happy.
I imagine there's a way we can handle this that would be reasonably
correct, but I truthfully know very little about WebAssembly. It's
something that interests me (the bulk of my past experience is in web dev),
but I'm too busy with the other backends to be able to provide any insights
here yet.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#395 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABRfXf4NDKWJNUe9GB65YSJvTDnj2XLvks5tsfJkgaJpZM4R3m__>
.
|
This comment has been minimized.
This comment has been minimized.
anderspitman
commented
May 17, 2018
@icefoxen @francesca64 I've been considering working on this exact thing the past couple days when I came across this thread. The focus for the project I need it for is to have enough windowing to handle a WebGL context. @icefoxen have you started working on this? I would love to tag team it if you can use the help. |
This comment has been minimized.
This comment has been minimized.
|
@anderspitman I haven't started working on it yet, apart from writing a prototype WebIDL-to-Rust compiler. fitzgen of the It's just been a really busy couple months. :-( |
This comment has been minimized.
This comment has been minimized.
|
I'd love to help with any work on this, if there is any. |
This comment has been minimized.
This comment has been minimized.
anderspitman
commented
Jun 18, 2018
|
The more I've thought about this, the more I agree with @tomaka that it isn't 100% obvious how this would/should be integrated directly into winit. It's definitely desirable to be able to abstract away the windowing. It's not hard to imagine a world where gfx's OpenGL ES backend can be used with winit to write apps that almost seamlessly compile to desktop and WebGL (and hopefully eventually mobile), similar to what emscripten does. @ryanisaacg I've been really impressed with how you've gotten this to work with quicksilver. Do you have any high-level insights or lessons learned that might help guide the design of doing something similar with winit? I've been getting my feet wet with wasm-bindgen recently, and it's fantastic, but I haven't played with stdweb yet. |
This comment has been minimized.
This comment has been minimized.
|
I actually have now done the wasm bindings twice: once hand-writing each binding in Rust and Javascript, and once with stdweb. The first way involves a lot of custom boilerplate: basically re-implementing emscripten like tomaka wants to avoid. However, actually using emscripten is prohibitively difficult so I still preferred my way. This is fairly similar to the wasm-bindgen experience, as you have to write out the binding for each API you use in Rust. On the other hand, bindgen allows you to skip writing JS as far as I can tell. The stdweb way honestly felt halfway like writing for a real Rust platform. There is no sound API support in stdweb (not an issue for winit obviously) and some functionality required writing some javascript bindings myself. |
This comment has been minimized.
This comment has been minimized.
anderspitman
commented
Jun 21, 2018
|
When you say stdweb felt halfway like writing for a real Rust platform, do you mean that it feels half-baked/hacky, or like it's almost there and with some work it could be a great approach? Or maybe I'm missing your meaning entirely. |
This comment has been minimized.
This comment has been minimized.
anderspitman
commented
Jun 21, 2018
|
It seems to me like a good high-level user story would be getting ggez to compile to WebAssembly with minimal knob-turning. There's already interest in that working eventually. |
This comment has been minimized.
This comment has been minimized.
|
It's like writing for a real Rust platform (albeit a very odd one, being on the web rather than the desktop) but there are definitely holes in the API where you need to write Javascript bridges using the |
This comment has been minimized.
This comment has been minimized.
|
So I've taken a look at the emscripten backend and it seems not-too-difficult to port it to stdweb. First there are one or two features that should be added to stdweb (one I've already done is DPI support); then I should be able to make the port relatively quickly. |
This comment has been minimized.
This comment has been minimized.
beatgammit
commented
Aug 4, 2018
|
Could a simple workaround for now be an environment variable or cargo feature to tell winit to build for web? Idk how long it'll take for a I'd like to start experimenting with WASM ggez and winit, but for now I'll probably play with quicksilver. I may have time to help with a winit WASM uplift if we have a clear direction forward. |
This comment has been minimized.
This comment has been minimized.
|
@beatgammit I did start a WASM port ( #589 ) but we determined it would be best to just wait for the new EventsLoop 2.0 ( #459 ). Also I'm a bit heads-down in getting the next version of Quicksilver out the door, so even if we forged ahead with an EventsLoop 1.0 version, it would probably take me a few weeks to get to it. |
This comment has been minimized.
This comment has been minimized.
beatgammit
commented
Aug 4, 2018
|
Makes sense. I know both I'm trying to help out where I can with |
This comment has been minimized.
This comment has been minimized.
newpavlov
commented
Jan 25, 2019
|
I completely agree that we need |
This comment has been minimized.
This comment has been minimized.
|
stdweb PR has been opened by @ryanisaacg: #797 |
This comment has been minimized.
This comment has been minimized.
spennydl
commented
Apr 21, 2019
|
I'd be keen on building out a |
This comment has been minimized.
This comment has been minimized.
|
Go for it, @spennydl ! |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
spennydl
commented
Apr 23, 2019
|
#845 - wasm-bindgen pr is open |
icefoxen commentedFeb 2, 2018
Would it be possible/reasonable/desired to support a wasm32-unknown-unknown backend without needing to use emscripten? I'm a little inspired by this crate: https://github.com/ryanisaacg/quicksilver which does it by providing a Javascript interface and it seems to work okay, though I don't know what invariants winit needs to provide that wasm32-unknown-unknown might make hard (mainloop callback, presence of threads, etc).