Replay: sample depth and stencil using their copy layouts #1017
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1017"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by invismann on 2026-11-28T11:14:06Z.
replay --pixel --depthread texels using the packed depth-stencil texture's format. D3D12 copies depth and stencil as separate planes. On an R32G8X24 texture, calculating the depth offset with the packed eight-byte size sent a probe at X=1076 to the depth at X=2152. That made the trace attribute changes to draws at the wrong pixel.Use the D3D12 copy footprint of the selected subresource for the copied format, row pitch, and texel offset. The probe now reports the value of the requested texel.
Validation
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-11-28T11:46:26Z.
Review: APPROVED
Tested locally merged onto
main(63b902f).cargo xtask policypassed (294 files ok).cargo test -p victory-gpu --features diagnostics --lib replay::passed (25 passed; 0 failed, including the newreplay::play::pixel::tests::depth_probe_reads_the_copied_plane_layouttest) with 0 compiler warnings.Clean depth/stencil copy-layout sampling fix in replay pixel probing. LGTM.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by upipibi on 2026-11-28T20:23:56Z.
Tested on Ampere: RTX 3070 (
10de:2484), driver 616.56, native Windows 11 Pro 10.0.26100, rustc 1.98.1. Debug test profile,--features diagnostics. The system WARP is the one that ships with Windows.52a4c6f6f, merged onto main923e38cc8(--no-ff, clean, mergee840538). The PR's base is63b902f.crates/victory-gpu/src/replay/play/pixel.rsis the only file that changes (+55/-14). The head was still52a4c6f6fwhen I finished.replay::play::pixel::tests::depth_probe_reads_the_copied_plane_layoutVICTORY_D3D12_WARP=1), 3 runs: 1 passed, 0 failed, 0 ignored each (0.02 to 0.03 s).crate::host::host()and asks it forGetCopyableFootprints. It is compiled only withdiagnostics.Adapters seen
I added a temporary
eprintln!to the test. It resolvesdevice.GetAdapterLuid()throughEnumAdapterByLuid, printsGetDesc1, and prints the two plane footprints of the test's 2560x1440R32G8X24_TYPELESStexture. I removed it afterwards. The output was the same in all runs:10de:24840x0VICTORY_D3D12_WARP=11414:008c0x2(software)Both adapters returned the same footprints. Plane 0 is format 39 (
R32_TYPELESS) at offset 0 with a row pitch of 10240. Plane 1 is format 60 (R8_TYPELESS) at offset 14745600 with a row pitch of 2560. Both are 2560x1440x1. So the 4-byte depth and 1-byte stencil layouts the test expects come from the driver on the 3070 as well as on WARP.Negative control
The log is in
r1017-control.log.git diff --stat 923e38cc8 -- crates/:pixel.rs | 28 +(the test, plus my temporary print). It does not compile:error[E0425]: cannot find function depth_texel_offset in this scope(pixel.rs:847 and :849). The test calls the new helper.depth_texel_offsethelper put back as well, so that it builds. All thePlayerhunks are still main's (thedepth_copiesfield, the copy into scratch, theretain_mutthat setss.format).git diff --stat:pixel.rs | 29 +. 3 runs on hardware and 3 on WARP: 1 passed, 0 failed, 0 ignored each. The test passes against main's probe code.The test checks the driver's footprints and the offset arithmetic of the new helper. It does not call the code that reads the probe (
Player's copy into scratch and thespotsfilter), so it would not catch a regression there. For reference, here is main's formula for the description's case, worked out by hand and not measured. Main uses the packed format's 8 bytes, with a pitch of(2560 * 8).next_multiple_of(256) = 20480. The texel (1076, 362) then lands at362 * 20480 + 1076 * 8 = 7422368. The PR's depth-plane offset is3711184, which is half of that. That matches the X=1076 -> 2152 shift in the description.cargo test -p victory-gpu --lib --locked --features diagnostics(hardware, once each)923e38cc8: 605 passed, 0 failed, 43 ignored.923e38cc8: 604 passed, 0 failed, 43 ignored.replay::play::pixeltests passed on the merge.I also ran
cargo test -p victory-gpu --test replay --locked --features diagnosticson the merge: 1 passed, 0 failed, 0 ignored (a_frame_is_recorded_and_replayed). That test does not use the pixel probe, so it does not run the changed path either.CI
gh pr checksreports no checks on the PR's branch.Not tested
replay --pixel --depthon a real capture, the path this PR changes. No test runs it, and I had no capture to use. Only the author's GPU replay of the affected frame covers it.R32G8X24_TYPELESS(for exampleD24S8'sR24G8), mips above 0, and arrays.AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.