Skip to content

Commit

Permalink
Enable all wgpu backends (#356)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
parasyte authored Apr 14, 2023
1 parent 5465bbe commit 9f0a659
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9f0a659

Please sign in to comment.