Repository navigation
GPU: copy depth twins directly instead of through a scratch - #2737
Therecalloftheonion wants to merge 1 commit into
Conversation
A depth twin copied every subresource through a scratch buffer, so a D32 twin needed a full extra texture or two. Subresources of one format family now copy straight between the depth texture and the twin; the scratch is made only for converted 16-bit planes and only when one is needed. D32 twins now exist at all: the previous exact-format check rejected them, so shader writes to D32 depth were dropped. Add a hardware test that copies a D32 depth texture into its twin, reads it back, and checks every texel and the device state. On the RX 6700 XT the copy is accepted and the texels match; WARP is not the only path exercised.
|
On
Test run and summary assisted by Codex. |
|
Good win: same-family subresources (D32's R32 plane, D24S8's pieces) now copy texture-to-texture with no scratch - a D32 twin drops a full texture of GPU memory. The scratch is only allocated when a route actually converts (at > 0), and the copy loop splits direct routes from converted ones cleanly. The 'whole subresource for depth-stencil' comment matches D3D12's restriction. |
|
Reviewed and verified Code review
Verification (Windows 11, RTX 5090 + WARP)
|
|
I ran the two branches together on a GeForce RTX 4090 Laptop GPU (driver 621.14). Merging #2173 at
Both synthetic fixtures ran with diagnostics in the same build. No game files were used. Test run and summary assisted by Codex. |
|
Automated triage for the maintainers. This PR conflicts with the current Generated by Claude Code |
What
Subresources of one format family copy straight between a depth texture and its writable twin instead of through a scratch buffer. D32 twins now exist at all: the previous exact-format check rejected them, so shader writes to D32 depth were dropped. The scratch remains for converted 16-bit planes and is created only when a route needs conversion.
Why
GPU memory: a twin otherwise allocates a full scratch buffer on top of the twin texture. A D32 twin now takes one texture instead of two, and a depth-stencil texture's stencil plane (same format family) no longer goes through the scratch.
Testing
a_d32_twin_copies_directly_and_takes_no_scratch: creates a D32 depth texture and its twin, uploads known texels, performs the real depth-to-color copy, reads it back, checks every texel, and checks the device was not removed. Passes on the RX 6700 XT.cargo test -p victory-gpu --lib: 196 passed.Not tested on NVIDIA; the direct copy relies on DXGI format-family compatibility, as the D3D12 copy rules allow.