Tests: hardware-only shader checks skip on a machine without a GPU

GitHub's Windows runner has no GPU, so the default adapter the shader
tests call "hardware" was WARP. The gather test then ran its
hardware-only rounding check on WARP, and the permute test (a wave of
32, which WARP refuses) ran on no device; both failed every CI run.

The test host now refuses a software default adapter, and the permute
test skips when only WARP is there (a refused pipeline on hardware is
an error).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
MarvisandClaude Opus 5.5 authored and Marvis committed 2026-11-25 01:43:05 +01:00
1 parent 4118f33b39
commit 42363ab6cd
2 files changed
+15 -10

No files matched your search

+14 -7
View File
@@ -64,19 +64,26 @@ fn err(e: windows::core::Error) -> String {
impl Host {
/// The default adapter, or WARP with `warp` (or `VICTORY_WARP=1`).
/// A software default adapter (a machine without a GPU, as CI) is
/// refused, so hardware-only checks never run on WARP.
pub fn new(warp: bool) -> Result<Self, String> {
let warp = warp || std::env::var("VICTORY_WARP").is_ok_and(|v| v == "1");
// SAFETY: plain D3D12/DXGI calls with valid out pointers.
unsafe {
let mut device: Option<ID3D12Device> = None;
if warp {
let factory: IDXGIFactory4 =
CreateDXGIFactory2(DXGI_CREATE_FACTORY_FLAGS(0)).map_err(err)?;
let adapter: IDXGIAdapter = factory.EnumWarpAdapter().map_err(err)?;
D3D12CreateDevice(&adapter, D3D_FEATURE_LEVEL_12_0, &mut device).map_err(err)?;
let factory: IDXGIFactory4 =
CreateDXGIFactory2(DXGI_CREATE_FACTORY_FLAGS(0)).map_err(err)?;
let adapter: IDXGIAdapter1 = if warp {
factory.EnumWarpAdapter().map_err(err)?
} else {
D3D12CreateDevice(None, D3D_FEATURE_LEVEL_12_0, &mut device).map_err(err)?;
}
let adapter = factory.EnumAdapters1(0).map_err(err)?;
if adapter.GetDesc1().map_err(err)?.Flags & DXGI_ADAPTER_FLAG_SOFTWARE.0 as u32 != 0
{
return Err("no hardware adapter".into());
}
adapter
};
D3D12CreateDevice(&adapter, D3D_FEATURE_LEVEL_12_0, &mut device).map_err(err)?;
let device = device.ok_or("no device")?;
let mut sm = D3D12_FEATURE_DATA_SHADER_MODEL {
HighestShaderModel: D3D_SHADER_MODEL_6_6,
@@ -329,7 +329,6 @@ fn permutes_read_the_lane_named_and_zero_from_lanes_left_out() {
let _one = super::valu_tests::ONE_AT_A_TIME
.lock()
.unwrap_or_else(|e| e.into_inner());
let mut ran = 0;
for (label, warp) in [("hardware", false), ("warp", true)] {
let Ok(host) = Host::new(warp) else {
eprintln!("no SM 6.6 {label} device; skipped");
@@ -337,6 +336,7 @@ fn permutes_read_the_lane_named_and_zero_from_lanes_left_out() {
};
// The program declares the console's wave of 32, which WARP refuses.
let Ok((root, pso)) = host.compute_pipeline(&shader) else {
assert!(warp, "{label}: no pipeline for a wave of 32");
eprintln!("{label}: no pipeline for a wave of 32; skipped");
continue;
};
@@ -354,9 +354,7 @@ fn permutes_read_the_lane_named_and_zero_from_lanes_left_out() {
)
.unwrap_or_else(|e| panic!("{label}: dispatch failed: {e}"));
assert_eq!(out[0], want, "{label}");
ran += 1;
}
assert!(ran > 0, "no device ran the permute");
}
#[test]