feat(gpu): wire up depth bounds testing on command lists and pipeline streams #582

Closed
github-bot wants to merge 5 commits from gh-pr/582/head into gh-pr/582/base
Owner

@⁠matheusfrta on GitHub · 2026-11-24 05:13 UTC · original
matheusfrta:patch-1795497175 → main · +164 −32 · 5 files · 5 commits · closed without merging

i wired up OMSetDepthBounds on the command list tables and kept DepthBoundsTestEnable from D3D12_DEPTH_STENCIL_DESC1 in pipeline state streams for both mesh and graphics pipelines. it checks D3D12_FEATURE_D3D12_OPTIONS2 first so adapters without depth bounds support like WARP fall back cleanly without rejecting pipelines or command lists.

**@⁠matheusfrta** on GitHub · 2026-11-24 05:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/582) `matheusfrta:patch-1795497175` → `main` · +164 −32 · 5 files · 5 commits · closed without merging i wired up `OMSetDepthBounds` on the command list tables and kept `DepthBoundsTestEnable` from `D3D12_DEPTH_STENCIL_DESC1` in pipeline state streams for both mesh and graphics pipelines. it checks `D3D12_FEATURE_D3D12_OPTIONS2` first so adapters without depth bounds support like WARP fall back cleanly without rejecting pipelines or command lists.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:09:10 +00:00
github-bot closed this pull request 2026-11-26 04:09:10 +00:00
Author
Owner

@⁠fromthemoonx on GitHub · 2026-11-24 07:39 UTC · original

Tested 7e78c81 (on main d2a4bae) on NVIDIA, including the new stream path.

Environment: Windows 11 Pro build 26300, AMD Ryzen 7 5700X, 16 GB, NVIDIA GeForce RTX 3060 12 GB (driver 610.88), Rust 1.98.1 x86_64-pc-windows-msvc, debug.

Tested

  • cargo test --locked -p victory-gpu --lib: 43 passed, 0 failed, 1 ignored. every_inline_command_falls_back_to_the_table calls the new slot, which here reaches OMSetDepthBounds on the hardware list. The 0x220/0x230 pair is right: newer_slot moves slot 68 to 70.
  • cargo test --locked --workspace: 264 passed, 0 failed, 4 ignored
  • cargo xtask policy: 151 files ok; git diff --check: clean; clippy: only main's host.rs:267 warning
  • Support query (throwaway test, OPTIONS2): DepthBoundsTestSupported is true on the RTX 3060 and on WARP, and host().depth_bounds() returns true. So the description's "adapters without depth bounds support like WARP" doesn't hold here: WARP takes the same path as hardware. The fallback for unsupported adapters stays untested on both.
  • The new graphics_pipeline stream (throwaway test with a trivial vs_6_0/ps_6_0 pair from the SDK's dxc, root_signature(&[], &[], false) and GraphicsState::default() plus one RGBA8 target): created on the RTX 3060 with depth bounds on and a D32 depth buffer, with depth bounds off, with D24S8, and with depth bounds on and no depth buffer. So the driver accepts the stream layout and the DEPTH_STENCIL1 subobject.

Notes

  • cargo fmt --check adds new diffs over main in the five changed files: draw.rs, host.rs, list.rs and pipeline.rs lose their final newline (\ No newline at end of file in the diff), and pipeline/host.rs has five, including the long mesh_pipeline(...) call and stream lines. Running cargo fmt on those files would clear them.
  • The copy_memory change (dst as *const u8 → dst as *mut u8 passed to committed, which takes *const u8) doesn't change behavior, so it could be left out.
  • With depth bounds enabled, the graphics pipeline now goes through the stream path, so it is cached under a different call (LoadPipeline rather than LoadGraphicsPipeline). The name includes depth_bounds through describe(), so the two shouldn't collide.

Not tested: that pixels outside the bounds are actually discarded (no render-and-read-back test); title pipelines (no game data).

AI-assisted (Claude Code) ran the checks and drafted this comment.

**@⁠fromthemoonx** on GitHub · 2026-11-24 07:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/582#issuecomment-7125234743) Tested `7e78c81` (on `main` `d2a4bae`) on NVIDIA, including the new stream path. **Environment:** Windows 11 Pro build 26300, AMD Ryzen 7 5700X, 16 GB, NVIDIA GeForce RTX 3060 12 GB (driver 610.88), Rust 1.98.1 `x86_64-pc-windows-msvc`, debug. **Tested** - `cargo test --locked -p victory-gpu --lib`: 43 passed, 0 failed, 1 ignored. `every_inline_command_falls_back_to_the_table` calls the new slot, which here reaches `OMSetDepthBounds` on the hardware list. The 0x220/0x230 pair is right: `newer_slot` moves slot 68 to 70. - `cargo test --locked --workspace`: 264 passed, 0 failed, 4 ignored - `cargo xtask policy`: 151 files ok; `git diff --check`: clean; clippy: only `main`'s `host.rs:267` warning - **Support query** (throwaway test, `OPTIONS2`): `DepthBoundsTestSupported` is **true on the RTX 3060 and on WARP**, and `host().depth_bounds()` returns true. So the description's "adapters without depth bounds support like WARP" doesn't hold here: WARP takes the same path as hardware. The fallback for unsupported adapters stays untested on both. - **The new `graphics_pipeline` stream** (throwaway test with a trivial `vs_6_0`/`ps_6_0` pair from the SDK's `dxc`, `root_signature(&[], &[], false)` and `GraphicsState::default()` plus one RGBA8 target): created on the RTX 3060 with depth bounds on and a D32 depth buffer, with depth bounds off, with D24S8, and with depth bounds on and no depth buffer. So the driver accepts the stream layout and the `DEPTH_STENCIL1` subobject. **Notes** - `cargo fmt --check` adds new diffs over `main` in the five changed files: `draw.rs`, `host.rs`, `list.rs` and `pipeline.rs` lose their final newline (`\ No newline at end of file` in the diff), and `pipeline/host.rs` has five, including the long `mesh_pipeline(...)` call and stream lines. Running `cargo fmt` on those files would clear them. - The `copy_memory` change (`dst as *const u8` → `dst as *mut u8` passed to `committed`, which takes `*const u8`) doesn't change behavior, so it could be left out. - With depth bounds enabled, the graphics pipeline now goes through the stream path, so it is cached under a different call (`LoadPipeline` rather than `LoadGraphicsPipeline`). The name includes `depth_bounds` through `describe()`, so the two shouldn't collide. **Not tested:** that pixels outside the bounds are actually discarded (no render-and-read-back test); title pipelines (no game data). AI-assisted (Claude Code) ran the checks and drafted this comment.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:25 UTC · original

Automated triage for the maintainers. Closing because another open pull request covers the same change.

See #158. Same depth-bounds wiring as #158 (list slot, DEPTH_STENCIL1 flag, OPTIONS2 check) without tests.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 00:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/582#issuecomment-7148497706) Automated triage for the maintainers. Closing because another open pull request covers the same change. See #158. Same depth-bounds wiring as #158 (list slot, DEPTH_STENCIL1 flag, OPTIONS2 check) without tests. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!582
No description provided.