bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
36.73k stars 3.61k forks source link

WASM WebGL examples crash "wgpu error: Validation Error" #8047

Closed heinzelotto closed 1 year ago

heinzelotto commented 1 year ago

Bevy version

0.10.0 (or whichever version is currently used in the bevy WASM examples).

Relevant system information

Android 12 Chrome (v110.0) on pixel 3a, and android 13 Firefox (v110.1) on pixel 4a.

`AdapterInfo { name: "Adreno (TM) 615", vendor: 20803, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Gl }`

What you did

Opened the https://bevyengine.org/examples/3d/3d-scene/

What went wrong

The 3d scene does not load.

Additional information

I am not sure whether the error is in gfx-rs/naga or bevy's usage of it (through gfx-rs/wgpu). The string Assertion failed: false && "Unknown named pointer type or missing metadata" also appears in https://github.com/google/filament/issues/6355 .

My own bevy application that uses PbrBundles also had this problem in the WASM build. Then while looking for a cause I noticed that the example also does not run. Removing all PbrBundles or rolling back to bevy 0.9.1 both cause the error to disappear.

chrome on android console log:

2023-03-11-220834_1152x813_scrot

3d_scene.js:368 INFO crates/bevy_winit/src/system.rs:51 Creating new window "Bevy App" (0v0)
3d_scene.js:368 INFO crates/bevy_render/src/renderer/mod.rs:128 AdapterInfo { name: "Adreno (TM) 615", vendor: 20803, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Gl }
3d_scene.js:1069 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu
(anonymous) @ 3d_scene.js:1069
handleError @ 3d_scene.js:238
imports.wbg.__wbg_newwithcontextoptions_6c6a79a71ed7efa3 @ 3d_scene.js:1068
$web_sys::features::gen_AudioContext::AudioContext::new_with_context_options::ha94b89a135bed2d1 @ 0579948a:0xe75281
$<cpal::host::webaudio::Device as cpal::traits::DeviceTrait>::build_output_stream_raw::hcf4f90d02fcc6b21 @ 0579948a:0x2c8e37
$<cpal::platform::platform_impl::Device as rodio::stream::CpalDeviceExt>::new_output_stream_with_format::ha1c184b5890ab365 @ 0579948a:0x284651
$<cpal::platform::platform_impl::Device as rodio::stream::CpalDeviceExt>::try_new_output_stream_config::h7b6caeb12e8a238d @ 0579948a:0x5a73dc
$rodio::stream::OutputStream::try_from_device_config::hcdb3f909034fc80a @ 0579948a:0x76caad
$rodio::stream::OutputStream::try_default::h5128867b7c029c9b @ 0579948a:0x5478d9
$<T as bevy_ecs::world::FromWorld>::from_world::h407da30cb0f34772 @ 0579948a:0xa94164
$bevy_app::app::App::init_resource::h7afb885464a4de8c @ 0579948a:0x6a672f
$<bevy_audio::AudioPlugin as bevy_app::plugin::Plugin>::build::h7b56af866cce7f92 @ 0579948a:0xe71466
$bevy_app::app::App::add_boxed_plugin::h2210e446ce8b74b4 @ 0579948a:0x3a91fc
$bevy_app::plugin_group::PluginGroupBuilder::finish::hc518d27aa582e36e @ 0579948a:0x52fef9
$_3d_scene::main::hac1f03664ce5a2e6 @ 0579948a:0x2ff921
$std::sys_common::backtrace::__rust_begin_short_backtrace::h7d6950ad3cf8e90f @ 0579948a:0xeef88f
$std::rt::lang_start::{{closure}}::hbac199d3774bc2e9 @ 0579948a:0xe93865
$std::rt::lang_start_internal::h47a582f19b98cc9f @ 0579948a:0xc11383
$main @ 0579948a:0xe8c766
$__wbindgen_start @ 0579948a:0xee7564
finalizeInit @ 3d_scene.js:1847
init @ 3d_scene.js:1879
await in init (async)
(anonymous) @ (index):286
3d_scene.js:1085 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu
(anonymous) @ 3d_scene.js:1085
handleError @ 3d_scene.js:238
imports.wbg.__wbg_resume_72fe7cd3e68b861a @ 3d_scene.js:1084
$web_sys::features::gen_AudioContext::AudioContext::resume::h8f55082cd0d59b8d @ 0579948a:0xe75356
$<cpal::host::webaudio::Stream as cpal::traits::StreamTrait>::play::hd14c42327a9fc2bd @ 0579948a:0x7f20c3
$<cpal::platform::platform_impl::Stream as cpal::traits::StreamTrait>::play::h2cf8e833296a4838 @ 0579948a:0xeeda19
$rodio::stream::OutputStream::try_from_device_config::hcdb3f909034fc80a @ 0579948a:0x76cb83
$rodio::stream::OutputStream::try_default::h5128867b7c029c9b @ 0579948a:0x5478d9
$<T as bevy_ecs::world::FromWorld>::from_world::h407da30cb0f34772 @ 0579948a:0xa94164
$bevy_app::app::App::init_resource::h7afb885464a4de8c @ 0579948a:0x6a672f
$<bevy_audio::AudioPlugin as bevy_app::plugin::Plugin>::build::h7b56af866cce7f92 @ 0579948a:0xe71466
$bevy_app::app::App::add_boxed_plugin::h2210e446ce8b74b4 @ 0579948a:0x3a91fc
$bevy_app::plugin_group::PluginGroupBuilder::finish::hc518d27aa582e36e @ 0579948a:0x52fef9
$_3d_scene::main::hac1f03664ce5a2e6 @ 0579948a:0x2ff921
$std::sys_common::backtrace::__rust_begin_short_backtrace::h7d6950ad3cf8e90f @ 0579948a:0xeef88f
$std::rt::lang_start::{{closure}}::hbac199d3774bc2e9 @ 0579948a:0xe93865
$std::rt::lang_start_internal::h47a582f19b98cc9f @ 0579948a:0xc11383
$main @ 0579948a:0xe8c766
$__wbindgen_start @ 0579948a:0xee7564
finalizeInit @ 3d_scene.js:1847
init @ 3d_scene.js:1879
await in init (async)
(anonymous) @ (index):286
3d_scene.js:368 ERROR  Shader translation error for stage VERTEX | FRAGMENT | VERTEX_FRAGMENT: Assertion failed: false && "Unknown named pointer type or missing metadata"
konsti219 commented 1 year ago

I am also experiencing this issue. I can tell that it was working fine with bevy 0.9.1 but breaks in 0.10.0.

heinzelotto commented 1 year ago

I just noticed the error tells me to report it to upstream, so I also did that now.

SnowdenWintermute commented 9 months ago

I am getting this now on 0.13.0. In Firefox it works but on Chromium I get:

wgpu error: Validation Error

Caused by:
    In Device::create_render_pipeline
      note: label = `tonemapping pipeline`
    Internal error in ShaderStages(VERTEX) shader: 

I get the error when looking at the examples. When I try to compile my own wasm project it works in 0.12.0 in Chromium but not on 0.13.0.

My CPU: Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz

My graphics: NVIDIA NVS 5400M