From a338ff02f1867e723b0647e0e46bc8f6fabd7c18 Mon Sep 17 00:00:00 2001 From: David Truby Date: Thu, 30 Oct 2025 17:44:08 +0000 Subject: [PATCH] Fix bug accidentally requiring extra features for surface format On my system, surface_formats() has `Rgba16Unorm` as the first format in the surface_caps.formats vector that isn't SRGB. However if this format is used it requires a couple of extra WGPU features that weren't requested for the device. This specific format isn't actually required and so the features aren't required, so instead we can just skip over any formats that require features when skipping srgb ones. This results in an appropriate format being selected and gets rid of a potential wgpu crash. --- src/gfx.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gfx.rs b/src/gfx.rs index 1cfa7f5..45b7832 100644 --- a/src/gfx.rs +++ b/src/gfx.rs @@ -95,7 +95,7 @@ impl GraphicsContext { let surface_format = surface_caps .formats .iter() - .find(|f| !f.is_srgb()) + .find(|f| !f.is_srgb() && f.required_features().is_empty()) .copied() .unwrap_or(surface_caps.formats[0]);