Repository navigation
fix(agc): keep a surface's results in the 64 KiB block it shares with its neighbour - #441
Merged
oneandonlydean merged 1 commit intoOct 3, 2026
Conversation
… its neighbour Write stamps are per 64 KiB block, so a write-back of one surface stamps the whole block it shares with the surface packed right after it. A pending 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 them, stale. PPSA21564's half-resolution fog texture (960x540 RGBA16F, linear, starting 0xb800 bytes before a block end right after another 960x540 surface) lost its first 6 rows that way, which the fog composite upsampled into an orange band across the top 12 rows of the scene in one of its cinematics. The tracker now remembers the byte ranges of the driver's own stores (MarkWritten) in the blocks they cover only in part, and StoredOver says whether a store reached a given range since a generation (a CPU store still counts for its whole block). The write-back keep rule and the refresh drop rule ask it for the blocks a surface covers only in part.
oneandonlydean
force-pushed
the
fix/agc-partial-block-write-coverage
branch
from
October 3, 2026 07:43
b03393f to
01bcab3
Compare
Collaborator
Author
|
The Linux failure in the first CI run is |
This was referenced Oct 3, 2026
This was referenced Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)