fix(agc): keep a surface's results in the 64 KiB block it shares with its neighbour #441
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/441"
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 oneandonlydean on 2026-10-03T07:35:07Z.
What
Write stamps are kept per 64 KiB block, so a write-back of one surface stamps the whole block it shares with a surface packed right after it. A pending storage image of that neighbour read the stamp as a store over its own bytes: its write-back kept the guest bytes of the shared block in place of its results, and its next refresh re-uploaded those stale bytes.
PPSA21564's half-resolution fog texture (960x540 RGBA16F, linear) starts 0xb800 bytes before a block end, right after another 960x540 surface. It lost its first 6 rows that way, and the fog composite upsampled them into an orange band across the top 12 rows of the scene in one of its cinematics. It depended on when the deferred write-backs ran, so some runs showed it every frame and others rarely.
MarkWritten) in the blocks they cover only in part: up to four ranges per block. When a range is overwritten, the block keeps its generation, so a forgotten range still counts as a store.GuestMemory::StoredOver(address, bytes, generation)says whether a store reached that range since a generation. A CPU store, a whole-block driver store, a dropped range or an unwatched range still counts for the whole block, so the answer is never "not stored" when a store may have landed.writeBackLayers) and the refresh drop rule (Refresh) ask it only for the blocks a surface covers in part; whole blocks behave as before.Tested
BUILD_TESTING=ONandctestpass (127/127).agc_write_tracking(ctest, CPU only; skipped with code 77 when write watching is unavailable): two surfaces sharing a block at the same 0xb800 offset; a store of the first surface's bytes does not count over the second surface's part of the shared block but does over its own; a store into the second part, a whole-block store, more partial stores than the tracker keeps, and a CPU store in the block all count; a store older than the generation does not; a range the tracker does not cover always counts (checked on Linux; on Windows the tracker covers the whole guest arena range, so the test has no such range there).StoredOveris new, so the test does not build without this change.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 oneandonlydean on 2026-10-03T07:44:06Z.
The Linux failure in the first CI run is
agc_driver_vopc_compare(thread 1 compare 39 is 0, expected 1), the intermittent llvmpipe failure I described in https://github.com/boykopovar/AnyPS5/pull/399#issuecomment-5964789931. This PR doesn't touch the shader path; Windows passed in the same run. I rebased onto currentmainto start a fresh run.