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