From 9f0a659853619fba9ed627fd7988dbe859f40041 Mon Sep 17 00:00:00 2001 From: Jay Oster Date: Fri, 14 Apr 2023 13:31:01 -0700 Subject: [PATCH] Enable all wgpu backends (#356) - This will allow `pixels` to run on platforms that have OpenGL without any extra configuration. - It is better to allow wgpu to fallback to OpenGL than to select a Vulkan software rasterizer. This is the case on WSL2, where the only hardware-based adapter is available with the GLES backend. - Fixes #354 --- src/builder.rs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/builder.rs b/src/builder.rs index 70f53f9..905c21b 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -53,17 +53,7 @@ impl<'req, 'dev, 'win, W: HasRawWindowHandle + HasRawDisplayHandle> Self { request_adapter_options: None, device_descriptor: None, - backend: wgpu::util::backend_bits_from_env().unwrap_or({ - #[cfg(not(target_arch = "wasm32"))] - { - wgpu::Backends::PRIMARY - } - - #[cfg(target_arch = "wasm32")] - { - wgpu::Backends::all() - } - }), + backend: wgpu::util::backend_bits_from_env().unwrap_or_else(wgpu::Backends::all), width, height, _pixel_aspect_ratio: 1.0, @@ -94,7 +84,7 @@ impl<'req, 'dev, 'win, W: HasRawWindowHandle + HasRawDisplayHandle> /// Set which backends wgpu will attempt to use. /// - /// The default value is `PRIMARY`, which enables the well supported backends for wgpu. + /// The default enables all backends, including the backends with "best effort" support in wgpu. pub fn wgpu_backend(mut self, backend: wgpu::Backends) -> Self { self.backend = backend; self