From 6b7f1934b1900c160ad9ce6135e4e05bc39ede64 Mon Sep 17 00:00:00 2001 From: yhamil04 <147720712+yhamil04@users.noreply.github.com> Date: Tue, 27 Oct 2026 12:39:01 +0000 Subject: [PATCH] Startup tests: start the backends the app would, no OpenGL driver on Windows (#1156) (#7217) * claim: #1156 Co-Authored-By: Claude Opus 5.5 * Startup tests: start the backends the app would, no OpenGL driver on Windows (#1156) The software-adapter test enumerated every wgpu backend and the probe test asked OpenGL on its own even where the app stops at D3D12, so both loaded the GPU vendor's OpenGL driver (atio6axx.dll on AMD) into the test process, where it once aborted the process at exit with c0000409. The adapter test now starts what the software renderer starts (D3D12 alone on Windows) and the probe test probes in the app's order, stopping at the first backend with a GPU. Co-Authored-By: Claude Opus 5.5 * Startup tests: read the software renderer's backends from wgpu_options Review: the adapter test now takes the backends from the app's own wgpu_options(true, None) instead of a copy of its choice, and the probe test no longer re-checks the order choose_backends' own test covers. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- apps/solidcraft/src/startup.rs | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/apps/solidcraft/src/startup.rs b/apps/solidcraft/src/startup.rs index 0a3c8cde8..c03de00b6 100644 --- a/apps/solidcraft/src/startup.rs +++ b/apps/solidcraft/src/startup.rs @@ -543,9 +543,16 @@ mod tests { #[test] fn probing_a_backend_alone_never_panics() { - // Whatever this machine has (often nothing): an answer, not a crash. - for b in WINDOWS_ORDER { - let _ = has_hardware_adapter(b); + // Whatever this machine has (often nothing): an answer, not a crash. On Windows the probe + // goes the way the app's does, stopping at the first backend with a GPU: a machine with + // D3D12 never loads its OpenGL driver into the test process, and AMD's (`atio6axx.dll`) + // aborted the process as it exited (#1156). + if cfg!(target_os = "windows") { + let _ = choose_backends(true, false, false, None, has_hardware_adapter); + } else { + for b in WINDOWS_ORDER { + let _ = has_hardware_adapter(b); + } } } @@ -558,8 +565,18 @@ mod tests { #[test] fn the_software_adapter_is_preferred_and_its_absence_is_an_error_not_a_panic() { assert!(pick_cpu_adapter(&[], None).unwrap_err().contains("none")); - let instance = eframe::wgpu::Instance::new(eframe::wgpu::InstanceDescriptor::new_without_display_handle()); - let adapters = pollster::block_on(instance.enumerate_adapters(eframe::wgpu::Backends::all())); + // The adapters the software renderer chooses among: it starts D3D12 alone on Windows + // (WARP), not every backend, so the test doesn't load the OpenGL driver either (#1156). + let options = crate::wgpu_options(true, None); + let eframe::egui_wgpu::WgpuSetup::CreateNew(setup) = &options.wgpu_setup else { panic!("the software renderer makes its own device") }; + let backends = setup.instance_descriptor.backends; + if cfg!(target_os = "windows") && std::env::var_os(WGPU_BACKEND_ENV).is_none() { + assert_eq!(backends, eframe::wgpu::Backends::DX12); + } + let mut desc = eframe::wgpu::InstanceDescriptor::new_without_display_handle_from_env(); + desc.backends = backends; + let instance = eframe::wgpu::Instance::new(desc); + let adapters = pollster::block_on(instance.enumerate_adapters(backends)); if adapters.is_empty() { return; }