GPU: select the readable format and plane for depth/stencil shader views #651
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/651"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by Raxstreams on 2026-11-24T06:13:52Z.
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
cargo test --locked --offline -p victory-gpu --features diagnostics -- --test-threads=1passed 46 tests with one ignored. The new test inspects the generated host descriptors.cargo xtask policy --stagedpassed for the single source file.AI-assisted contribution using Codex.
Imported from Marvisak/VIctory. Originally posted by LAKSHYA-cmd-tech on 2026-11-24T06:21:40Z.
Review: APPROVED
Tested on Windows 11 with Rust 1.98.1 (x86_64-pc-windows-msvc).
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T11:03:26Z.
Review: APPROVED
Tested
d615ee0on Windows 11, RTX 5070, MSVC:cargo test -p victory-gpu -- --test-threads=144 passed, includingdepth_srv_uses_the_requested_aspect. Clippy's 1 warning is the existingundocumented_unsafe_blocksin host.rs.ALLOW_DEPTH_STENCILare rewritten. The requested format is then mapped to the readable aspect:DXGI_FORMAT_UNKNOWN, the typeless format and the DSV format all become the depth SRV format on plane 0, and the stencil SRV format goes to plane 1. Anything else is left alone, sofitsstill rejects it. That is the D3D12 rule for two-plane depth formats.Texture2DandTexture2DArray, including the console stencil and depth codes.TEXTURECUBE,TEXTURE2DMSand the other dimensions get the format fix but no plane assignment. That's fine for depth (plane 0 is implicit), but a stencil SRV on a cube or MS view still requests plane 0 as before. Worth a comment, or a refusal, if a title ever does that.AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by erLCoder on 2026-11-24T13:10:30Z.
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, PRd615ee0.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.
Imported from Marvisak/VIctory. Originally posted by konradbeck on 2026-11-24T13:54:41Z.
Independent GPU readback on an NVIDIA RTX A4500 (driver
32.0.16.2124, Windows 11 build26300.9974).maintested atffe310eb2098e52169f4c44db5ffdabf43a72622d615ee0fe0f90750320575e2501726486a0454caI 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.
Texture2D0.125,0.375,0.625,0.875)5,17,42,213)Texture2DArray, mip 1, slice 10.12500001,0.37500003,0.625,0.875)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 existingdepth_srv_uses_the_requested_aspecttest also passed.AI-assisted test fixture and write-up.
Imported from Marvisak/VIctory. Originally posted by molodayamama on 2026-11-24T14:04:38Z.
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.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:32:22Z.
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
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.