CI: clippy clean and the depth bounds test on WARP, so main's checks can pass #169

Open
github-bot wants to merge 2 commits from github-bot/gh-169 into main AGit
Owner

@⁠amine23012004 on GitHub · 2026-11-26 09:52 UTC · original
amine23012004:ci/depth-bounds-on-warp → main · +7 −4 · 2 files · 2 commits · open

What and why

CI has failed on every push to main since the repository started (12 runs, 0a43566 to 9576c45), so no pull request here can show a green check. Two causes, one commit each:

  1. Clippy (-D warnings) stops at crates/victory-loader/src/descriptor_sites.rs:277: clippy::missing_transmute_annotations on the test's two transmutes. Now transmute::<usize, F>, the same conversion. (#158 carries the same line among its other changes.)
  2. pipeline::host::tests::depth_bounds_pipeline_loads_and_filters_draws fails in both test jobs: depth 0.5 outside [0.6, 1.0] must be rejected, got 255. The runners have no GPU, so the host is WARP, and WARP passes every fragment when the depth test is off, whatever the bounds. The test now turns the depth test on with ALWAYS and no writes. That still always passes, so the bounds are still the only thing that can reject the draw, and WARP applies them. The runtime is unchanged.

Tested

  • In my fork, with exactly this branch: Clippy, Default tests and Diagnostics tests all pass (https://github.com/amine23012004/VIctory-7900XTX/pull/2). depth_bounds_pipeline_loads_and_filters_draws ... ok, with no "skipped" line, so it drew on WARP.
  • Before the test change, the same test on main fails in both jobs on the runners. That is how the WARP behaviour was found; it was not seen on a real GPU.
  • Not run on a real GPU.

AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

**@⁠amine23012004** on GitHub · 2026-11-26 09:52 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/169) `amine23012004:ci/depth-bounds-on-warp` → `main` · +7 −4 · 2 files · 2 commits · open ### What and why CI has failed on every push to `main` since the repository started (12 runs, `0a43566` to `9576c45`), so no pull request here can show a green check. Two causes, one commit each: 1. **Clippy** (`-D warnings`) stops at `crates/victory-loader/src/descriptor_sites.rs:277`: `clippy::missing_transmute_annotations` on the test's two `transmute`s. Now `transmute::<usize, F>`, the same conversion. (#158 carries the same line among its other changes.) 2. **`pipeline::host::tests::depth_bounds_pipeline_loads_and_filters_draws`** fails in both test jobs: `depth 0.5 outside [0.6, 1.0] must be rejected`, got 255. The runners have no GPU, so the host is WARP, and WARP passes every fragment when the depth test is off, whatever the bounds. The test now turns the depth test on with `ALWAYS` and no writes. That still always passes, so the bounds are still the only thing that can reject the draw, and WARP applies them. The runtime is unchanged. ### Tested - In my fork, with exactly this branch: **Clippy, Default tests and Diagnostics tests all pass** (https://github.com/amine23012004/VIctory-7900XTX/pull/2). `depth_bounds_pipeline_loads_and_filters_draws ... ok`, with no "skipped" line, so it drew on WARP. - Before the test change, the same test on `main` fails in both jobs on the runners. That is how the WARP behaviour was found; it was not seen on a real GPU. - Not run on a real GPU. AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
`cargo clippy --workspace --all-targets -- -D warnings` stops at
`descriptor_sites.rs:277` (clippy::missing_transmute_annotations), so the
Clippy job has failed on every push to main. Same transmute, types named.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 11:21:39 +00:00
Author
Owner

@⁠amine23012004 on GitHub · 2026-11-26 12:13 UTC · original

Still needed after #140: on current main (a9400a6, run) the only CI failures left are the two this PR fixes:

  • Clippy: crates/victory-loader/src/descriptor_sites.rs:277, transmute used without annotations (both transmutes).
  • Both test jobs: pipeline::host::tests::depth_bounds_pipeline_loads_and_filters_draws on WARP.

The branch still merges cleanly into a9400a6, so with it main should go green.

**@⁠amine23012004** on GitHub · 2026-11-26 12:13 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/169#issuecomment-7191728736) Still needed after #140: on current main (`a9400a6`, [run](https://github.com/avatarmanz/VIctory-7900XTX/actions/runs/45813925169)) the only CI failures left are the two this PR fixes: - Clippy: `crates/victory-loader/src/descriptor_sites.rs:277`, `transmute used without annotations` (both transmutes). - Both test jobs: `pipeline::host::tests::depth_bounds_pipeline_loads_and_filters_draws` on WARP. The branch still merges cleanly into `a9400a6`, so with it main should go green.
Author
Owner

@⁠Anzymanz on GitHub · 2026-11-26 14:08 UTC · original

Tested on real hardware, since the PR notes it wasn't:

  • GPU: AMD RX 9070 XT (RDNA4), Linux, RADV, vkd3d-proton under Wine (GE-Proton11-14).
  • Branch: this PR's two commits on top of main at c9c932cb.
  • Before the change (depth test off): depth_bounds_pipeline_loads_and_filters_draws ... ok on this card. That fits the WARP explanation: the card applies the bounds even with the depth test off, so the failure in CI is WARP's.
  • With this PR (depth test on, ALWAYS, no writes): ok in 3 of 3 runs, and no "skipped" line, so the draws ran and the bounds rejected and passed as the test expects.

So the change keeps the test meaningful on a card while letting WARP pass. I'd prefer it to skipping the test on WARP, which was my first fix, now dropped in favour of this one.

AI-assisted: yes (Claude Code)

**@⁠Anzymanz** on GitHub · 2026-11-26 14:08 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/169#issuecomment-7194344166) Tested on real hardware, since the PR notes it wasn't: - **GPU:** AMD RX 9070 XT (RDNA4), Linux, RADV, vkd3d-proton under Wine (GE-Proton11-14). - **Branch:** this PR's two commits on top of `main` at c9c932cb. - **Before the change** (depth test off): `depth_bounds_pipeline_loads_and_filters_draws ... ok` on this card. That fits the WARP explanation: the card applies the bounds even with the depth test off, so the failure in CI is WARP's. - **With this PR** (depth test on, `ALWAYS`, no writes): `ok` in 3 of 3 runs, and no "skipped" line, so the draws ran and the bounds rejected and passed as the test expects. So the change keeps the test meaningful on a card while letting WARP pass. I'd prefer it to skipping the test on WARP, which was my first fix, now dropped in favour of this one. AI-assisted: yes (Claude Code)
Author
Owner

@⁠lerapeurdu62280-debug on GitHub · 2026-11-26 14:16 UTC · original · approved these changes

Read the diff. Turning the depth test on with ALWAYS and no writes keeps depth bounds as the only thing that can reject the draw, so the test still checks what it claims, and it now passes on WARP. Together with #241 this should turn main green, which every other open PR is waiting on.

**@⁠lerapeurdu62280-debug** on GitHub · 2026-11-26 14:16 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/169#pullrequestreview-6075635328) · **approved these changes** Read the diff. Turning the depth test on with ALWAYS and no writes keeps depth bounds as the only thing that can reject the draw, so the test still checks what it claims, and it now passes on WARP. Together with #241 this should turn main green, which every other open PR is waiting on.
Author
Owner

@⁠illuminatedfellow on GitHub · 2026-11-26 16:27 UTC · original · edited 2026-11-26 19:09 UTC

Checked against main's latest CI run (#176 on c9c932c). It fails on exactly three things:

  • Clippy: transmute used without annotations at descriptor_sites.rs:277 — fixed here (dbbd3b1).
  • Clippy: the function open doesn't need a mutable reference at watch.rs:3626 — not fixed here. #241 (still open) has the one-line fix (open(&title_memory_changed(at, len), ..), open takes &Guards).
  • Tests: depth_bounds_pipeline_loads_and_filters_draws panics on WARP (host.rs:1464) — fixed here (6242ea0). The test binds a DSV cleared to 0.5, so turning the depth test on with ALWAYS and writes off changes nothing on hardware and lets WARP apply the bounds.

Both commits apply cleanly to c9c932c. So this PR plus #241 turn main's CI green. Reviewed by reading and against the CI logs; not built locally.

Edit: I first wrote that #241 was closed; I misread its status, it is open.

**@⁠illuminatedfellow** on GitHub · 2026-11-26 16:27 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/169#issuecomment-7197678646) · edited 2026-11-26 19:09 UTC Checked against `main`'s latest CI run (#176 on c9c932c). It fails on exactly three things: - Clippy: `transmute used without annotations` at `descriptor_sites.rs:277` — fixed here (dbbd3b1). - Clippy: `the function open doesn't need a mutable reference` at `watch.rs:3626` — **not** fixed here. #241 (still open) has the one-line fix (`open(&title_memory_changed(at, len), ..)`, `open` takes `&Guards`). - Tests: `depth_bounds_pipeline_loads_and_filters_draws` panics on WARP (`host.rs:1464`) — fixed here (6242ea0). The test binds a DSV cleared to 0.5, so turning the depth test on with `ALWAYS` and writes off changes nothing on hardware and lets WARP apply the bounds. Both commits apply cleanly to c9c932c. So this PR plus #241 turn `main`'s CI green. Reviewed by reading and against the CI logs; not built locally. Edit: I first wrote that #241 was closed; I misread its status, it is open.
Author
Owner

@⁠JoeY54 on GitHub · 2026-11-27 10:38 UTC · original

Supplemental independent Windows / RTX 5090 and WARP evidence supporting this PR's test configuration. This was investigated on upstream main 014d52dedf as incorporated unchanged into my fork baseline 06edc349c8aaaa13c6dc235257e81cd743f7d04c; I did not run this PR's exact head.

Windows 11 Pro 26300.9974, Rust 1.98.1 MSVC:

  • RTX 5090, NVIDIA driver 621.24 (10de:2b85).
  • WARP 10.0.26100.9818 (1414:008c, software adapter flag 2).

The comparison exercised both freshly created and pipeline-library-loaded PSOs, each with direct OMSetDepthBounds and State::replay:

Adapter DepthEnable=false DepthEnable=true, ALWAYS, writes ZERO
WARP All four paths incorrectly retained 255 for the rejecting [0.6,1.0] interval All four reject with 0 and pass with 255
RTX 5090 All four reject/pass correctly All four reject/pass correctly

Stored depth was 0.5. The PSO flag and library load were preserved; direct/replay behaved identically. This supports the adapter/configuration explanation rather than a replay or pipeline-library bug. The old CI logs we inspected did not print an adapter identifier, so this local reproduction alone is not proof of that runner's adapter identity.

I also expanded the regression while keeping its original rejection, acceptance and library-load assertions:

  • Actually draw with both the created and returned library-loaded PSO.
  • Test direct bounds calls and replay separately.
  • Set vertex depth to 0.25 while stored depth stays 0.5; [0,0.3] must reject.
  • Check inclusive [0.5,0.5] bounds.
  • Print adapter identity on failure.

That is 16 draw assertions. The revised WARP test passed, and the combined fork patch passed default/all-features workspace tests on the Windows CI run. Local RTX workspace GPU tests passed in both configurations. The full report, including local default-suite launch-denial/retry and skip caveats, is here.

The test-only diff below is offered for adoption here, not as a competing PR. It is against main 014d52d and includes your same DepthEnable adjustment, so retain your existing configuration hunk when incorporating the additional coverage. It comes from my tested commit e383e94aea42bc62535ced1536370be411595dd3; no runtime changes or test skips.

Microsoft's specification defines bounds in terms of stored depth but does not establish ordinary DepthEnable=true as a requirement. The observed WARP DepthEnable=false behavior remains a separate compatibility limitation.

AI-assisted: OpenAI Codex. Original synthetic fixtures only.

Test-only patch against 014d52d

diff --git a/crates/victory-gpu/src/pipeline/host.rs b/crates/victory-gpu/src/pipeline/host.rs
index 5150479..5f26df3 100644
--- a/crates/victory-gpu/src/pipeline/host.rs
+++ b/crates/victory-gpu/src/pipeline/host.rs
@@ -1068,6 +1068,7 @@ fn root_signature(
 
 #[cfg(test)]
 mod tests {
+    use windows::core::Interface;
     use std::path::{Path, PathBuf};
     use std::sync::atomic::Ordering;
 
@@ -1210,7 +1211,7 @@ mod tests {
 
     const VS: &str = "float4 main(uint i : SV_VertexID) : SV_Position {
         float2 p = float2((i << 1) & 2, i & 2);
-        return float4(p * 2.0 - 1.0, 0.5, 1.0);
+        return float4(p * 2.0 - 1.0, 0.25, 1.0);
     }";
 
     /// A graphics pipeline with `DepthBoundsTestEnable` loads back from the
@@ -1221,6 +1222,24 @@ mod tests {
         let Some(host) = host() else {
             return;
         };
+        // Keep adapter evidence in failed CI output; the hosted runner and
+        // local hardware need not choose the same D3D12 implementation.
+        // SAFETY: queries on the live host device's adapter.
+        unsafe {
+            let factory: windows::Win32::Graphics::Dxgi::IDXGIFactory4 =
+                windows::Win32::Graphics::Dxgi::CreateDXGIFactory2(
+                    windows::Win32::Graphics::Dxgi::DXGI_CREATE_FACTORY_FLAGS(0),
+                )
+                .unwrap();
+            let adapter: windows::Win32::Graphics::Dxgi::IDXGIAdapter1 =
+                factory.EnumAdapterByLuid(host.device.GetAdapterLuid()).unwrap();
+            let desc = adapter.GetDesc1().unwrap();
+            eprintln!(
+                "depth bounds adapter: {} vendor={:#06x} device={:#06x} flags={:#x} driver={:#x}",
+                String::from_utf16_lossy(&desc.Description).trim_end_matches('\0'),
+                desc.VendorId, desc.DeviceId, desc.Flags, host.driver(),
+            );
+        }
         if !host.depth_bounds() {
             eprintln!("no host depth bounds support; skipped");
             return;
@@ -1236,13 +1255,15 @@ mod tests {
 
         let mut g = GraphicsState::default();
         // Subobject 21 (`DEPTH_STENCIL1`) with `DepthBoundsTestEnable = true`,
-        // depth test itself off so only depth bounds gates the draw.
+        // Keep depth reads enabled: WARP does not apply depth bounds with
+        // DepthEnable=false. ALWAYS with writes disabled makes ordinary
+        // depth testing inert, so only depth bounds can reject the draw.
         #[repr(C, align(8))]
         struct Sub21(u32, D3D12_DEPTH_STENCIL_DESC1);
         let sub = Sub21(
             21,
             D3D12_DEPTH_STENCIL_DESC1 {
-                DepthEnable: false.into(),
+                DepthEnable: true.into(),
                 DepthWriteMask: D3D12_DEPTH_WRITE_MASK_ZERO,
                 DepthFunc: D3D12_COMPARISON_FUNC_ALWAYS,
                 DepthBoundsTestEnable: true.into(),
@@ -1284,14 +1305,14 @@ mod tests {
         let pso = graphics_depth_bounds_pipeline(&host.device, &root, &desc, g.depth1(), &name)
             .expect("depth-bounds PSO made");
         let loaded = super::super::library::LOADED.load(Ordering::Relaxed);
-        graphics_depth_bounds_pipeline(&host.device, &root, &desc, g.depth1(), &name)
+        let loaded_pso = graphics_depth_bounds_pipeline(&host.device, &root, &desc, g.depth1(), &name)
             .expect("depth-bounds PSO made again");
         assert!(
             super::super::library::LOADED.load(Ordering::Relaxed) > loaded,
             "the depth-bounds pipeline was compiled again instead of loaded from the library"
         );
 
-        // Execute two draws against a depth buffer cleared to 0.5:
+        // Draw against stored depth 0.5, distinct from vertex depth 0.25:
         // 1) bounds [0.6, 1.0] -> rejected (target stays 0)
         // 2) bounds [0.4, 0.6] replayed onto a fresh HostList -> passes (target becomes 255)
         let make_tex = |format, flags, state, clear: D3D12_CLEAR_VALUE| {
@@ -1380,14 +1401,20 @@ mod tests {
             out.unwrap()
         };
 
-        let run_draw = |min: f32, max: f32| -> u8 {
+        let run_draw = |pso: &ID3D12PipelineState, replay: bool, min: f32, max: f32| -> u8 {
             let mut state = crate::draw::State::default();
             let first_list = host.new_list().unwrap();
             state.set_depth_bounds(&first_list, min, max);
             first_list.close();
             // Replay onto a second host list, exercising `State::replay`.
             let list = host.new_list().unwrap();
-            state.replay(&list);
+            if replay {
+                state.replay(&list);
+            } else {
+                let l1 = list.list.cast::<ID3D12GraphicsCommandList1>().unwrap();
+                // SAFETY: an open command list on a supporting device.
+                unsafe { l1.OMSetDepthBounds(min, max) };
+            }
             let rtv = host.rtv(Some(&color), None);
             let dsv = host.dsv(&depth, None);
             let vp = D3D12_VIEWPORT {
@@ -1412,7 +1439,7 @@ mod tests {
                 list.list.RSSetViewports(&[vp]);
                 list.list.RSSetScissorRects(&[rect]);
                 list.list.SetGraphicsRootSignature(&root);
-                list.list.SetPipelineState(&pso);
+                list.list.SetPipelineState(pso);
                 list.list
                     .IASetPrimitiveTopology(windows::Win32::Graphics::Direct3D::D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
                 list.list.DrawInstanced(3, 1, 0, 0);
@@ -1461,8 +1488,15 @@ mod tests {
             }
         };
 
-        assert_eq!(run_draw(0.6, 1.0), 0, "depth 0.5 outside [0.6, 1.0] must be rejected");
-        assert_eq!(run_draw(0.4, 0.6), 255, "depth 0.5 inside [0.4, 0.6] must pass");
+        for (kind, pipeline) in [("created", &pso), ("library-loaded", &loaded_pso)] {
+            for replay in [false, true] {
+                eprintln!("depth bounds PSO={kind} replay={replay}");
+                assert_eq!(run_draw(pipeline, replay, 0.6, 1.0), 0, "depth 0.5 outside [0.6, 1.0] must be rejected");
+                assert_eq!(run_draw(pipeline, replay, 0.4, 0.6), 255, "depth 0.5 inside [0.4, 0.6] must pass");
+                assert_eq!(run_draw(pipeline, replay, 0.0, 0.3), 0, "bounds use stored depth, not vertex depth 0.25");
+                assert_eq!(run_draw(pipeline, replay, 0.5, 0.5), 255, "depth bounds are inclusive");
+            }
+        }
     }
 
     fn element(format: DXGI_FORMAT, offset: u32) -> D3D12_INPUT_ELEMENT_DESC {
**@⁠JoeY54** on GitHub · 2026-11-27 10:38 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/169#issuecomment-7216130126) Supplemental independent Windows / RTX 5090 and WARP evidence supporting this PR's test configuration. This was investigated on upstream main 014d52dedf837d1ac660a0bd256c4704be9eeb40 as incorporated unchanged into my fork baseline 06edc349c8aaaa13c6dc235257e81cd743f7d04c; **I did not run this PR's exact head**. Windows 11 Pro 26300.9974, Rust 1.98.1 MSVC: - RTX 5090, NVIDIA driver 621.24 (10de:2b85). - WARP 10.0.26100.9818 (1414:008c, software adapter flag 2). The comparison exercised both freshly created and pipeline-library-loaded PSOs, each with direct OMSetDepthBounds and State::replay: | Adapter | DepthEnable=false | DepthEnable=true, ALWAYS, writes ZERO | |---|---|---| | WARP | All four paths incorrectly retained 255 for the rejecting [0.6,1.0] interval | All four reject with 0 and pass with 255 | | RTX 5090 | All four reject/pass correctly | All four reject/pass correctly | Stored depth was 0.5. The PSO flag and library load were preserved; direct/replay behaved identically. This supports the adapter/configuration explanation rather than a replay or pipeline-library bug. The old CI logs we inspected did not print an adapter identifier, so this local reproduction alone is not proof of that runner's adapter identity. I also expanded the regression while keeping its original rejection, acceptance and library-load assertions: - Actually draw with both the created and returned library-loaded PSO. - Test direct bounds calls and replay separately. - Set vertex depth to 0.25 while stored depth stays 0.5; [0,0.3] must reject. - Check inclusive [0.5,0.5] bounds. - Print adapter identity on failure. That is 16 draw assertions. The revised WARP test passed, and the combined fork patch passed default/all-features workspace tests on the [Windows CI run](https://github.com/JoeY54/VIctory-5090/actions/runs/45981380699). Local RTX workspace GPU tests passed in both configurations. The full report, including local default-suite launch-denial/retry and skip caveats, is [here](https://github.com/JoeY54/VIctory-5090/blob/bf3263e2dafb948f037693c0198beb5ade4555ad/docs/5090/CI-DEPTH-BOUNDS.md). The test-only diff below is offered for adoption here, not as a competing PR. It is against main 014d52d and includes your same DepthEnable adjustment, so retain your existing configuration hunk when incorporating the additional coverage. It comes from my tested commit e383e94aea42bc62535ced1536370be411595dd3; no runtime changes or test skips. Microsoft's [specification](https://microsoft.github.io/DirectX-Specs/d3d/DepthBoundsTest.html) defines bounds in terms of stored depth but does not establish ordinary DepthEnable=true as a requirement. The observed WARP DepthEnable=false behavior remains a separate compatibility limitation. AI-assisted: OpenAI Codex. Original synthetic fixtures only. <details> <summary>Test-only patch against 014d52d</summary> ```diff diff --git a/crates/victory-gpu/src/pipeline/host.rs b/crates/victory-gpu/src/pipeline/host.rs index 5150479..5f26df3 100644 --- a/crates/victory-gpu/src/pipeline/host.rs +++ b/crates/victory-gpu/src/pipeline/host.rs @@ -1068,6 +1068,7 @@ fn root_signature( #[cfg(test)] mod tests { + use windows::core::Interface; use std::path::{Path, PathBuf}; use std::sync::atomic::Ordering; @@ -1210,7 +1211,7 @@ mod tests { const VS: &str = "float4 main(uint i : SV_VertexID) : SV_Position { float2 p = float2((i << 1) & 2, i & 2); - return float4(p * 2.0 - 1.0, 0.5, 1.0); + return float4(p * 2.0 - 1.0, 0.25, 1.0); }"; /// A graphics pipeline with `DepthBoundsTestEnable` loads back from the @@ -1221,6 +1222,24 @@ mod tests { let Some(host) = host() else { return; }; + // Keep adapter evidence in failed CI output; the hosted runner and + // local hardware need not choose the same D3D12 implementation. + // SAFETY: queries on the live host device's adapter. + unsafe { + let factory: windows::Win32::Graphics::Dxgi::IDXGIFactory4 = + windows::Win32::Graphics::Dxgi::CreateDXGIFactory2( + windows::Win32::Graphics::Dxgi::DXGI_CREATE_FACTORY_FLAGS(0), + ) + .unwrap(); + let adapter: windows::Win32::Graphics::Dxgi::IDXGIAdapter1 = + factory.EnumAdapterByLuid(host.device.GetAdapterLuid()).unwrap(); + let desc = adapter.GetDesc1().unwrap(); + eprintln!( + "depth bounds adapter: {} vendor={:#06x} device={:#06x} flags={:#x} driver={:#x}", + String::from_utf16_lossy(&desc.Description).trim_end_matches('\0'), + desc.VendorId, desc.DeviceId, desc.Flags, host.driver(), + ); + } if !host.depth_bounds() { eprintln!("no host depth bounds support; skipped"); return; @@ -1236,13 +1255,15 @@ mod tests { let mut g = GraphicsState::default(); // Subobject 21 (`DEPTH_STENCIL1`) with `DepthBoundsTestEnable = true`, - // depth test itself off so only depth bounds gates the draw. + // Keep depth reads enabled: WARP does not apply depth bounds with + // DepthEnable=false. ALWAYS with writes disabled makes ordinary + // depth testing inert, so only depth bounds can reject the draw. #[repr(C, align(8))] struct Sub21(u32, D3D12_DEPTH_STENCIL_DESC1); let sub = Sub21( 21, D3D12_DEPTH_STENCIL_DESC1 { - DepthEnable: false.into(), + DepthEnable: true.into(), DepthWriteMask: D3D12_DEPTH_WRITE_MASK_ZERO, DepthFunc: D3D12_COMPARISON_FUNC_ALWAYS, DepthBoundsTestEnable: true.into(), @@ -1284,14 +1305,14 @@ mod tests { let pso = graphics_depth_bounds_pipeline(&host.device, &root, &desc, g.depth1(), &name) .expect("depth-bounds PSO made"); let loaded = super::super::library::LOADED.load(Ordering::Relaxed); - graphics_depth_bounds_pipeline(&host.device, &root, &desc, g.depth1(), &name) + let loaded_pso = graphics_depth_bounds_pipeline(&host.device, &root, &desc, g.depth1(), &name) .expect("depth-bounds PSO made again"); assert!( super::super::library::LOADED.load(Ordering::Relaxed) > loaded, "the depth-bounds pipeline was compiled again instead of loaded from the library" ); - // Execute two draws against a depth buffer cleared to 0.5: + // Draw against stored depth 0.5, distinct from vertex depth 0.25: // 1) bounds [0.6, 1.0] -> rejected (target stays 0) // 2) bounds [0.4, 0.6] replayed onto a fresh HostList -> passes (target becomes 255) let make_tex = |format, flags, state, clear: D3D12_CLEAR_VALUE| { @@ -1380,14 +1401,20 @@ mod tests { out.unwrap() }; - let run_draw = |min: f32, max: f32| -> u8 { + let run_draw = |pso: &ID3D12PipelineState, replay: bool, min: f32, max: f32| -> u8 { let mut state = crate::draw::State::default(); let first_list = host.new_list().unwrap(); state.set_depth_bounds(&first_list, min, max); first_list.close(); // Replay onto a second host list, exercising `State::replay`. let list = host.new_list().unwrap(); - state.replay(&list); + if replay { + state.replay(&list); + } else { + let l1 = list.list.cast::<ID3D12GraphicsCommandList1>().unwrap(); + // SAFETY: an open command list on a supporting device. + unsafe { l1.OMSetDepthBounds(min, max) }; + } let rtv = host.rtv(Some(&color), None); let dsv = host.dsv(&depth, None); let vp = D3D12_VIEWPORT { @@ -1412,7 +1439,7 @@ mod tests { list.list.RSSetViewports(&[vp]); list.list.RSSetScissorRects(&[rect]); list.list.SetGraphicsRootSignature(&root); - list.list.SetPipelineState(&pso); + list.list.SetPipelineState(pso); list.list .IASetPrimitiveTopology(windows::Win32::Graphics::Direct3D::D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); list.list.DrawInstanced(3, 1, 0, 0); @@ -1461,8 +1488,15 @@ mod tests { } }; - assert_eq!(run_draw(0.6, 1.0), 0, "depth 0.5 outside [0.6, 1.0] must be rejected"); - assert_eq!(run_draw(0.4, 0.6), 255, "depth 0.5 inside [0.4, 0.6] must pass"); + for (kind, pipeline) in [("created", &pso), ("library-loaded", &loaded_pso)] { + for replay in [false, true] { + eprintln!("depth bounds PSO={kind} replay={replay}"); + assert_eq!(run_draw(pipeline, replay, 0.6, 1.0), 0, "depth 0.5 outside [0.6, 1.0] must be rejected"); + assert_eq!(run_draw(pipeline, replay, 0.4, 0.6), 255, "depth 0.5 inside [0.4, 0.6] must pass"); + assert_eq!(run_draw(pipeline, replay, 0.0, 0.3), 0, "bounds use stored depth, not vertex depth 0.25"); + assert_eq!(run_draw(pipeline, replay, 0.5, 0.5), 255, "depth bounds are inclusive"); + } + } } fn element(format: DXGI_FORMAT, offset: u32) -> D3D12_INPUT_ELEMENT_DESC { ``` </details>
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/169/head:github-bot/gh-169'
git switch 'github-bot/gh-169'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-169'
git switch 'github-bot/gh-169'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-169'
git switch 'github-bot/gh-169'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-169'
git switch 'main'
git merge --squash 'github-bot/gh-169'
git switch 'main'
git merge --ff-only 'github-bot/gh-169'
git switch 'main'
git merge 'github-bot/gh-169'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.