diff options
| author | Marvis <marvis@noreply.invalid> | 2026-11-25 01:42:12 +0100 |
|---|---|---|
| committer | Marvis <marvis@noreply.invalid> | 2026-11-25 01:42:12 +0100 |
| commit | 66d9dc3a3c64eae52ba112aeceacfbd1fe21cfd5 (patch) | |
| tree | bde0aa243b55b14706f6fa54d028bd5a574f5ef0 | |
| parent | 4118f33b3910f6b6b738216d6a66e8b355502b28 (diff) | |
Tests: hardware-only shader checks skip on a machine without a GPUfix/tests-without-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>
| -rw-r--r-- | crates/victory-shader/src/emit/host.rs | 21 | ||||
| -rw-r--r-- | crates/victory-shader/src/emit/synthetic_tests.rs | 4 |
2 files changed, 15 insertions, 10 deletions
diff --git a/crates/victory-shader/src/emit/host.rs b/crates/victory-shader/src/emit/host.rs index e783baa..1147c78 100644 --- a/crates/victory-shader/src/emit/host.rs +++ b/crates/victory-shader/src/emit/host.rs | |||
| @@ -64,19 +64,26 @@ fn err(e: windows::core::Error) -> String { | |||
| 64 | 64 | ||
| 65 | impl Host { | 65 | impl Host { |
| 66 | /// The default adapter, or WARP with `warp` (or `VICTORY_WARP=1`). | 66 | /// The default adapter, or WARP with `warp` (or `VICTORY_WARP=1`). |
| 67 | /// A software default adapter (a machine without a GPU, as CI) is | ||
| 68 | /// refused, so hardware-only checks never run on WARP. | ||
| 67 | pub fn new(warp: bool) -> Result<Self, String> { | 69 | pub fn new(warp: bool) -> Result<Self, String> { |
| 68 | let warp = warp || std::env::var("VICTORY_WARP").is_ok_and(|v| v == "1"); | 70 | let warp = warp || std::env::var("VICTORY_WARP").is_ok_and(|v| v == "1"); |
| 69 | // SAFETY: plain D3D12/DXGI calls with valid out pointers. | 71 | // SAFETY: plain D3D12/DXGI calls with valid out pointers. |
| 70 | unsafe { | 72 | unsafe { |
| 71 | let mut device: Option<ID3D12Device> = None; | 73 | let mut device: Option<ID3D12Device> = None; |
| 72 | if warp { | 74 | let factory: IDXGIFactory4 = |
| 73 | let factory: IDXGIFactory4 = | 75 | CreateDXGIFactory2(DXGI_CREATE_FACTORY_FLAGS(0)).map_err(err)?; |
| 74 | CreateDXGIFactory2(DXGI_CREATE_FACTORY_FLAGS(0)).map_err(err)?; | 76 | let adapter: IDXGIAdapter1 = if warp { |
| 75 | let adapter: IDXGIAdapter = factory.EnumWarpAdapter().map_err(err)?; | 77 | factory.EnumWarpAdapter().map_err(err)? |
| 76 | D3D12CreateDevice(&adapter, D3D_FEATURE_LEVEL_12_0, &mut device).map_err(err)?; | ||
| 77 | } else { | 78 | } else { |
| 78 | D3D12CreateDevice(None, D3D_FEATURE_LEVEL_12_0, &mut device).map_err(err)?; | 79 | let adapter = factory.EnumAdapters1(0).map_err(err)?; |
| 79 | } | 80 | if adapter.GetDesc1().map_err(err)?.Flags & DXGI_ADAPTER_FLAG_SOFTWARE.0 as u32 != 0 |
| 81 | { | ||
| 82 | return Err("no hardware adapter".into()); | ||
| 83 | } | ||
| 84 | adapter | ||
| 85 | }; | ||
| 86 | D3D12CreateDevice(&adapter, D3D_FEATURE_LEVEL_12_0, &mut device).map_err(err)?; | ||
| 80 | let device = device.ok_or("no device")?; | 87 | let device = device.ok_or("no device")?; |
| 81 | let mut sm = D3D12_FEATURE_DATA_SHADER_MODEL { | 88 | let mut sm = D3D12_FEATURE_DATA_SHADER_MODEL { |
| 82 | HighestShaderModel: D3D_SHADER_MODEL_6_6, | 89 | HighestShaderModel: D3D_SHADER_MODEL_6_6, |
diff --git a/crates/victory-shader/src/emit/synthetic_tests.rs b/crates/victory-shader/src/emit/synthetic_tests.rs index c2b2d34..48b92c4 100644 --- a/crates/victory-shader/src/emit/synthetic_tests.rs +++ b/crates/victory-shader/src/emit/synthetic_tests.rs | |||
| @@ -329,7 +329,6 @@ fn permutes_read_the_lane_named_and_zero_from_lanes_left_out() { | |||
| 329 | let _one = super::valu_tests::ONE_AT_A_TIME | 329 | let _one = super::valu_tests::ONE_AT_A_TIME |
| 330 | .lock() | 330 | .lock() |
| 331 | .unwrap_or_else(|e| e.into_inner()); | 331 | .unwrap_or_else(|e| e.into_inner()); |
| 332 | let mut ran = 0; | ||
| 333 | for (label, warp) in [("hardware", false), ("warp", true)] { | 332 | for (label, warp) in [("hardware", false), ("warp", true)] { |
| 334 | let Ok(host) = Host::new(warp) else { | 333 | let Ok(host) = Host::new(warp) else { |
| 335 | eprintln!("no SM 6.6 {label} device; skipped"); | 334 | eprintln!("no SM 6.6 {label} device; skipped"); |
| @@ -337,6 +336,7 @@ fn permutes_read_the_lane_named_and_zero_from_lanes_left_out() { | |||
| 337 | }; | 336 | }; |
| 338 | // The program declares the console's wave of 32, which WARP refuses. | 337 | // The program declares the console's wave of 32, which WARP refuses. |
| 339 | let Ok((root, pso)) = host.compute_pipeline(&shader) else { | 338 | let Ok((root, pso)) = host.compute_pipeline(&shader) else { |
| 339 | assert!(warp, "{label}: no pipeline for a wave of 32"); | ||
| 340 | eprintln!("{label}: no pipeline for a wave of 32; skipped"); | 340 | eprintln!("{label}: no pipeline for a wave of 32; skipped"); |
| 341 | continue; | 341 | continue; |
| 342 | }; | 342 | }; |
| @@ -354,9 +354,7 @@ fn permutes_read_the_lane_named_and_zero_from_lanes_left_out() { | |||
| 354 | ) | 354 | ) |
| 355 | .unwrap_or_else(|e| panic!("{label}: dispatch failed: {e}")); | 355 | .unwrap_or_else(|e| panic!("{label}: dispatch failed: {e}")); |
| 356 | assert_eq!(out[0], want, "{label}"); | 356 | assert_eq!(out[0], want, "{label}"); |
| 357 | ran += 1; | ||
| 358 | } | 357 | } |
| 359 | assert!(ran > 0, "no device ran the permute"); | ||
| 360 | } | 358 | } |
| 361 | 359 | ||
| 362 | #[test] | 360 | #[test] |