GPU: read single-plane depth textures into guest buffers #3004
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3006"
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 andrewpozdnakov7-jpg on 2026-11-26T03:15:22Z.
The guest CopyTextureRegion readback path discards copies from any depth resource. Allow whole, single-sampled D16 and D32 subresources with a compatible single-plane footprint. The depth case checks the source subresource, the destination origin and the whole-subresource rule before recording the copy. It uses the existing pitched row transfer into the guest buffer. CopyTextureRegion requirements
Verification
AI-assisted with Codex.
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T03:24:50Z.
Review: APPROVED
Code review on
7a11b213(static source inspection; no runtime GPU execution):crates/victory-gpu/src/list.rs:846-869cleanly opens single-plane depth readbacks (R32family39andR16family53) for whole single-sampled subresources with matching family,box = None,at = [0, 0, 0], and valid subresource index, with unit coverage acrossD32_FLOAT,R32_TYPELESS,D16_UNORM, andR16_TYPELESS.list.rs:843,read_backchecksdst.footprint.row_pitch.is_multiple_of(256)but does not check thatrow_pitchis at least the unpadded row width (e.g. a 65×2D32_FLOATfootprint withRowPitch = 256<260bytes would still be forwarded toCopyTextureRegion). Fine to keep scoped here or tighten in a follow-up alongside color readbacks.Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-26T03:28:34Z.
Independent RTX 5080 and Windows built-in WARP readback on
7a11b21: 12,024/12,024 depth texels matched on each adapter, alongside the original clipped RGBA8 and depth cases. The new fixture uses D32_FLOAT, R32_TYPELESS, D16_UNORM and R16_TYPELESS. Each resource has two array slices and three mips (131×9, 65×4, 32×2).I filled each mip/slice with two distinct native DSV clears, then read all six through the guest command list in reverse order. Destination footprints begin at separate aligned offsets, have 256 extra bytes of row pitch, and end exactly after the final row's payload. All pitch and alignment padding retained its sentinel. On parent
63bcca4, all four depth formats failed the new check on both adapters. As a sensitivity check, deliberately taking each mip from the first array slice failed at subresource 3 (slice 1, mip 0) in all four formats on both adapters.The test-only commit
18fce85applies on your PR. Runcargo test --locked -p victory-gpu --features diagnostics --lib depth_mips_and_array_slices -- --nocapture, and repeat withVICTORY_D3D12_WARP=1for the software pass. Both adapters ran withVICTORY_D3D12_DEBUG=1.Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T04:40:25Z.
Review: APPROVED
LGTM — single-plane depth readback gated correctly: only families 39|53 (R32/R16 depth), same family required on the dst footprint, whole single-sampled subresource only (no offset, no box, index < mips*array). Test matrix covers RGBA8 + the four depth formats.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T06:16:17Z.
Automated triage for the maintainers.
Thanks, the test is now tidy. In
crates/victory-gpu/src/resource.rsthe branch diff only adds a separate depth test, and the RGBA8 test is untouched. Thelist.rs::read_backchecks are unchanged and still look consistent with the D3D12 copy rules.As you say, the main point is still open. In
main, refusing to read back a depth texture is a deliberate shortcut until a title is seen doing it. Lifting it needs evidence that GTA VI reads a depth texture back into a buffer, for example the "texture to buffer copy refused: a depth or stencil texture" warning firing in a diagnostics run. It also needs confirmation that the console's layout for these formats matches the host's single-plane rows on this path. With that, this would be a good candidate.CI: passing.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T06:41:01Z.
Commit 34c28df restores the existing RGBA8 test verbatim and adds a separate synthetic test for D16 and D32, including their typeless counterparts. In the full branch diff,
resource.rsnow only adds the depth test.With that fixture on
63bcca43, all four destination buffers stay untouched. The same fixture with the fix returns the exact depth texels and preserves every padding byte. The original RGBA8 test passes. App-local WARP GPU suite 247 passed and 1 ignored. Strict GPU Clippy passed in both modes, and asset policy passed.The evidence here is for the synthetic guest copy and the host D3D12 layout. The requested title usage and console layout confirmation are still open.
Please retain the Git author when moving the test. If it is folded into another commit, please add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.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.