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 support #6

Open
databasedav opened this issue May 17, 2024 · 1 comment
Open

wasm support #6

databasedav opened this issue May 17, 2024 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@databasedav
Copy link
Contributor

just wanted to add some tracking for this

However, when the task executor is running on a single thread (on wasm, for example), the async world will probably deadlock. If this is a pain-point for you, please open a GitHub issue.

i believe this is blocked on this PR smol-rs/async-io#153, however, when i update the async-io dependency to

async-io = { git = "https://github.com/smol-rs/async-io", branch = "notgull/web" }

and try to run the basic example following these instructions https://bevy-cheatbook.github.io/platforms/wasm.html, i get the following on when navigating to the served url

on firefox

ERROR app: panicked at /home/avi/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.19.1/src/lib.rs:1809:13:
No wgpu backend feature that is implemented for the target platform was enabled. See `wgpu::Instance::any_backend_feature_enabled()` for more information.

Stack:

__wbg_get_imports/imports.wbg.__wbg_new_abda76e883ba8a5f@http://127.0.0.1:1334/api/wasm.js:408:13
__wbg_new_abda76e883ba8a5f externref shim@http://127.0.0.1:1334/api/wasm.wasm:wasm-function[233694]:0x4057f7c
console_error_panic_hook::Error::new::h63df324f7c858bae@http://127.0.0.1:1334/api/wasm.wasm:wasm-function[166912]:0x3cf73a3
console_error_panic_hook::hook_impl::hf766909e468ef70e@http://127.0.0.1:1334/api/wasm.wasm:wasm-function[32286]:0x26e69d3
console_error_panic_hook::hook::hfde64c16164fad88@http://127.0.0.1:1334/api/wasm.wasm:wasm-function[203252]:0x3f23855
core::ops::function::Fn::call::ha1f82010650f515b@http://127.0.0.1:1334/api/wasm.wasm:wasm-function[180579]:0x3de57b9
std::panicking::rust_panic_with_hook::h1e6ac5d404b8e31b@http://127.0.0.1:1334/api/wasm.wasm:wasm-function[67732]:0x30cc5e0
std::panicking::begin_panic_handler::{{closure}}::h24b0f4622f2766a5@http://127.0.0.1:1334/api/wasm.wasm:wasm-function[88845]:0x34a8105
std::sys_common::backtrace::__rust_end_short_backtrace::h19f35d272c126e7c@http://127.0.0.1:1334/api/wasm.wasm:wasm-function[235506]:0x405deda
rust_begin_unwind@http://127.0.0.1:1334/api/wasm.wasm:wasm-function[180984]:0x3dec01c
core::panicking::panic_fmt::h87755523850ece9e@http://127.0.0.1:1334/api/wasm.wasm:wasm-function[195922]:0x3ec4dd7
wgpu::Instance::new::hcdd38eeb57f95ec1@http://127.0.0.1:1334/api/wasm.wasm:wasm-function[73947]:0x320a7d2
<bevy_render::RenderPlugin as bevy_app::plugin::Plugin>::build::{{closure}}::h21bdd6de059d8d5f@http://127.0.0.1:1334/api/wasm.wasm:wasm-function[473]:0x66f133
bevy_tasks::single_threaded_task_pool::TaskPool::spawn::{{closure}}::hac47b39232b39b8a@http://127.0.0.1:1334/api/wasm.wasm:wasm-function[24864]:0x23c1a02
wasm_bindgen_futures::task::singlethread::Task::run::hd49527446ce517a3@http://127.0.0.1:1334/api/wasm.wasm:wasm-function[23592]:0x231d706
wasm_bindgen_futures::queue::QueueState::run_all::h3ad72d2a6d6c3f02@http://127.0.0.1:1334/api/wasm.wasm:wasm-function[15692]:0x1e637e4
wasm_bindgen_futures::queue::Queue::new::{{closure}}::hd683b5a3dbdbb7b9@http://127.0.0.1:1334/api/wasm.wasm:wasm-function[110933]:0x37c4317
<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::hd548e900a55de4b4@http://127.0.0.1:1334/api/wasm.wasm:wasm-function[69241]:0x311cd0d
closure40191 externref shim@http://127.0.0.1:1334/api/wasm.wasm:wasm-function[233271]:0x4055a5b
__wbg_adapter_57@http://127.0.0.1:1334/api/wasm.js:222:6
real@http://127.0.0.1:1334/api/wasm.js:171:32

on chrome

ERROR app: panicked at /home/avi/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.19.1/src/lib.rs:1809:13:
No wgpu backend feature that is implemented for the target platform was enabled. See `wgpu::Instance::any_backend_feature_enabled()` for more information.

Stack:

Error
    at imports.wbg.__wbg_new_abda76e883ba8a5f (http://127.0.0.1:1334/api/wasm.js:408:13)
    at __wbg_new_abda76e883ba8a5f externref shim (http://127.0.0.1:1334/api/wasm.wasm:wasm-function[233694]:0x4057f7c)
    at console_error_panic_hook::Error::new::h63df324f7c858bae (http://127.0.0.1:1334/api/wasm.wasm:wasm-function[166912]:0x3cf73a3)
    at console_error_panic_hook::hook_impl::hf766909e468ef70e (http://127.0.0.1:1334/api/wasm.wasm:wasm-function[32286]:0x26e69d3)
    at console_error_panic_hook::hook::hfde64c16164fad88 (http://127.0.0.1:1334/api/wasm.wasm:wasm-function[203252]:0x3f23855)
    at core::ops::function::Fn::call::ha1f82010650f515b (http://127.0.0.1:1334/api/wasm.wasm:wasm-function[180579]:0x3de57b9)
    at std::panicking::rust_panic_with_hook::h1e6ac5d404b8e31b (http://127.0.0.1:1334/api/wasm.wasm:wasm-function[67732]:0x30cc5e0)
    at std::panicking::begin_panic_handler::{{closure}}::h24b0f4622f2766a5 (http://127.0.0.1:1334/api/wasm.wasm:wasm-function[88845]:0x34a8105)
    at std::sys_common::backtrace::__rust_end_short_backtrace::h19f35d272c126e7c (http://127.0.0.1:1334/api/wasm.wasm:wasm-function[235506]:0x405deda)
    at rust_begin_unwind (http://127.0.0.1:1334/api/wasm.wasm:wasm-function[180984]:0x3dec01c)

i'm not sure if this is actually relevant to this crate, or i'm just doing something wrong, also wasn't able to find anything about the wgpu backend feature stuff

@dlom
Copy link
Owner

dlom commented Jun 4, 2024

Thank you for your experiments. I will attempt to enable WASM support likely after bevy 0.14 releases in the near future.

@dlom dlom added enhancement New feature or request help wanted Extra attention is needed labels Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants