| ... | @@ -36,9 +36,21 @@ impl Surface { | ... | @@ -36,9 +36,21 @@ impl Surface { |
| 36 | window: Arc<Window>, | 36 | window: Arc<Window>, |
| 37 | backdrop: bool, | 37 | backdrop: bool, |
| 38 | ) -> Result<(Self, Renderer), Box<dyn Error>> { | 38 | ) -> 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))] |
| 40 | let mut descriptor = | 40 | let mut descriptor = |
| 41 | wgpu::InstanceDescriptor::new_with_display_handle_from_env(Box::new(window.clone())); | 41 | 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 | } |
| 42 | // Direct3D 12, which Windows 10 and 11 always have, and through DirectComposition | 54 | // Direct3D 12, which Windows 10 and 11 always have, and through DirectComposition |
| 43 | // where the backdrop shows through; elsewhere `surface_windows` draws with OpenGL. | 55 | // where the backdrop shows through; elsewhere `surface_windows` draws with OpenGL. |
| 44 | #[cfg(windows)] | 56 | #[cfg(windows)] |