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

screenshot example crashes on Linux, Wayland with Nvidia GPU #8604

Closed
VitalyAnkh opened this issue May 12, 2023 · 4 comments · Fixed by #8701
Closed

screenshot example crashes on Linux, Wayland with Nvidia GPU #8604

VitalyAnkh opened this issue May 12, 2023 · 4 comments · Fixed by #8701
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior O-Linux Specific to the Linux desktop operating system P-Crash A sudden unexpected crash

Comments

@VitalyAnkh
Copy link
Contributor

VitalyAnkh commented May 12, 2023

Bevy version

Bevy 0.11-dev: a35ed55

System information

rustc 1.71.0-nightly (2a8221dbd 2023-05-11), Arch Linux with kernel 6.3, Gnome 44 with Wayland

Adapter Vulkan AdapterInfo { name: "NVIDIA GeForce RTX 3060 Laptop GPU", vendor: 4318, device: 9568, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "530.41.03", backend: Vulkan }    

What you did

Run Bevy's screenshot example on Wayland:

RUST_BACKTRACE=1 RUST_LOG=debug WGPU_BACKEND=vulkan cargo run --features wayland --example screenshot

What went wrong

After I pressed SPC, the app crashed.

Additional information

Full log: https://gist.github.com/VitalyAnkh/df177b789fac6b4b676864772c173a60

Line 13551 in the log shows:

    Incompatible color attachments at indices [0]: the RenderPass uses textures with formats [Some(Bgra8Unorm)] but the RenderPipeline uses attachments with formats [Some(Bgra8UnormSrgb)]
@VitalyAnkh VitalyAnkh added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels May 12, 2023
@nicopap nicopap added A-Rendering Drawing game state to the screen O-Linux Specific to the Linux desktop operating system P-Crash A sudden unexpected crash and removed S-Needs-Triage This issue needs to be labelled labels May 21, 2023
@nicopap
Copy link
Contributor

nicopap commented May 21, 2023

For precision: it works on Linux X11/AMD.

@A-Walrus
Copy link
Contributor

Not sure if this is related, or a separate issue, but all of the examples crash for me on Linux + Nvidia + Wayland, with error:

2023-05-28T04:49:21.824018Z  WARN wgpu_hal::vulkan: Unrecognized device error ERROR_INITIALIZATION_FAILED    
thread 'main' panicked at 'Error in Surface::configure: Validation Error

Caused by:
    Parent device is lost

If I don't enable the Wayland feature everything works as normal.
(tested on commit a9ca40506e3dbc5048dc38601d1e3baed6f4a172)

@VitalyAnkh
Copy link
Contributor Author

@A-Walrus Hi! I can run bevy's many examples on Linux + Nvidia + Wayland, like many_foxes:

RUST_BACKTRACE=1 RUST_LOG=info WGPU_BACKEND=vulkan cargo run --features wayland --example many_foxes
    Finished dev [unoptimized + debuginfo] target(s) in 0.29s
     Running `target/debug/examples/many_foxes`
2023-05-28T06:21:45.391962Z  INFO bevy_winit::system: Creating new window "🦊🦊🦊 Many Foxes! 🦊🦊🦊" (0v0)
2023-05-28T06:21:45.679341Z  INFO wgpu_hal::vulkan::instance: Unable to find extension: VK_EXT_swapchain_colorspace    
2023-05-28T06:21:45.720853Z  INFO wgpu_hal::vulkan::instance: Instance version: 0x4030f6    
2023-05-28T06:21:45.720884Z  INFO wgpu_hal::vulkan::instance: Enabling debug utils    
2023-05-28T06:21:45.720945Z  INFO wgpu_hal::vulkan::instance: Enabling device properties2    
2023-05-28T06:21:45.721143Z  INFO wgpu_hal::vulkan::instance: GENERAL [Loader Message (0x0)]
	linux_read_sorted_physical_devices:    
2023-05-28T06:21:45.721175Z  INFO wgpu_hal::vulkan::instance: 	objects: (type: INSTANCE, hndl: 0x559f1998abb0, name: ?)    
2023-05-28T06:21:45.721191Z  INFO wgpu_hal::vulkan::instance: GENERAL [Loader Message (0x0)]
	     Original order:    
2023-05-28T06:21:45.721196Z  INFO wgpu_hal::vulkan::instance: 	objects: (type: INSTANCE, hndl: 0x559f1998abb0, name: ?)    
2023-05-28T06:21:45.721207Z  INFO wgpu_hal::vulkan::instance: GENERAL [Loader Message (0x0)]
	           [0] NVIDIA GeForce RTX 3060 Laptop GPU
...

Bevy works well with Nvidia + Wayland on most scenarios now so your "Parent device is lost" should be another bug of Bevy or a desktop environment configuration error. Did run this example from an X11 session?

@A-Walrus
Copy link
Contributor

A-Walrus commented May 28, 2023

I'm definently on Wayland, will check if this is an issue with wgpu in general or bevy specifically and report. Thanks!

Turns out it's a known issue gfx-rs/wgpu#2519

mockersf pushed a commit that referenced this issue May 29, 2023
# Objective

Fix #8604

## Solution

Use `.add_srgb_suffix()` when creating the screenshot texture.
Allow converting `Bgra8Unorm` images.

Only a two line change for the fix, the `screenshot.rs` changes are just
a bit of cleanup.
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 O-Linux Specific to the Linux desktop operating system P-Crash A sudden unexpected crash
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants