GPU: select the readable format and plane for depth/stencil shader views #651

Open
github-bot wants to merge 1 commit from github-bot/gh-651 into main AGit
Owner

@⁠Raxstreams on GitHub · 2026-11-24 06:13 UTC · original
Raxstreams:codex/depth-stencil-srv-plane → main · +119 −6 · 1 files · 1 commits · open

VIctory creates typeless host textures so a title can use the same surface for depth testing and shader reads. The descriptor path on main copies the title's plane index and accepts a depth-stencil view format as long as it belongs to the resource's DXGI family. That can pass a DSV-only format to CreateShaderResourceView, or request stencil with plane zero on a two-plane host texture.

Select the readable depth or stencil format when building the host SRV. Texture2D and Texture2DArray use plane zero for depth and plane one for stencil. The test includes the console stencil format that maps to X24_TYPELESS_G8_UINT and checks that the mip and array ranges survive the conversion.

I isolated this change while tracing a black world frame. In a separate integration run with the diagnostic lighting pass disabled, the HDR scene and bloom inputs were already black when the title's composite sampled them. The effect of this change alone on the game image is unverified. Related work in #485 covers resource states for simultaneous shader and depth reads.

Verification

  • On the previous descriptor path the regression test returned format 20 (D32_FLOAT_S8X24_UINT) where the shader requires format 21 (R32_FLOAT_X8X24_TYPELESS).
  • On Windows, with VICTORY_D3D12_DEBUG=1, cargo test --locked --offline -p victory-gpu --features diagnostics -- --test-threads=1 passed 46 tests with one ignored. The new test inspects the generated host descriptors.
  • cargo xtask policy --staged passed for the single source file.

AI-assisted contribution using Codex.

**@⁠Raxstreams** on GitHub · 2026-11-24 06:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/651) `Raxstreams:codex/depth-stencil-srv-plane` → `main` · +119 −6 · 1 files · 1 commits · open VIctory creates typeless host textures so a title can use the same surface for depth testing and shader reads. The descriptor path on main copies the title's plane index and accepts a depth-stencil view format as long as it belongs to the resource's DXGI family. That can pass a DSV-only format to CreateShaderResourceView, or request stencil with plane zero on a two-plane host texture. Select the readable depth or stencil format when building the host SRV. Texture2D and Texture2DArray use plane zero for depth and plane one for stencil. The test includes the console stencil format that maps to X24_TYPELESS_G8_UINT and checks that the mip and array ranges survive the conversion. I isolated this change while tracing a black world frame. In a separate integration run with the diagnostic lighting pass disabled, the HDR scene and bloom inputs were already black when the title's composite sampled them. The effect of this change alone on the game image is unverified. Related work in #485 covers resource states for simultaneous shader and depth reads. ### Verification - On the previous descriptor path the regression test returned format 20 (D32_FLOAT_S8X24_UINT) where the shader requires format 21 (R32_FLOAT_X8X24_TYPELESS). - On Windows, with VICTORY_D3D12_DEBUG=1, `cargo test --locked --offline -p victory-gpu --features diagnostics -- --test-threads=1` passed 46 tests with one ignored. The new test inspects the generated host descriptors. - `cargo xtask policy --staged` passed for the single source file. AI-assisted contribution using Codex.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:11:36 +00:00
Author
Owner

@⁠erLCoder on GitHub · 2026-11-24 13:10 UTC · original

Depth/stencil descriptor fixture on Windows 10 22H2 build 19045.6466, GTX 1660 Ti, NVIDIA 581.42, Ryzen 5 3600, Rust 1.98.1 MSVC and Agility SDK 1.620.2. Parent d2a4bae, PR d615ee0.

cargo test --offline --locked -p victory-gpu --features diagnostics --lib depth_srv_uses_the_requested_aspect -- --nocapture --test-threads=1 — 1 passed, 0 failed, 0 ignored, 46 filtered out. This is a CPU test of selected DXGI format and plane for 2D and array descriptors. GPU depth sampling, resource transitions and image effect remain untested. Applying this revision to my separate Turing runtime stack requires conflict resolution in descriptor/host.rs.

Codex prepared the worktree, ran the test and drafted this report.

**@⁠erLCoder** on GitHub · 2026-11-24 13:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/651#issuecomment-7132454200) Depth/stencil descriptor fixture on Windows 10 22H2 build 19045.6466, GTX 1660 Ti, NVIDIA 581.42, Ryzen 5 3600, Rust 1.98.1 MSVC and Agility SDK 1.620.2. Parent d2a4bae, PR d615ee0. `cargo test --offline --locked -p victory-gpu --features diagnostics --lib depth_srv_uses_the_requested_aspect -- --nocapture --test-threads=1` — 1 passed, 0 failed, 0 ignored, 46 filtered out. This is a CPU test of selected DXGI format and plane for 2D and array descriptors. GPU depth sampling, resource transitions and image effect remain untested. Applying this revision to my separate Turing runtime stack requires conflict resolution in descriptor/host.rs. Codex prepared the worktree, ran the test and drafted this report.
Author
Owner

@⁠konradbeck on GitHub · 2026-11-24 13:54 UTC · original

Independent GPU readback on an NVIDIA RTX A4500 (driver 32.0.16.2124, Windows 11 build 26300.9974).

  • main tested at ffe310eb2098e52169f4c44db5ffdabf43a72622
  • PR head tested at d615ee0fe0f90750320575e2501726486a0454ca

I cleared synthetic 2×2 depth/stencil patterns, sampled both aspects in a compute shader, and copied the results back to the CPU. The PR matched native D3D12 exactly for both corrected view requests.

Texture Depth readback Stencil readback
D32S8 Texture2D 4/4 (0.125, 0.375, 0.625, 0.875) 4/4 (5, 17, 42, 213)
D24S8 Texture2DArray, mip 1, slice 1 4/4 (0.12500001, 0.37500003, 0.625, 0.875) 4/4 (5, 17, 42, 213)

On main, the native and valid VIctory controls also matched. For the inputs this PR fixes, the test guard recorded a DSV-only format on depth plane 1 and a stencil SRV on plane 0, then blocked those descriptors before dispatch. The D3D12 debug layer was unavailable for these runs. The PR’s existing depth_srv_uses_the_requested_aspect test also passed.

AI-assisted test fixture and write-up.

**@⁠konradbeck** on GitHub · 2026-11-24 13:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/651#issuecomment-7133520870) Independent GPU readback on an **NVIDIA RTX A4500** (driver `32.0.16.2124`, Windows 11 build `26300.9974`). - `main` tested at `ffe310eb2098e52169f4c44db5ffdabf43a72622` - PR head tested at `d615ee0fe0f90750320575e2501726486a0454ca` I cleared synthetic 2×2 depth/stencil patterns, sampled both aspects in a compute shader, and copied the results back to the CPU. The PR matched native D3D12 exactly for both corrected view requests. | Texture | Depth readback | Stencil readback | | --- | --- | --- | | D32S8 `Texture2D` | 4/4 (`0.125`, `0.375`, `0.625`, `0.875`) | 4/4 (`5`, `17`, `42`, `213`) | | D24S8 `Texture2DArray`, mip 1, slice 1 | 4/4 (`0.12500001`, `0.37500003`, `0.625`, `0.875`) | 4/4 (`5`, `17`, `42`, `213`) | On `main`, the native and valid VIctory controls also matched. For the inputs this PR fixes, the test guard recorded a DSV-only format on depth plane 1 and a stencil SRV on plane 0, then blocked those descriptors before dispatch. **The D3D12 debug layer was unavailable** for these runs. The PR’s existing `depth_srv_uses_the_requested_aspect` test also passed. AI-assisted test fixture and write-up.
Author
Owner

@⁠molodayamama on GitHub · 2026-11-24 14:04 UTC · original

Independent Windows check of d615ee0fe0f90750320575e2501726486a0454ca (Windows 10 22H2 19045, Rust 1.98.1, MSVC x64).

  • cargo test -p victory-gpu --locked --lib depth_srv_uses_the_requested_aspect -- --test-threads=1 --nocapture: 1 passed.

The synthetic descriptor fixture checks that SRV descriptions preserve the requested readable aspect on depth/stencil textures. This was a descriptor-construction check without GPU sampling.

Only source-built synthetic fixtures were used. AI-assisted verification.

**@⁠molodayamama** on GitHub · 2026-11-24 14:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/651#issuecomment-7133802338) Independent Windows check of `d615ee0fe0f90750320575e2501726486a0454ca` (Windows 10 22H2 19045, Rust 1.98.1, MSVC x64). - `cargo test -p victory-gpu --locked --lib depth_srv_uses_the_requested_aspect -- --test-threads=1 --nocapture`: 1 passed. The synthetic descriptor fixture checks that SRV descriptions preserve the requested readable aspect on depth/stencil textures. This was a descriptor-construction check without GPU sampling. Only source-built synthetic fixtures were used. AI-assisted verification.
Author
Owner

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

Automated triage for the maintainers.

Needs rebase. This PR does not merge cleanly into current main (ac2525d). Conflicting files: crates/victory-gpu/src/descriptor/host.rs.

The content has not been reviewed yet; it will be once the branch is rebased onto main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/651#issuecomment-7148611458) <!-- victory-triage v1 head=d615ee0fe0f90750320575e2501726486a0454ca verdict=needs-rebase at=2026-11-25T00:13:20Z --> Automated triage for the maintainers. **Needs rebase.** This PR does not merge cleanly into current `main` (ac2525d). Conflicting files: `crates/victory-gpu/src/descriptor/host.rs`. The content has not been reviewed yet; it will be once the branch is rebased onto `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/descriptor/host.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-651'
git switch 'github-bot/gh-651'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-651'
git switch 'github-bot/gh-651'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-651'
git switch 'main'
git merge --squash 'github-bot/gh-651'
git switch 'main'
git merge --ff-only 'github-bot/gh-651'
git switch 'main'
git merge 'github-bot/gh-651'
git push origin 'main'
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!651
No description provided.