fix(agc): copy depth planes whose detiled rows are padded to the swizzle block #4722
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4722"
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 boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-12T19:45:27Z.
What
DepthPlaneCopy(from #425, now onmain) refuses any depth plane whose linear layout was not tightly packed:geometry.sliceLinearBytes == sliceBytes(), wheresliceBytes()is width × height × texel size.Kena: Bridge of Spirits (PPSA01802) samples its point-light shadow maps as 128x128 D16 cubes, through an R16 view in a 64 KiB Z swizzle. That block holds 256x128 texels of 16 bits, so the detiled row is 512 bytes and a face is 64 KiB, while the copy assumed 256-byte rows and 32 KiB faces:
Every shadow projection draw that bound one was skipped, about 4,400 per 4-minute run. The scene was then lit as if no point light cast a shadow, and the image came out white or heavily overexposed.
LinearLayerOffsetplus the first mip's pitch × height. It's reallocated, if the constructor's packed size is too small, only before the copy is first recorded; a later, larger layout is still refused.record, which only copies the layers that changed) usesLinearLayerOffset(layer)plus the mip'slinearOffset, withbufferRowLength= pitch / texel size andbufferImageHeight= the mip's height. This now applies to both the slices copied from a live depth surface and the ones the detiler writes from guest memory, which already landed atLinearLayerOffset.Tested
Arch Linux, KDE Plasma, GCC, Release, RADV (RX 9070 XT, Mesa 26.2.4), on
main0214069e3(rebased onto main's reworkedDepthPlaneCopywith kept guest layers).PaddedCubeCaseinagc_driver_depth_plane_sampling: a 128x128 D16 cube read through a depth-bits R16_UINT T# in the 64 KiB Z swizzle. Face 0 comes from the live surface and faces 1-5 from guest memory, and each face reads its value. Without this commit it fails withdepth plane copy geometry does not match its layers. The existing array/cube, integer, depth-bits array and first-slice cases still pass.ctest -R '^agc_|^shader': 486/487. The one failure,agc_driver_tessellation(SEGFAULT), fails the same way on unmodifiedmain0214069e3on this machine. Allagc_driver_depth*tests andagc_driver_graphicspass.tools/check_conventions.pypasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-13T18:00:41Z.
Cross-reference: #4873 implements the same padded depth-plane copy (same
LinearLayerOffset/bufferRowLengthregion mechanism) against the older inline path. Since this PR already matchesmain'srecord()refactor and carries the Kena motivating case, it looks like the more current of the two — flagging the duplication so the maintainers can choose once rather than review twice. (This PR still shows needs-rebase for staleness; I can rebase it on request.)Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-14T05:25:12Z.
@oneandonlydean #4873 now carries this fix. Since its rebase it sits in
record()and uses the same per-layerLinearLayerOffsetand paddedbufferRowLength. It keeps this PR's Kena (PPSA01802) 128x128 D16 cube test, adds the 32x32 case from PPSA29343, and grows the staging buffer for larger layouts, so it covers everything this PR does. I'm fine with #4873 going in instead, and I'll close this one when it merges. Thanks @GustavoGamarra95 for keeping the Kena case.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T18:15:48Z.
Closing in favour of #4873, which is now on main and carries this fix (per-layer
LinearLayerOffsetwith the paddedbufferRowLength) together with your Kena (PPSA01802) 128x128 D16 cube test, as you suggested. Thanks for the original fix.Pull request closed