wgpu: wgpu examples don't work under Wayland when using OpenGL backend
Description As title. They work under X11. This occurred both pre- and post- wgpu-hal.
Repro steps
WGPU_BACKEND=gl cargo run --example cube
Observed behavior wgpu master, on Wayland:
[treeco@treeco-ms7b86 wgpu]$ WGPU_BACKEND=gl cargo run --example cube
Finished dev [unoptimized + debuginfo] target(s) in 0.05s
Running `target/debug/examples/cube`
[2021-08-10T18:50:34Z ERROR wgpu_hal::gles::egl] EGL 'eglCreatePlatformWindowSurface' code 0x3009: Unsupported surfacetype/colorspace configuration
Using AMD Radeon (TM) R5 340 (OLAND, DRM 3.41.0, 5.13.8-1-MANJARO, LLVM 12.0.1) (Gl)
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', wgpu-core/src/hub.rs:1037:29
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
wgpu master, on X11:
[treeco@treeco-ms7b86 wgpu]$ WGPU_BACKEND=gl cargo run --example cube
Finished dev [unoptimized + debuginfo] target(s) in 0.06s
Running `target/debug/examples/cube`
Using AMD Radeon (TM) R5 340 (OLAND, DRM 3.41.0, 5.13.8-1-MANJARO, LLVM 12.0.1) (Gl)
Avg frame time 16.510405ms
Avg frame time 16.676777ms
wgpu v0.9 branch, on Wayland:
[treeco@treeco-ms7b86 wgpu]$ WGPU_BACKEND=gl cargo run --example cube
Finished dev [unoptimized + debuginfo] target(s) in 0.06s
Running `target/debug/examples/cube`
Using AMD Radeon (TM) R5 340 (OLAND, DRM 3.41.0, 5.13.8-1-MANJARO, LLVM 12.0.1) (Gl)
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', wgpu-core/src/hub.rs:878:29
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Platform Manjaro Linux, Plasma desktop environment, R5 340 GPU
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 19 (13 by maintainers)
For what it’s worth, neither OpenGL or Vulkan work for Nvidia on Wayland (with the latest drivers that have improved Wayland support), but I think that’s an issue on Nvidia’s side… See also the issue on glutin. I’m not sure if it’s worth opening an issue for that on wgpu as it likely can’t be fixed easily here. On the other hand, there are OpenGL applications using EGL that run fine on Wayland with Nvidia, so maybe it could be investigated after all. As for Vulkan, wgpu simply reports that the surface capabilities are empty.
Firefox runs completely fine on Wayland with Nvidia since 91 though, including Webrender and WebGL.
Edit: with
nvidia
package version 470.63.01-2, the wgpu Vulkan backend works on Wayland 🎊@kvark Thanks! Since NVidia seems to be more friendly about Wayland, I will try reporting this and see if something good will happen…
I can confirm that for nouveau it’s fixed, there is something wrong with resize events but that’s probably unrelated I will check winit for that. The rendering itself runs really well
The wayland fix is included in wgpu-hal-0.11.3
Our presentation is different, but that could be a good starting point. As I’m setting up a new system, I may be able to investigate in the upcoming month. But if you can start looking into this yourself, it would be most welcome.