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

Crash due to wgpu during startup on Wayland #14494

Open
umut-sahin opened this issue Jul 27, 2024 · 8 comments
Open

Crash due to wgpu during startup on Wayland #14494

umut-sahin opened this issue Jul 27, 2024 · 8 comments
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior C-Startup A crash that occurs when first attempting to run a Bevy app O-Linux Specific to the Linux desktop operating system O-Vulkan Specific to the Vulkan render API P-Crash A sudden unexpected crash

Comments

@umut-sahin
Copy link
Contributor

Bevy version

v0.14.0

Relevant system information

  • Rust: v1.82.0-nightly (5f6b9a922 2024-07-19)
  • OS: Arch Linux with kernel v6.10.1-arch1-1

What you did

App::new().add_plugins(DefaultPlugins).run()

What went wrong

2024-07-26T21:40:39.730796Z ERROR wgpu_hal::vulkan::instance: GENERAL [Loader Message (0x0)]
    setup_loader_term_phys_devs:  Failed to detect any valid GPUs in the current config    
2024-07-26T21:40:39.730807Z ERROR wgpu_hal::vulkan::instance:     objects: (type: INSTANCE, hndl: 0x5d5f80d8b9d0, name: ?)    
2024-07-26T21:40:39.730810Z ERROR wgpu_hal::vulkan::instance: enumerate_adapters: Initialization of an object has failed    
2024-07-26T21:40:39.731380Z  INFO bevy_render::renderer: AdapterInfo { name: "NV172", vendor: 65541, device: 0, device_type: Other, driver: "OpenGL", driver_info: "4.3 (Compatibility Profile) Mesa 24.1.4-arch1.2", backend: Gl }
2024-07-26T21:40:39.780780Z  WARN bevy_pbr::ssao: ScreenSpaceAmbientOcclusionPlugin not loaded. GPU lacks support: TextureFormat::R16Float does not support TextureUsages::STORAGE_BINDING.
2024-07-26T21:40:39.780925Z  INFO bevy_winit::system: Creating new window "App" (Entity { index: 0, generation: 1 })
2024-07-26T21:40:39.781217Z  INFO winit::platform_impl::linux::x11::window: Guessed window scale factor: 1
2024-07-26T21:40:39.791330Z ERROR wgpu_core::device::global: surface configuration failed: incompatible window kind    

Additional information

     description: VGA compatible controller
       product: GA102 [GeForce RTX 3080 Ti]
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       logical name: /dev/fb0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vga_controller bus_master cap_list rom fb
       configuration: depth=32 driver=nouveau latency=0 mode=2560x1440 resolution=2560,1440 visual=truecolor xres=2560 yres=1440
       resources: iomemory:400-3ff iomemory:440-43f irq:243 memory:84000000-84ffffff memory:4000000000-43ffffffff memory:4400000000-4401ffffff ioport:5000(size=128) memory:85000000-8507ffff

Let me know if anything else is needed!

@umut-sahin umut-sahin added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Jul 27, 2024
@TrialDragon TrialDragon added A-Rendering Drawing game state to the screen P-Crash A sudden unexpected crash O-Linux Specific to the Linux desktop operating system S-Needs-Investigation This issue requires detective work to figure out what's going wrong C-Startup A crash that occurs when first attempting to run a Bevy app O-Vulkan Specific to the Vulkan render API and removed S-Needs-Triage This issue needs to be labelled labels Jul 27, 2024
@Friz64
Copy link
Contributor

Friz64 commented Jul 27, 2024

Looks like winit is using the X11 backend. Maybe something with XWayland is broken on your machine. What happens when you enable bevy's wayland feature?

@umut-sahin
Copy link
Contributor Author

I'll try it and get back to you in a week or so, I'm away from my desktop ATM.

But even if it solves the issue, that would mean I need to provide two binaries for Linux distribution which is not ideal.

@Friz64
Copy link
Contributor

Friz64 commented Jul 28, 2024

That's not how that works. You can have both features enabled. Bevy will prefer Wayland but seamlessly fall back to X11 as needed.

@umut-sahin
Copy link
Contributor Author

Oh, okay I'll try and let you know then.

Btw, why isn't it enabled by default then?

@Friz64
Copy link
Contributor

Friz64 commented Jul 29, 2024

Because there has historically always been some kind of problem on Wayland affecting a portion of users. Sometimes it's our fault (gfx-rs/wgpu#5505), sometimes not (gfx-rs/wgpu#4775). On the other hand though, there have also been issues that were solved by turning the Wayland feature on (maybe yours is one of those), so it's hard to say.

I will personally try to push for Wayland-By-Default once gfx-rs/wgpu#5505 gets resolved. Hopefully nothing else "major" crops up until then.

@umut-sahin
Copy link
Contributor Author

Enabling wayland feature just changed the error:

2024-08-08T08:55:42.974400Z ERROR wgpu_hal::vulkan::instance: GENERAL [Loader Message (0x0)]
	setup_loader_term_phys_devs:  Failed to detect any valid GPUs in the current config    
2024-08-08T08:55:42.974410Z ERROR wgpu_hal::vulkan::instance: 	objects: (type: INSTANCE, hndl: 0x5aba20682820, name: ?)    
2024-08-08T08:55:42.974414Z ERROR wgpu_hal::vulkan::instance: enumerate_adapters: Initialization of an object has failed    
2024-08-08T08:55:42.975153Z  INFO bevy_render::renderer: AdapterInfo { name: "NV172", vendor: 65541, device: 0, device_type: Other, driver: "OpenGL", driver_info: "4.3 (Compatibility Profile) Mesa 24.1.5-arch1.1", backend: Gl }
2024-08-08T08:55:43.025122Z  WARN bevy_pbr::ssao: ScreenSpaceAmbientOcclusionPlugin not loaded. GPU lacks support: TextureFormat::R16Float does not support TextureUsages::STORAGE_BINDING.
2024-08-08T08:55:43.025265Z  INFO bevy_winit::system: Creating new window "Mythmallow" (Entity { index: 0, generation: 1 })
2024-08-08T08:55:43.070426Z ERROR wgpu_hal::gles::egl: EGL 'eglMakeCurrent' code 0x3008: eglMakeCurrent    
thread 'Compute Task Pool (11)' panicked at /home/default/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-hal-0.21.1/src/gles/egl.rs:296:14:
called `Result::unwrap()` on an `Err` value: BadDisplay
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_render::view::window::create_surfaces`!
2024-08-08T08:55:43.070666Z ERROR wgpu_hal::gles::egl: EGL 'eglMakeCurrent' code 0x3008: eglMakeCurrent    
thread 'Compute Task Pool (11)' panicked at /home/default/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-hal-0.21.1/src/gles/egl.rs:296:14:
called `Result::unwrap()` on an `Err` value: BadDisplay
Encountered a panic in system `bevy_render::render_asset::prepare_assets<bevy_render::texture::image::GpuImage>`!
2024-08-08T08:55:43.070723Z ERROR wgpu_hal::gles::egl: EGL 'eglMakeCurrent' code 0x3008: eglMakeCurrent    
thread 'Compute Task Pool (11)' panicked at /home/default/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-hal-0.21.1/src/gles/egl.rs:296:14:
called `Result::unwrap()` on an `Err` value: BadDisplay
Encountered a panic in system `bevy_render::render_asset::prepare_assets<bevy_sprite::mesh2d::material::PreparedMaterial2d<bevy_sprite::mesh2d::color_material::ColorMaterial>>`!
2024-08-08T08:55:43.070801Z ERROR wgpu_hal::gles::egl: EGL 'eglMakeCurrent' code 0x3008: eglMakeCurrent    
thread 'main' panicked at /home/default/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-hal-0.21.1/src/gles/egl.rs:296:14:
called `Result::unwrap()` on an `Err` value: BadDisplay
Encountered a panic in system `bevy_render::render_asset::prepare_assets<bevy_pbr::material::PreparedMaterial<bevy_pbr::pbr_material::StandardMaterial>>`!
2024-08-08T08:55:43.071019Z ERROR wgpu_hal::gles::egl: EGL 'eglMakeCurrent' code 0x3008: eglMakeCurrent    
thread 'Compute Task Pool (9)' panicked at /home/default/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-hal-0.21.1/src/gles/egl.rs:296:14:
called `Result::unwrap()` on an `Err` value: BadDisplay
Encountered a panic in system `bevy_render::globals::prepare_globals_buffer`!
2024-08-08T08:55:43.071082Z ERROR wgpu_hal::gles::egl: EGL 'eglMakeCurrent' code 0x3008: eglMakeCurrent    
thread 'Compute Task Pool (10)' panicked at /home/default/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-hal-0.21.1/src/gles/egl.rs:296:14:
called `Result::unwrap()` on an `Err` value: BadDisplay
Encountered a panic in system `bevy_pbr::render::skin::prepare_skins`!
2024-08-08T08:55:43.071225Z ERROR wgpu_hal::gles::egl: EGL 'eglMakeCurrent' code 0x3008: eglMakeCurrent    
thread 'Compute Task Pool (10)' panicked at /home/default/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-hal-0.21.1/src/gles/egl.rs:296:14:
called `Result::unwrap()` on an `Err` value: BadDisplay
Encountered a panic in system `bevy_render::view::visibility::range::write_render_visibility_ranges`!
2024-08-08T08:55:43.071298Z ERROR wgpu_hal::gles::egl: EGL 'eglMakeCurrent' code 0x3008: eglMakeCurrent    
thread 'Compute Task Pool (7)' panicked at /home/default/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-hal-0.21.1/src/gles/egl.rs:296:14:
called `Result::unwrap()` on an `Err` value: BadDisplay
Encountered a panic in system `bevy_sprite::render::prepare_sprite_image_bind_groups`!
2024-08-08T08:55:43.071459Z ERROR wgpu_hal::gles::egl: EGL 'eglMakeCurrent' code 0x3008: eglMakeCurrent    
thread '<unnamed>' panicked at /home/default/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-hal-0.21.1/src/gles/egl.rs:296:14:
called `Result::unwrap()` on an `Err` value: BadDisplay
Encountered a panic in system `bevy_render::renderer::render_system`!

@Friz64
Copy link
Contributor

Friz64 commented Aug 8, 2024

Ohh you don't have a Vulkan driver. Native Wayland is currently broken on OpenGL (as linked in my previous comment). You might want to install NVK given you're not using the proprietary drivers?

@umut-sahin
Copy link
Contributor Author

Installing the driver fixed the issue 🥳

Though if there is a way to improve the error messages, they should be improved IMO. Like detecting OpenGL is being tried to be used in Wayland and logging an error saying it's not supported.

Thanks!

@VitalyAnkh VitalyAnkh removed the S-Needs-Investigation This issue requires detective work to figure out what's going wrong label Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior C-Startup A crash that occurs when first attempting to run a Bevy app O-Linux Specific to the Linux desktop operating system O-Vulkan Specific to the Vulkan render API P-Crash A sudden unexpected crash
Projects
None yet
Development

No branches or pull requests

4 participants