diff --git a/crates/victory-shader/src/emit/host.rs b/crates/victory-shader/src/emit/host.rs index fbeb8215ab..e2db583ab8 100644 --- a/crates/victory-shader/src/emit/host.rs +++ b/crates/victory-shader/src/emit/host.rs @@ -145,46 +145,60 @@ impl Host { /// All SM 6.6 D3D12 adapters available on the machine (hardware adapters /// unless `VICTORY_WARP=1`, followed by WARP). + /// Rejected adapters are logged so an empty list is diagnosable. #[cfg(test)] pub fn all_adapters() -> Vec<(String, Self)> { let mut out = Vec::new(); let warp_only = std::env::var("VICTORY_WARP").is_ok_and(|v| v == "1"); // SAFETY: plain DXGI/D3D12 adapter enumeration. unsafe { - if !warp_only - && let Ok(factory) = - CreateDXGIFactory2::(DXGI_CREATE_FACTORY_FLAGS(0)) - { - let mut idx = 0u32; - while let Ok(adapter) = factory.EnumAdapters1(idx) { - idx += 1; - let Ok(desc) = adapter.GetDesc1() else { - continue; - }; - if desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE.0 as u32 != 0 { - continue; - } - let mut device: Option = None; - if D3D12CreateDevice(&adapter, D3D_FEATURE_LEVEL_12_0, &mut device).is_err() { - continue; - } - let Some(device) = device else { - continue; - }; - if Self::check_sm66(&device).is_ok() { - let end = desc - .Description - .iter() - .position(|&c| c == 0) - .unwrap_or(desc.Description.len()); - let name = String::from_utf16_lossy(&desc.Description[..end]); - out.push((name, Host { device })); + if !warp_only { + match CreateDXGIFactory2::(DXGI_CREATE_FACTORY_FLAGS(0)) { + Ok(factory) => { + let mut idx = 0u32; + while let Ok(adapter) = factory.EnumAdapters1(idx) { + idx += 1; + let Ok(desc) = adapter.GetDesc1() else { + eprintln!("[wave64_tests] adapter {idx} skipped: GetDesc1 failed"); + continue; + }; + let end = desc + .Description + .iter() + .position(|&c| c == 0) + .unwrap_or(desc.Description.len()); + let name = String::from_utf16_lossy(&desc.Description[..end]); + if desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE.0 as u32 != 0 { + eprintln!("[wave64_tests] adapter {name:?} skipped: software adapter"); + continue; + } + let mut device: Option = None; + if let Err(e) = + D3D12CreateDevice(&adapter, D3D_FEATURE_LEVEL_12_0, &mut device) + { + eprintln!( + "[wave64_tests] adapter {name:?} skipped: D3D12CreateDevice: {e:?}" + ); + continue; + } + let Some(device) = device else { + eprintln!("[wave64_tests] adapter {name:?} skipped: no device"); + continue; + }; + if let Err(e) = Self::check_sm66(&device) { + eprintln!("[wave64_tests] adapter {name:?} skipped: {e}"); + continue; + } + out.push((name, Host { device })); + } } + Err(e) => eprintln!("[wave64_tests] CreateDXGIFactory2 failed: {e:?}"), } } } - if let Ok(warp) = Self::new(true) { - out.push(("WARP".to_string(), warp)); + match Self::new(true) { + Ok(warp) => out.push(("WARP".to_string(), warp)), + Err(e) => eprintln!("[wave64_tests] WARP skipped: {e}"), } out } diff --git a/crates/victory-shader/src/emit/wave64_tests.rs b/crates/victory-shader/src/emit/wave64_tests.rs index 5f24b0cf7a..420f7398e5 100644 --- a/crates/victory-shader/src/emit/wave64_tests.rs +++ b/crates/victory-shader/src/emit/wave64_tests.rs @@ -1110,13 +1110,17 @@ mod gpu { use super::*; use crate::emit::host::{Dispatch, Draw, Host, Root, View}; - fn with_hosts(f: impl FnOnce(&[(String, Host)])) { + fn with_hosts(name: &str, f: impl FnOnce(&[(String, Host)])) { static HOSTS: OnceLock>> = OnceLock::new(); let _one = super::super::valu_tests::ONE_AT_A_TIME .lock() .unwrap_or_else(|e| e.into_inner()); let lock = HOSTS.get_or_init(|| Mutex::new(Host::all_adapters())); let guard = lock.lock().unwrap_or_else(|e| e.into_inner()); + if guard.is_empty() { + eprintln!("SKIPPED {name}: no SM 6.6 adapter"); + return; + } f(&guard); } @@ -1129,8 +1133,7 @@ mod gpu { expect_native_fail: bool, run_native_when_supported: bool, ) { - with_hosts(|hosts| { - assert!(!hosts.is_empty(), "expected at least one SM 6.6 adapter"); + with_hosts(name, |hosts| { for (adapter_name, host) in hosts { let mut modes = vec![Wave64Mode::Emulate]; if host.supports_wave32() { @@ -2224,8 +2227,7 @@ mod gpu { assert_eq!(psv_wave_range(&ps), (0, u32::MAX)); assert_ne!(sfi0_flags(&ps) & 0x4000, 0); - with_hosts(|hosts| { - assert!(!hosts.is_empty(), "expected at least one SM 6.6 adapter"); + with_hosts("vs_ps_readfirstlane_host_wave_contract", |hosts| { for (adapter_name, host) in hosts { let (root, pso) = host .pipeline(&vs, &ps_pass)