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

Cube wasm example throws error in browser. #3568

Closed
danec020 opened this issue Mar 7, 2023 · 2 comments
Closed

Cube wasm example throws error in browser. #3568

danec020 opened this issue Mar 7, 2023 · 2 comments

Comments

@danec020
Copy link

danec020 commented Mar 7, 2023

When building for wasm, the browser throws an unwrap error for the cube example. I haven't tested the others but may be the same with them as well. Note: This is for WebGPU as WebGL works fine.

Repro Steps:

  • Download Repository
  • Cargo build --example cube
  • Cargo run-wasm --example cube
  • Open browser to local host and check the console.

Error when using non WebGPU supported Chrome.

panicked at 'called `Result::unwrap()` on an `Err` value: CreateSurfaceError', wgpu\examples\cube\..\framework.rs:182:10

Stack:

Error
    at imports.wbg.__wbg_new_abda76e883ba8a5f (http://localhost:8000/cube.js:561:21)
    at console_error_panic_hook::Error::new::hf3e514ed9e575257 (http://localhost:8000/cube_bg.wasm:wasm-function[5123]:0x13211c)
    at console_error_panic_hook::hook_impl::h1297dd701c817dab (http://localhost:8000/cube_bg.wasm:wasm-function[876]:0x8c79f)
    at console_error_panic_hook::hook::h04af7c2d5894232a (http://localhost:8000/cube_bg.wasm:wasm-function[5751]:0x13a9fe)
    at core::ops::function::Fn::call::h25e0e9d5e3ca4b78 (http://localhost:8000/cube_bg.wasm:wasm-function[4752]:0x12c4e8)
    at std::panicking::rust_panic_with_hook::hbafe3e603d331223 (http://localhost:8000/cube_bg.wasm:wasm-function[2046]:0xde776)
    at std::panicking::begin_panic_handler::{{closure}}::h8ab6ee68d5b4c391 (http://localhost:8000/cube_bg.wasm:wasm-function[2542]:0xf54b7)
    at std::sys_common::backtrace::__rust_end_short_backtrace::h008f69666d134159 (http://localhost:8000/cube_bg.wasm:wasm-function[6136]:0x13f80b)
    at rust_begin_unwind (http://localhost:8000/cube_bg.wasm:wasm-function[4003]:0x11e82c)
    at core::panicking::panic_fmt::h1d17fc068f528130 (http://localhost:8000/cube_bg.wasm:wasm-function[5582]:0x138797)


imports.wbg.__wbg_error_f851667af71bcfc6 @ cube.js:555
cube_bg.wasm:0x143762 Uncaught (in promise) RuntimeError: unreachable
    at __rust_start_panic (cube_bg.wasm:0x143762)
    at rust_panic (cube_bg.wasm:0x141370)
    at std::panicking::rust_panic_with_hook::hbafe3e603d331223 (cube_bg.wasm:0xde7a1)
    at std::panicking::begin_panic_handler::{{closure}}::h8ab6ee68d5b4c391 (cube_bg.wasm:0xf54b7)
    at std::sys_common::backtrace::__rust_end_short_backtrace::h008f69666d134159 (cube_bg.wasm:0x13f80b)
    at rust_begin_unwind (cube_bg.wasm:0x11e82c)
    at core::panicking::panic_fmt::h1d17fc068f528130 (cube_bg.wasm:0x138797)
    at core::result::unwrap_failed::ha2d692f1494e5dde (cube_bg.wasm:0xfef7e)
    at core::result::Result<T,E>::unwrap::h266b8eab0d7d0dcf (cube_bg.wasm:0x1011a3)
    at cube::framework::setup::{{closure}}::h2c8d338493feb534 (cube_bg.wasm:0xd32d)
`

Error on Canary with WebGPU support

Panicked at 'assertion failed: wasm.is_instance_of::<T>()', wgpu\src\backend\web.rs:53:9

Stack:

Error
    at imports.wbg.__wbg_new_abda76e883ba8a5f (http://localhost:8000/cube.js:561:21)
    at console_error_panic_hook::Error::new::hf3e514ed9e575257 (http://localhost:8000/cube_bg.wasm:wasm-function[5123]:0x13211c)
    at console_error_panic_hook::hook_impl::h1297dd701c817dab (http://localhost:8000/cube_bg.wasm:wasm-function[876]:0x8c79f)
    at console_error_panic_hook::hook::h04af7c2d5894232a (http://localhost:8000/cube_bg.wasm:wasm-function[5751]:0x13a9fe)
    at core::ops::function::Fn::call::h25e0e9d5e3ca4b78 (http://localhost:8000/cube_bg.wasm:wasm-function[4752]:0x12c4e8)
    at std::panicking::rust_panic_with_hook::hbafe3e603d331223 (http://localhost:8000/cube_bg.wasm:wasm-function[2046]:0xde776)
    at std::panicking::begin_panic_handler::{{closure}}::h8ab6ee68d5b4c391 (http://localhost:8000/cube_bg.wasm:wasm-function[2542]:0xf5489)
    at std::sys_common::backtrace::__rust_end_short_backtrace::h008f69666d134159 (http://localhost:8000/cube_bg.wasm:wasm-function[6136]:0x13f80b)
    at rust_begin_unwind (http://localhost:8000/cube_bg.wasm:wasm-function[4003]:0x11e82c)
    at core::panicking::panic_fmt::h1d17fc068f528130 (http://localhost:8000/cube_bg.wasm:wasm-function[5582]:0x138797)


imports.wbg.__wbg_error_f851667af71bcfc6 @ cube.js:555
$console_error_panic_hook::error::h93d9fdb52440fd98 @ cube_bg.wasm:0xf100e
$console_error_panic_hook::hook_impl::h1297dd701c817dab @ cube_bg.wasm:0x8c88b
$console_error_panic_hook::hook::h04af7c2d5894232a @ cube_bg.wasm:0x13a9fe
$core::ops::function::Fn::call::h25e0e9d5e3ca4b78 @ cube_bg.wasm:0x12c4e8
$std::panicking::rust_panic_with_hook::hbafe3e603d331223 @ cube_bg.wasm:0xde776
$std::panicking::begin_panic_handler::{{closure}}::h8ab6ee68d5b4c391 @ cube_bg.wasm:0xf5489
$std::sys_common::backtrace::__rust_end_short_backtrace::h008f69666d134159 @ cube_bg.wasm:0x13f80b
$rust_begin_unwind @ cube_bg.wasm:0x11e82c
$core::panicking::panic_fmt::h1d17fc068f528130 @ cube_bg.wasm:0x138797
$core::panicking::panic::h27b5eefa3e4ff738 @ cube_bg.wasm:0x122d27
$<wgpu::backend::web::Identified<T> as core::convert::From<wgpu::context::ObjectId>>::from::h9886815542be7c36 @ cube_bg.wasm:0xddc8c
$<T as wgpu::context::DynContext>::adapter_downlevel_capabilities::hfe1ae8c292f8a1bd @ cube_bg.wasm:0xeb1d7
$wgpu::Adapter::get_downlevel_capabilities::he50505c609c4bf18 @ cube_bg.wasm:0xe87e6
$cube::framework::setup::{{closure}}::h2c8d338493feb534 @ cube_bg.wasm:0xd89e
$cube::framework::run::{{closure}}::ha02852b6b04d1aa1 @ cube_bg.wasm:0x40415
$wasm_bindgen_futures::task::singlethread::Task::run::h85fa19fdb5864191 @ cube_bg.wasm:0x708fd
$wasm_bindgen_futures::queue::QueueState::run_all::h7eba45539b26bd3b @ cube_bg.wasm:0x61fed
$wasm_bindgen_futures::queue::Queue::new::{{closure}}::hecad0300d40bcbd3 @ cube_bg.wasm:0x104e2a
$<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h9eb70fd6bf08dbbb @ cube_bg.wasm:0xe24af
__wbg_adapter_58 @ cube.js:256
real @ cube.js:201
Promise.then (async)
imports.wbg.__wbg_then_ec5db6d509eb475f @ cube.js:1639
$js_sys::Promise::then::hc765b1e18f26a8fb @ cube_bg.wasm:0x111089
$wasm_bindgen_futures::queue::Queue::schedule_task::h5fb77c97155bc08a @ cube_bg.wasm:0x9194e
$wasm_bindgen_futures::queue::Queue::push_task::h38d3e586f79fd17d @ cube_bg.wasm:0x13225f
$wasm_bindgen_futures::task::singlethread::Task::wake_by_ref::{{closure}}::hb723899528afaf55 @ cube_bg.wasm:0x121b9c
$std::thread::local::LocalKey<T>::try_with::h5fd4860c396ab55b @ cube_bg.wasm:0x98f2e
$std::thread::local::LocalKey<T>::with::h7cf910003e81a027 @ cube_bg.wasm:0xebca8
$wasm_bindgen_futures::task::singlethread::Task::wake_by_ref::h93bbf92b80a55361 @ cube_bg.wasm:0xe3e00
$wasm_bindgen_futures::task::singlethread::Task::into_raw_waker::raw_wake::hd420b493ef715b60 @ cube_bg.wasm:0x10f997
$core::task::wake::Waker::wake::h700a0c5221fb522b @ cube_bg.wasm:0x11746f
$<wasm_bindgen_futures::JsFuture as core::convert::From<js_sys::Promise>>::from::finish::h2aa3017b3a440aff @ cube_bg.wasm:0x5ac57
$<wasm_bindgen_futures::JsFuture as core::convert::From<js_sys::Promise>>::from::{{closure}}::h2b27b764db4661a8 @ cube_bg.wasm:0xfff91
$core::ops::function::FnOnce::call_once::h4736c9b165ae53b3 @ cube_bg.wasm:0x10e8a7
$<T as wasm_bindgen::closure::WasmClosureFnOnce<A,R>>::into_fn_mut::{{closure}}::h028dae16e38ca713 @ cube_bg.wasm:0x10e991
$<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h9eb70fd6bf08dbbb @ cube_bg.wasm:0xe24af
__wbg_adapter_58 @ cube.js:256
real @ cube.js:201
Promise.then (async)
imports.wbg.__wbg_then_f753623316e2873a @ cube.js:1643
$js_sys::Promise::then2::h4f6c1b952d5425e0 @ cube_bg.wasm:0x10524c
$<wasm_bindgen_futures::JsFuture as core::convert::From<js_sys::Promise>>::from::h5b68f645d911a127 @ cube_bg.wasm:0x4093f
$<wgpu::backend::web::Context as wgpu::context::Context>::instance_request_adapter::h63a58c2321646861 @ cube_bg.wasm:0xd7450
$<T as wgpu::context::DynContext>::instance_request_adapter::hadc745bf1281ed2b @ cube_bg.wasm:0xacea1
$wgpu::Instance::request_adapter::hababbf79a33ce6c1 @ cube_bg.wasm:0xceeb5
$wgpu::util::init::initialize_adapter_from_env_or_default::{{closure}}::h544d110ed5c3e9b0 @ cube_bg.wasm:0x30420
$cube::framework::setup::{{closure}}::h2c8d338493feb534 @ cube_bg.wasm:0xd55f
$cube::framework::run::{{closure}}::ha02852b6b04d1aa1 @ cube_bg.wasm:0x40415
$wasm_bindgen_futures::task::singlethread::Task::run::h85fa19fdb5864191 @ cube_bg.wasm:0x708fd
$wasm_bindgen_futures::queue::QueueState::run_all::h7eba45539b26bd3b @ cube_bg.wasm:0x61fed
$wasm_bindgen_futures::queue::Queue::new::{{closure}}::hecad0300d40bcbd3 @ cube_bg.wasm:0x104e2a
$<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h9eb70fd6bf08dbbb @ cube_bg.wasm:0xe24af
__wbg_adapter_58 @ cube.js:256
real @ cube.js:201
Promise.then (async)
imports.wbg.__wbg_then_ec5db6d509eb475f @ cube.js:1639
$js_sys::Promise::then::hc765b1e18f26a8fb @ cube_bg.wasm:0x111089
$wasm_bindgen_futures::queue::Queue::schedule_task::h5fb77c97155bc08a @ cube_bg.wasm:0x9194e
$wasm_bindgen_futures::task::singlethread::Task::spawn::{{closure}}::h152cf58ad470712c @ cube_bg.wasm:0x13229c
$std::thread::local::LocalKey<T>::try_with::h2c5fd51cc9f4da22 @ cube_bg.wasm:0x92cf2
$std::thread::local::LocalKey<T>::with::hbfbf7e0319809d8b @ cube_bg.wasm:0xebd64
$wasm_bindgen_futures::task::singlethread::Task::spawn::h1f716c6645735579 @ cube_bg.wasm:0x60609
$wasm_bindgen_futures::spawn_local::hd9f44bfd728a63ba @ cube_bg.wasm:0x10e21d
$cube::framework::run::he304396696feb99d @ cube_bg.wasm:0xc986a
$cube::main::h01de5355b1d29cbd @ cube_bg.wasm:0x143026
$core::ops::function::FnOnce::call_once::h6d81ba0c73bc1595 @ cube_bg.wasm:0x138c0c
$std::sys_common::backtrace::__rust_begin_short_backtrace::h7f8ed9268b3bb469 @ cube_bg.wasm:0x13a1fc
$std::rt::lang_start::{{closure}}::haeef17a22ccb51f7 @ cube_bg.wasm:0x10cd9c
$std::rt::lang_start_internal::h14d415b51601c1a5 @ cube_bg.wasm:0x93022
$std::rt::lang_start::h98d5f8e6b1673b1c @ cube_bg.wasm:0x1021ef
$main @ cube_bg.wasm:0x1425ea
$__wbindgen_start @ cube_bg.wasm:0x143475
finalizeInit @ cube.js:1767
init @ cube.js:1799
await in init (async)
(anonymous) @ (index):17
load (async)
(anonymous) @ (index):16
cube_bg.wasm:0x143762 Uncaught (in promise) RuntimeError: unreachable
    at __rust_start_panic (cube_bg.wasm:0x143762)
    at rust_panic (cube_bg.wasm:0x141370)
    at std::panicking::rust_panic_with_hook::hbafe3e603d331223 (cube_bg.wasm:0xde7a1)
    at std::panicking::begin_panic_handler::{{closure}}::h8ab6ee68d5b4c391 (cube_bg.wasm:0xf5489)
    at std::sys_common::backtrace::__rust_end_short_backtrace::h008f69666d134159 (cube_bg.wasm:0x13f80b)
    at rust_begin_unwind (cube_bg.wasm:0x11e82c)
    at core::panicking::panic_fmt::h1d17fc068f528130 (cube_bg.wasm:0x138797)
    at core::panicking::panic::h27b5eefa3e4ff738 (cube_bg.wasm:0x122d27)
    at <wgpu::backend::web::Identified<T> as core::convert::From<wgpu::context::ObjectId>>::from::h9886815542be7c36 (cube_bg.wasm:0xddc8c)
    at <T as wgpu::context::DynContext>::adapter_downlevel_capabilities::hfe1ae8c292f8a1bd (cube_bg.wasm:0xeb1d7)
$__rust_start_panic @ cube_bg.wasm:0x143762
$rust_panic @ cube_bg.wasm:0x141370
$std::panicking::rust_panic_with_hook::hbafe3e603d331223 @ cube_bg.wasm:0xde7a1
$std::panicking::begin_panic_handler::{{closure}}::h8ab6ee68d5b4c391 @ cube_bg.wasm:0xf5489
$std::sys_common::backtrace::__rust_end_short_backtrace::h008f69666d134159 @ cube_bg.wasm:0x13f80b
$rust_begin_unwind @ cube_bg.wasm:0x11e82c
$core::panicking::panic_fmt::h1d17fc068f528130 @ cube_bg.wasm:0x138797
$core::panicking::panic::h27b5eefa3e4ff738 @ cube_bg.wasm:0x122d27
$<wgpu::backend::web::Identified<T> as core::convert::From<wgpu::context::ObjectId>>::from::h9886815542be7c36 @ cube_bg.wasm:0xddc8c
$<T as wgpu::context::DynContext>::adapter_downlevel_capabilities::hfe1ae8c292f8a1bd @ cube_bg.wasm:0xeb1d7
$wgpu::Adapter::get_downlevel_capabilities::he50505c609c4bf18 @ cube_bg.wasm:0xe87e6
$cube::framework::setup::{{closure}}::h2c8d338493feb534 @ cube_bg.wasm:0xd89e
$cube::framework::run::{{closure}}::ha02852b6b04d1aa1 @ cube_bg.wasm:0x40415
$wasm_bindgen_futures::task::singlethread::Task::run::h85fa19fdb5864191 @ cube_bg.wasm:0x708fd
$wasm_bindgen_futures::queue::QueueState::run_all::h7eba45539b26bd3b @ cube_bg.wasm:0x61fed
$wasm_bindgen_futures::queue::Queue::new::{{closure}}::hecad0300d40bcbd3 @ cube_bg.wasm:0x104e2a
$<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h9eb70fd6bf08dbbb @ cube_bg.wasm:0xe24af
__wbg_adapter_58 @ cube.js:256
real @ cube.js:201
Promise.then (async)
imports.wbg.__wbg_then_ec5db6d509eb475f @ cube.js:1639
$js_sys::Promise::then::hc765b1e18f26a8fb @ cube_bg.wasm:0x111089
$wasm_bindgen_futures::queue::Queue::schedule_task::h5fb77c97155bc08a @ cube_bg.wasm:0x9194e
$wasm_bindgen_futures::queue::Queue::push_task::h38d3e586f79fd17d @ cube_bg.wasm:0x13225f
$wasm_bindgen_futures::task::singlethread::Task::wake_by_ref::{{closure}}::hb723899528afaf55 @ cube_bg.wasm:0x121b9c
$std::thread::local::LocalKey<T>::try_with::h5fd4860c396ab55b @ cube_bg.wasm:0x98f2e
$std::thread::local::LocalKey<T>::with::h7cf910003e81a027 @ cube_bg.wasm:0xebca8
$wasm_bindgen_futures::task::singlethread::Task::wake_by_ref::h93bbf92b80a55361 @ cube_bg.wasm:0xe3e00
$wasm_bindgen_futures::task::singlethread::Task::into_raw_waker::raw_wake::hd420b493ef715b60 @ cube_bg.wasm:0x10f997
$core::task::wake::Waker::wake::h700a0c5221fb522b @ cube_bg.wasm:0x11746f
$<wasm_bindgen_futures::JsFuture as core::convert::From<js_sys::Promise>>::from::finish::h2aa3017b3a440aff @ cube_bg.wasm:0x5ac57
$<wasm_bindgen_futures::JsFuture as core::convert::From<js_sys::Promise>>::from::{{closure}}::h2b27b764db4661a8 @ cube_bg.wasm:0xfff91
$core::ops::function::FnOnce::call_once::h4736c9b165ae53b3 @ cube_bg.wasm:0x10e8a7
$<T as wasm_bindgen::closure::WasmClosureFnOnce<A,R>>::into_fn_mut::{{closure}}::h028dae16e38ca713 @ cube_bg.wasm:0x10e991
$<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h9eb70fd6bf08dbbb @ cube_bg.wasm:0xe24af
__wbg_adapter_58 @ cube.js:256
real @ cube.js:201
Promise.then (async)
imports.wbg.__wbg_then_f753623316e2873a @ cube.js:1643
$js_sys::Promise::then2::h4f6c1b952d5425e0 @ cube_bg.wasm:0x10524c
$<wasm_bindgen_futures::JsFuture as core::convert::From<js_sys::Promise>>::from::h5b68f645d911a127 @ cube_bg.wasm:0x4093f
$<wgpu::backend::web::Context as wgpu::context::Context>::instance_request_adapter::h63a58c2321646861 @ cube_bg.wasm:0xd7450
$<T as wgpu::context::DynContext>::instance_request_adapter::hadc745bf1281ed2b @ cube_bg.wasm:0xacea1
$wgpu::Instance::request_adapter::hababbf79a33ce6c1 @ cube_bg.wasm:0xceeb5
$wgpu::util::init::initialize_adapter_from_env_or_default::{{closure}}::h544d110ed5c3e9b0 @ cube_bg.wasm:0x30420
$cube::framework::setup::{{closure}}::h2c8d338493feb534 @ cube_bg.wasm:0xd55f
$cube::framework::run::{{closure}}::ha02852b6b04d1aa1 @ cube_bg.wasm:0x40415
$wasm_bindgen_futures::task::singlethread::Task::run::h85fa19fdb5864191 @ cube_bg.wasm:0x708fd
$wasm_bindgen_futures::queue::QueueState::run_all::h7eba45539b26bd3b @ cube_bg.wasm:0x61fed
$wasm_bindgen_futures::queue::Queue::new::{{closure}}::hecad0300d40bcbd3 @ cube_bg.wasm:0x104e2a
$<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h9eb70fd6bf08dbbb @ cube_bg.wasm:0xe24af
__wbg_adapter_58 @ cube.js:256
real @ cube.js:201
Promise.then (async)
imports.wbg.__wbg_then_ec5db6d509eb475f @ cube.js:1639
$js_sys::Promise::then::hc765b1e18f26a8fb @ cube_bg.wasm:0x111089
$wasm_bindgen_futures::queue::Queue::schedule_task::h5fb77c97155bc08a @ cube_bg.wasm:0x9194e
$wasm_bindgen_futures::task::singlethread::Task::spawn::{{closure}}::h152cf58ad470712c @ cube_bg.wasm:0x13229c
$std::thread::local::LocalKey<T>::try_with::h2c5fd51cc9f4da22 @ cube_bg.wasm:0x92cf2
$std::thread::local::LocalKey<T>::with::hbfbf7e0319809d8b @ cube_bg.wasm:0xebd64
$wasm_bindgen_futures::task::singlethread::Task::spawn::h1f716c6645735579 @ cube_bg.wasm:0x60609
$wasm_bindgen_futures::spawn_local::hd9f44bfd728a63ba @ cube_bg.wasm:0x10e21d
$cube::framework::run::he304396696feb99d @ cube_bg.wasm:0xc986a
$cube::main::h01de5355b1d29cbd @ cube_bg.wasm:0x143026
$core::ops::function::FnOnce::call_once::h6d81ba0c73bc1595 @ cube_bg.wasm:0x138c0c
$std::sys_common::backtrace::__rust_begin_short_backtrace::h7f8ed9268b3bb469 @ cube_bg.wasm:0x13a1fc
$std::rt::lang_start::{{closure}}::haeef17a22ccb51f7 @ cube_bg.wasm:0x10cd9c
$std::rt::lang_start_internal::h14d415b51601c1a5 @ cube_bg.wasm:0x93022
$std::rt::lang_start::h98d5f8e6b1673b1c @ cube_bg.wasm:0x1021ef
$main @ cube_bg.wasm:0x1425ea
$__wbindgen_start @ cube_bg.wasm:0x143475
finalizeInit @ cube.js:1767
init @ cube.js:1799
await in init (async)
(anonymous) @ (index):17
load (async)
(anonymous) @ (index):16
@codeart1st
Copy link

#3430

@danec020
Copy link
Author

danec020 commented Mar 8, 2023

#3430

Thanks! That explains the issue well and is probably also why I didn't find this problem already listed. I did not realize it was an issue with dynamic dispatch.

@cwfitzgerald cwfitzgerald closed this as not planned Won't fix, can't repro, duplicate, stale Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants