From 0108e94dff934720a1cd09e3931f16b9a710936c Mon Sep 17 00:00:00 2001 From: clover caruso Date: Thu, 1 Oct 2026 14:10:18 -0700 Subject: [PATCH] fix: without libwayland-egl, Wayland windows draw without OpenGL instead of crashing wgpu-hal expects libwayland-egl as soon as its OpenGL backend configures a Wayland surface. Where the library is missing, Snowbound leaves OpenGL out of the instance, so Vulkan draws or the adapter request fails with an error. Assisted-by: claude-opus-5.5 --- crates/snowbound/src/surface.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/snowbound/src/surface.rs b/crates/snowbound/src/surface.rs index bdde702e1cfd4cc57457856b02460e7193cb41d5..8ea91147a806353a77e589209d03fbb35eeff3cf 100644 --- a/crates/snowbound/src/surface.rs +++ b/crates/snowbound/src/surface.rs @@ -36,9 +36,21 @@ impl Surface { window: Arc, backdrop: bool, ) -> Result<(Self, Renderer), Box> { - #[cfg_attr(not(windows), expect(unused_mut))] + #[cfg_attr(not(any(windows, target_os = "linux")), expect(unused_mut))] let mut descriptor = wgpu::InstanceDescriptor::new_with_display_handle_from_env(Box::new(window.clone())); + // wgpu's OpenGL panics drawing to a Wayland window without libwayland-egl. + #[cfg(target_os = "linux")] + { + use winit::raw_window_handle::{HasWindowHandle, RawWindowHandle}; + if matches!( + window.window_handle()?.as_raw(), + RawWindowHandle::Wayland(_) + ) && !crate::loader::loads(c"libwayland-egl.so.1") + { + descriptor.backends.remove(wgpu::Backends::GL); + } + } // Direct3D 12, which Windows 10 and 11 always have, and through DirectComposition // where the backdrop shows through; elsewhere `surface_windows` draws with OpenGL. #[cfg(windows)] -- 2.54.0