Open colinmarc opened 10 months ago
I'm running the wgpu examples with eg:
RUST_LOG=info WINIT_UNIX_BACKEND=wayland WGPU_BACKEND=gl cargo run --bin wgpu-examples hello_triangle
Which results in:
2023-11-30T13:20:36Z INFO wgpu_hal::vulkan::instance] Debug utils not enabled: debug_utils_user_data not passed to Instance::from_raw
[2023-11-30T13:20:36Z INFO wgpu_hal::gles::egl] Using Wayland platform
[2023-11-30T13:20:36Z INFO wgpu_core::instance] Adapter Vulkan AdapterInfo { name: "AMD Radeon RX 6650 XT (RADV NAVI23)", vendor: 4098, device: 29679, device_type: DiscreteGpu, driver: "radv", driver_info: "Mesa 23.1.9-manjaro1.1", backend: Vulkan }
Here's with WAYLAND_DEBUG=1
fwiw, I am successfully developing a game with bevy 0.12 on sway (wayland). I have not seen this issue myself.
I use a Intel iGPU tho.
2024-01-17T09:14:03.241621Z INFO bevy_winit::system: Creating new window "bevy-game" (0v0)
2024-01-17T09:14:03.243286Z ERROR log: XDG Settings Portal did not return response in time: timeout: 100ms, key: color-scheme
2024-01-17T09:14:03.309028Z INFO bevy_render::renderer: AdapterInfo { name: "Intel(R) Graphics (RPL-S)", vendor: 32902, device: 42880, device_type: IntegratedGpu, driver: "Intel open-source Mesa driver", driver_info: "Mesa 23.3.3-arch1.1", backend: Vulkan }
Compiled and successfully ran the example from https://github.com/bevyengine/bevy/issues/10817#issue-2018653023
Hey folks. I ran into this one myself and had some additional details to add.
On my laptop I was seeing the exact same error as the op.
get_physical_device_surface_formats: ERROR_SURFACE_LOST_KHR
I tried switching to the amdvlk
driver to see if it would give me the same issue and I got a different error:
2024-02-18T10:32:39.895011Z INFO bevy_winit::system: Creating new window "2048: Two-oh-four-eight" (0v0)
2024-02-18T10:32:40.059050Z INFO bevy_render::renderer: AdapterInfo { name: "AMD Radeon Graphics", vendor: 4098, device: 5567, device
_type: IntegratedGpu, driver: "AMD open-source driver", driver_info: "2023.Q4.1 (LLPC)", backend: Vulkan }
2024-02-18T10:32:40.394415Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux 23.11 NixO
S", kernel: "6.7.4", cpu: "AMD Ryzen 7 7840U w/ Radeon 780M Graphics", core_count: "8", memory: "30.6 GiB" }
wl_surface@19: error 2: Buffer size (898x1175) is not divisible by scale (2)
This wl_surface@19: error 2: Buffer size (898x1175) is not divisible by scale (2)
struck me as interesting as my laptop does have an unusual resolution: 2256x1504
which I then scale to 1.25.
I turned my scaling back to 1.0 and the issue promptly resolved itself. I switched back to the RADV driver and it was also working at 1.0 scaling with that driver as well.
To confirm I enabled scaling at 1.25 again and the issue returned.
Not sure if this info helps but it could be an underlying issue with fractional scaling.
@colinmarc can you confirm if you were using display scaling on your machine?
Yes, I run at 2x, and given that it's a tiling WM, the resolution could definitely have been something nonstandard.
And I'm not using fractional scaling, so +1 for your finds @DewaldV . Away from home so cannot try to reproduce currently.
I wanted to see if I could reproduce the issue under different circumstances, here are some of my findings. I'm running Sway on NixOS with AMD hardware using the RADV driver.
On my laptop, at 1.25 scaling I get this error when running the code in this thread above.
Running `target/debug/latency-test`
2024-02-20T20:26:49.048851Z INFO bevy_winit::system: Creating new window "Latency Test" (0v0)
2024-02-20T20:26:49.110620Z INFO bevy_render::renderer: AdapterInfo { name: "AMD Radeon Graphics (RADV GFX1103_R1)", vendor: 4098, device: 5567, device_type: IntegratedGpu, driver: "radv", driver_info: "Mesa 23.1.9", backend: Vulkan }
2024-02-20T20:26:49.471163Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux 23.11 NixOS", kernel: "6.7.4", cpu: "AMD Ryzen 7 7840U w/ Radeon 780M Graphics", core_count: "8", memory: "30.6 GiB" }
2024-02-20T20:26:49.630205Z ERROR log: get_physical_device_surface_formats: ERROR_SURFACE_LOST_KHR
thread 'main' panicked at /home/dewaldv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.17.2/src/backend/direct.rs:771:18:
Error in Surface::configure: Validation Error
Caused by:
Requested format Bgra8UnormSrgb is not in list of supported formats: []
I think @colinmarc was on to something when he talked about "resolution being non-standard in tiling WMs". My fractional scaling setting affects it but I think it actually has more to do with the size of window that it spawns.
If I switch my container layout to tabbed and launch with cargo run
it works as expected even on 1.25 scaling. If I switch back to horizontal layout while the app is running then it keeps running fine but will crash on startup if I exit and restart with the error above. :smile:
It could also be related to AMD and the Mesa driver. We're both using AMD Cards and the RADV driver, and I see a different error with the amdvlk
driver that mentions resolution.
If I switch to the amdvlk
driver while keeping the same odd-sized window I get:
Running `target/debug/latency-test`
2024-02-20T20:40:53.636243Z INFO bevy_winit::system: Creating new window "Latency Test" (0v0)
2024-02-20T20:40:53.796185Z INFO bevy_render::renderer: AdapterInfo { name: "AMD Radeon Graphics", vendor: 4098, device: 5567, device_type: IntegratedGpu, driver: "AMD open-source driver", driver_info: "2023.Q4.1 (LLPC)", backend: Vulkan }
2024-02-20T20:40:54.131232Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux 23.11 NixOS", kernel: "6.7.4", cpu: "AMD Ryzen 7 7840U w/ Radeon 780M Graphics", core_count: "8", memory: "30.6 GiB" }
wl_surface@19: error 2: Buffer size (898x1175) is not divisible by scale (2)
warning: queue 0x55c8235215c0 destroyed while proxies still attached:
wl_registry@49 still attached
warning: queue 0x55c8235a2800 destroyed while proxies still attached:
wl_registry@52 still attached
thread 'main' panicked at /home/dewaldv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.17.2/src/backend/direct.rs:771:18:
Error in Surface::configure: Validation Error
Caused by:
Parent device is lost
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_render::view::window::prepare_windows`!
Which then shows the wl_surface@19: error 2: Buffer size (898x1175) is not divisible by scale (2)
error.
Again if I switch to a tabbed layout and run the app it launches just fine as the resolution is now even and divisible by 2.
Switching back to RADV
gets me back to this error:
ERROR log: get_physical_device_surface_formats: ERROR_SURFACE_LOST_KHR
So it looks like the actual thing causing the error is the window size but with the RADV
driver it gives an odd error while with the amdvlk
we get an error that correctly identifies the window size as the issue.
I've not dug into the code at all yet, I was just seeing what conditions cause the error to occur and whether I could launch it in different scenarios.
Hope this helps!
Bevy version: 0.21.5
I wrote a very simple app that moves a blue box around the screen. Source below. I've successfully run the app on my mac laptop.
Running on my arch/sway dev machine with
features = ["wayland"]
results in the following error:I've tested wgpu examples and they work fine.
Source