GPU: read D24S8 and D32S8 planes into guest buffers #3022
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3022
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3022"
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?
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 03:35 UTC · original
andrewpozdnakov7-jpg:codex2/planar-depth-readback→main· +202 −11 · 2 files · 2 commits · openGuest
CopyTextureRegiondiscards reads from D24S8 and D32S8. The device already gives the guest distinct footprints for the depth and stencil planes. This change uses the same footprint mapping to copy a whole single-sampled plane at the selected mip and array slice, then transfers its rows to the guest buffer without overwriting padding.The same synthetic guest test clears mip 1 of array slice 1 in four D24S8/D32S8 typed and typeless guest descriptions. It tracks the native clears in DEPTH_WRITE, checks depth 0.25 and 0.75 plus stencil 0x37 and 0x91, and copies subresources 3 and 7 to separate offsets with 512-byte pitch. Native inbox and Agility WARP report 16 bytes per depth row and 4 bytes per stencil row. The guest test checks both rows of both planes and the entire surrounding sentinel buffer.
63bcca4with the fixtureApp-local WARP GPU tests: 247 passed, one ignored. The focused test passed with the D3D12 debug flag. Strict GPU Clippy with and without diagnostics and the repository asset policy passed.
#3006 handles single-plane D16/D32. Both PRs replace the old depth guard. A local combination of the original commits passed 247 tests and one ignore, including both readback fixtures. #2509 handles CPU-to-GPU stencil staging. Direct3D 12 CopyTextureRegion · Coordination claim
AI-assisted with Codex. Synthetic textures only.
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 03:40 UTC · original
c28e6b6 corrects the test setup. It registers DEPTH_WRITE before the native clears so the list prelude leaves the clears in the right state and the following copy records its transition to COPY_SOURCE. The original fixture did not register the clear. The test now checks distinct left and right depth values as well as distinct stencil values in every row.
With the same corrected fixture,
63bcca4leaves the guest buffer untouched in all four cases. This revision matches the native values and preserves every padding byte. App-local WARP with the D3D12 debug flag passed 247 tests with one ignored. Both strict GPU Clippy runs and asset policy passed.@steven-seagull27 on GitHub · 2026-11-26 03:58 UTC · original
@andrewpozdnakov7-jpg The corrected fixture at
c28e6b6passed on my RTX 5080 (621.40) and Windows built-in WARP (10.0.26100.10068), with the D3D12 debug layer enabled. I also compared the guest copies with nativeCopyTextureRegionreadbacks on the same adapter.Each D24S8 and D32S8 resource (typed and typeless) had two array slices and three mips, sized 131×9, 65×4 and 32×2. Each mip/slice got two distinct native depth and stencil clears. The guest read both planes in reverse subresource order. I checked the native values against those clears, then compared the entire guest buffer, including 512 extra bytes of row pitch, gaps between footprints, and the final row ending exactly at the buffer boundary.
On the direct parent
63bcca4, all 12,024 depth and all 12,024 stencil texels per adapter missed the native reference. As a sensitivity check on the PR, selecting the other valid array slice at the same mip and plane also produced 12,024 mismatches per plane on each adapter.The optional test-only commit extends your corrected fixture directly on
c28e6b6. The filtered test is stilldepth_and_stencil_planes_reach_the_guest_buffer. Strict GPU Clippy and the asset policy passed. Synthetic textures only. AI-assisted with Codex.@pickles976 on GitHub · 2026-11-26 03:59 UTC · original
Independent hardware check on exact clean head
c28e6b63b09d1ebcf5ca9f42082b463484cce725, RTX 4060 Laptop GPU (8 GiB), 16 GiB RAM, Wine 11.0 / vkd3d-proton 3.2.0 / DXVK 3.1.1, Windows-MSVCvictory-gputest build:resource::tests::depth_and_stencil_planes_reach_the_guest_buffer1/1 PASS (0.79 s). DXVK logsFound device: NVIDIA GeForce RTX 4060 Laptop GPU; vkd3d creates the hardware D3D12 device and the test runs, rather than thehost() == Noneskip path. Fixture checks the D24S8 and D32S8 typed and typeless cases, both mip-1/slice-1 plane rows, left/right depth/stencil and the 4096-byte destination sentinel including row padding.Run was in a 9 GiB cgroup scope, 512 MiB swap cap, global available-RAM floor 2 GiB, GPU-used ceiling 6 GiB, disk floor 10 GiB; no safety stop. Local log:
.compat-runtime/logs/verify-pr3022-wine-rtx4060-planar-depth.log.This is a synthetic GPU copy-readback result on the NVIDIA Wine path, not a GTA title load or 30 FPS gameplay result; title loading still reaches the system-RAM safety floor. No objections from this focused hardware fixture.
@Marvisak on GitHub · 2026-11-26 06:18 UTC · original
Automated triage for the maintainers.
read_backincrates/victory-gpu/src/list.rsused to refuse every depth-stencil source. It now copies D24S8/D32S8 (typed and typeless) planes when the copy is one whole single-sampled subresource (no box, destination at the origin) and the guest's footprint format matches that plane. The plane is taken from the subresource index asindex / (mips * slices), the D3D12 planar layout.planar_depth_copy_formatinresource.rskeeps the R32_TYPELESS / R8_TYPELESS mapping thatsubresourcealready used, so guest footprints do not change. These limits match D3D12's ownCopyTextureRegionrules for depth-stencil copies. The Windows test reads both planes of mip 1, slice 1 and checks every byte of the target buffer, padding included. Contributors report it passing on WARP and NVIDIA with the debug layer. CIcheck: passing.For the maintainer: the comment this replaces said depth readback stays refused "until a title is seen reading one back", and the PR names no title that does. It also overlaps #3006 (single-plane D16/D32), which replaces the same guard, so whichever merges second will need a small rebase.
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.