From 425dd7690269a1f7f2006e2c95fde69dfa225263 Mon Sep 17 00:00:00 2001 From: Akos Arinton Date: Tue, 20 Oct 2026 22:23:46 +0300 Subject: [PATCH] test(gpu): a requested backend fails the parity tests at every setup step With WGPU_BACKEND set, a device or compositor that could not be created still skipped the tests (`.ok()?`); like a missing adapter, it now fails them. Without WGPU_BACKEND the tests skip as before. Claude-Session: https://claude.ai/code/session_01Aab8aPCQgoN1sYrWPk8Kr6 --- crates/gpu/tests/parity.rs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/crates/gpu/tests/parity.rs b/crates/gpu/tests/parity.rs index a37a789485..5de36b1dfe 100644 --- a/crates/gpu/tests/parity.rs +++ b/crates/gpu/tests/parity.rs @@ -94,8 +94,15 @@ fn gpu() -> Option { return None; } }; - let (device, queue) = pollster::block_on(adapter.request_device(&wgpu::DeviceDescriptor::default())).ok()?; let info = adapter.get_info(); + let (device, queue) = match pollster::block_on(adapter.request_device(&wgpu::DeviceDescriptor::default())) { + Ok(d) => d, + Err(e) => { + assert!(!required, "WGPU_BACKEND is set but {} has no device: {e}", info.name); + eprintln!("skipping GPU parity tests: no device ({e})"); + return None; + } + }; eprintln!("GPU parity backend: {:?} ({}, {:?})", info.backend, info.name, info.device_type); // Exact parity needs 32-bit float targets. Adapters without them (e.g. GL software // rasterizers) use the CPU compositor in the app, so there is nothing to compare there. @@ -104,14 +111,16 @@ fn gpu() -> Option { eprintln!("skipping GPU parity tests: adapter can't render Rgba32Float"); return None; } - let comp = match Compositor::try_new_with_format(&device, wgpu::TextureFormat::Rgba32Float) { - Ok(c) => c, + let compositor = || match Compositor::try_new_with_format(&device, wgpu::TextureFormat::Rgba32Float) { + Ok(c) => Some(c), Err(e) => { + assert!(!required, "WGPU_BACKEND is set but {} can't build the compositor: {e}", info.name); eprintln!("skipping GPU parity tests: {e}"); - return None; + None } }; - let mut paged = Compositor::try_new_with_format(&device, wgpu::TextureFormat::Rgba32Float).ok()?; + let comp = compositor()?; + let mut paged = compositor()?; paged.set_texture_limit(PAGED_LIMIT); Some(Gpu { device, queue, comp, paged, _lock: lock }) }