Bevy: Unable to compile bevy_wgpu for WASM

Created on 5 Nov 2020  路  4Comments  路  Source: bevyengine/bevy

Bevy 0.3.0

So I wanted to run a simple WASM app, but there's a problem with bevy_wgpu. When I compiled without it, I got this error in browser console: "panicked at 'Resource does not exist alloc::boxed::Box<dyn bevy_render::renderer::render_resource_context::RenderResourceContext>". And it makes sense, because renderer uses wgpu backend, but then I added bevy_wgpu and compilation failed with many errors related to web_sys (for example "failed to resolve: could not find GpuShaderModuleDescriptor in web_sys").

So is there any way to run bevy with wgpu on WASM?

bug platform web rendering

Most helpful comment

While waiting for webgpu and browser support to stabilize a bit more, the current path is to use a webgl backend. #613 adds WebGL2 backend to bevy and examples of it is showcased in https://mrk.sed.pl/bevy-showcase/

bevy_webgl2 is available as external plugin now: https://github.com/mrk-its/bevy_webgl2
It is still lacking documentation, but there are working examples and simple shell script for building them

All 4 comments

Currently I'm not aware of anyone getting bevy/wgpu/web working entirely yet, as takes a few more steps to align branches of wgpu with firefox's current support for webgpu https://github.com/gfx-rs/wgpu-rs#run-examples-on-the-web-wasm32-unknown-unknown

While waiting for webgpu and browser support to stabilize a bit more, the current path is to use a webgl backend. https://github.com/bevyengine/bevy/pull/613 adds WebGL2 backend to bevy and examples of it is showcased in https://mrk.sed.pl/bevy-showcase/

Yup @memoryruins is right. That being said I'd love to get WebGPU support working!

There is also interest in targeting WebGL in wgpu https://github.com/gfx-rs/wgpu/issues/115#issuecomment-722136678

While waiting for webgpu and browser support to stabilize a bit more, the current path is to use a webgl backend. #613 adds WebGL2 backend to bevy and examples of it is showcased in https://mrk.sed.pl/bevy-showcase/

bevy_webgl2 is available as external plugin now: https://github.com/mrk-its/bevy_webgl2
It is still lacking documentation, but there are working examples and simple shell script for building them

Was this page helpful?
0 / 5 - 0 ratings