Skip to content
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

wasm? #657

Open
AJTJ opened this issue Oct 1, 2020 · 25 comments
Open

wasm? #657

AJTJ opened this issue Oct 1, 2020 · 25 comments

Comments

@AJTJ
Copy link

AJTJ commented Oct 1, 2020

It seems like wgpu is running in the browser as per: gfx-rs/wgpu-rs#193 , does nannou allow you to run its sketches/apps in the browser yet?

@mitchmindtree
Copy link
Member

It should be very close now, I don't think there should be any more major blockers! Just a matter of someone taking the time to have a crack at it. There will likely be a few small unforeseen tweaks or changes that we or our dependencies need to make to be totally compatible, but no deal-breakers that I can think of now that wgpu is running in the browser.

Also discussed in #475

@AJTJ
Copy link
Author

AJTJ commented Oct 4, 2020

That's promising to hear, so who do we need to poke to get this happening?

@Woyten
Copy link
Contributor

Woyten commented Oct 6, 2020

I think the conrod suite 0.71 is required. They closed PistonDevelopers/conrod#1381 recently, so if we asked them kindly, they might release version 0.71.

@AJTJ
Copy link
Author

AJTJ commented Oct 14, 2020

@Woyten I'm relatively new to rust/nannou, but let me know if there's something I can help with in this regard. I'm in the process of getting into some creative projects and would like to be able to present some interactive WASM projects with nannou on my portfolio website.

@Woyten
Copy link
Contributor

Woyten commented Oct 20, 2020

@AJTJ I am working on a microtonal modular synthesizer/sequencer/audio workstation which I hope to be able to deploy as a web app soon. Since, as of now, Nannou isn't wasm-compatible the graphical interface of the synthesizer isn't running on the web yet. I managed, however, to get the audio model running which can be explored here: http://woyten.github.io/microwave/?arg=steps&arg=1:22:2. The given URL will create a synthesizer instance tuned to 22 notes per octave as an example.

There are a lot of things that can be done to support https://github.com/woyten/tune many of which I did not create an issue for. If there is some interest in contributing to the lib or the synth I will create more issues as an orientation.

@AJTJ
Copy link
Author

AJTJ commented Oct 22, 2020

@Woyten very cool project. I would be interested in helping a bit here and there if you clarified some issues. Any future goals for this project? Product? Copyleft?

@AJTJ
Copy link
Author

AJTJ commented Oct 23, 2020

@mitchmindtree is there something I can do to help wasm move forwards? If you could point me at some achievable issues I'd love to help out.

@mitchmindtree
Copy link
Member

Here are some thoughts on how I would go about getting this working.

I'd start by trying to get a simple-as-possible wgpu-rs example that has already been demonstrated to work well in the browser locally, to verify that it's at least possible on my setup. Keep in mind that the current nannou master uses wgpu 0.5, so it might be worth testing the wgpu example with 0.5 too. Alternatively, if it seems like wgpu 0.6 is needed, #655 looks to be most of the way there (haven't had a chance to do a full review just yet).

Once working, I would try to make a copy of the example, and add nannou as a dependency. Doing this should include nannou in the build process for the WASM target, and any remaining issues should be raised by the compiler as an error. There shouldn't be any major blockers, but this will help to guide towards what remains that needs addressing.

The wgpu-users channel on Matrix is also full of very helpful folks - I highly recommend hanging out there while hacking on this :) They've been a great help in landing wgpu in nannou in general.

I hope some of this helps a little bit!

@Woyten
Copy link
Contributor

Woyten commented Oct 24, 2020

@AJTJ I ceated some new issues that I think might be good for "beginners".

In order to not misuse this issue we could continue the discussion here! 😃

@AJTJ
Copy link
Author

AJTJ commented Oct 29, 2020

@mitchmindtree will look into this

@AJTJ
Copy link
Author

AJTJ commented Oct 29, 2020

@mitchmindtree so it seems like this issue is rather deep

Trying to get the wgpu examples running is proving challenging.

Here are the examples: https://wgpu.rs/examples/?example=hello-triangle

I've only attempted to get it working with Firefox Nightly, setting the various flags as required here: https://github.com/gpuweb/gpuweb/wiki/Implementation-Status#firefox

But it seems to only want to crash.

Here are similar bug reports of this issue with Firefox:

https://bugzilla.mozilla.org/buglist.cgi?product=Core&component=Graphics%3A%20WebGPU

This is where this is at currently.

@mitchmindtree
Copy link
Member

Thanks for digging into this @AJTJ! Ahh I thought WebGPU in browsers might have progressed a bit further by now, but I guess it's still early days. Perhaps we can at least prepare using firefox nightly best we can in the meantime.

@AJTJ
Copy link
Author

AJTJ commented Mar 19, 2021

@mitchmindtree I saw that you merged this 20 days ago
1ff5726

Does this move us forwards somehow?

Hope all is well.

@Woyten
Copy link
Contributor

Woyten commented Mar 20, 2021

@AJTJ Upgrading to wgpu-0.6 is not sufficient. See my comment.

We need at least wgpu-0.7.0 and some new not yet published conrod_wgpu Version that depends on wgpu-0.7.0.

A step towards making nannou compile against wasm is #715.

@yutannihilation
Copy link
Contributor

some new not yet published conrod_wgpu Version that depends on wgpu-0.7.0.

I'll try to update it here, though I'm stuck with some cryptic error...: PistonDevelopers/conrod#1410

@AJTJ
Copy link
Author

AJTJ commented Apr 20, 2021

Just want to note that @mitchmindtree and @yutannihilation did update conrod wgpu to 0.7 at PistonDevelopers/conrod#1413

Steps towards wasm :)

@AJTJ
Copy link
Author

AJTJ commented May 9, 2021

@mitchmindtree @Woyten how goes the progress towards wasm? :) Perhaps I can look at something?

@mitchmindtree
Copy link
Member

I haven't personally had a chance to dig into this yet - but I think we must be getting close. There's also a wgpu 0.8 update which I think is just about ready to merge #737 which I imagine would only take us a step closer. @Woyten pointed out some remaining required steps here, and also has a WIP PR here which they might appreciate some help with.

@AJTJ
Copy link
Author

AJTJ commented Jul 24, 2021

@mitchmindtree any news on this one? :)

@Woyten
Copy link
Contributor

Woyten commented Dec 8, 2021

@AJTJ There is an update: #811

@tomoyanonymous
Copy link

I just made a template repo based on @Woyten 's implementation and rustwasm's template.

https://github.com/tomoyanonymous/nannou-web-template

It's working nicely both on the native app and the latest version of Chrome without any flag!

@flbn
Copy link

flbn commented Feb 3, 2023

should this be closed? looks like it's working...

@cxreiff
Copy link

cxreiff commented Jul 1, 2023

Similar template for vite:
https://github.com/cxreiff/vite_nannou_template

I think it should stay open as you currently still need to pick a non-release commit that has the wasm-experimental feature- unless I'm missing something.

@milgner
Copy link

milgner commented Aug 11, 2024

Looks like there are a number of issues open on the subject of WASM.

Given that this thread links to working versions, I assume that the original comments in #7 which suggest that it won't work have been superseded?

But after reading #939 I suppose that we cannot expect any stable release any time soon? I'm currently looking for a creative coding framework that runs in a browser but that isn't in JS. Rust would have been very nice as the backend which provides the data is in Rust, too, which would have enabled me to stick to one language.

@tychedelia
Copy link
Collaborator

Hi! We are currently working on #953, which will continue take some time but should improve our ability to support wasm as this is a big goal of bevy itself. So, stay tuned. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants