authorgravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-10-01 14:10:18-07:00
committergravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-10-01 16:23:40-07:00
log0108e94dff934720a1cd09e3931f16b9a710936c
tree3b93d2b24e3747ca943783121b3c270ece7b833b
parent418e0a5f2fa864f4515f34398791511859b32201
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

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

1 files changed, 13 insertions(+), 1 deletions(-)

crates/snowbound/src/surface.rs+13-1
......@@ -36,9 +36,21 @@ impl Surface {
3636 window: Arc<Window>,
3737 backdrop: bool,
3838 ) -> Result<(Self, Renderer), Box<dyn Error>> {
39 #[cfg_attr(not(windows), expect(unused_mut))]
39 #[cfg_attr(not(any(windows, target_os = "linux")), expect(unused_mut))]
4040 let mut descriptor =
4141 wgpu::InstanceDescriptor::new_with_display_handle_from_env(Box::new(window.clone()));
42 // wgpu's OpenGL panics drawing to a Wayland window without libwayland-egl.
43 #[cfg(target_os = "linux")]
44 {
45 use winit::raw_window_handle::{HasWindowHandle, RawWindowHandle};
46 if matches!(
47 window.window_handle()?.as_raw(),
48 RawWindowHandle::Wayland(_)
49 ) && !crate::loader::loads(c"libwayland-egl.so.1")
50 {
51 descriptor.backends.remove(wgpu::Backends::GL);
52 }
53 }
4254 // Direct3D 12, which Windows 10 and 11 always have, and through DirectComposition
4355 // where the backdrop shows through; elsewhere `surface_windows` draws with OpenGL.
4456 #[cfg(windows)]