fix(agc): prefer the pending image of exactly a sampled surface over an aliasing mip chain #1494
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1494"
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 TideOPL on 2026-10-08T09:15:15Z.
What
StorageTexture::FindPendingreturned the first pending storage image at a texture's address that is at least as long as the surface. When transient surfaces alias, that can be the wrong image.Unreal's depth of field does this: the reduce pass writes a 2-mip 1424x800 RGBA16F chain, and right after, the post-filter and bokeh scatter write a 1-mip 1424x800 surface at the same address, each with its own DCC keys. When the recombine sampled the newer single-mip surface, the lookup could pick the older chain. The chain's view was then refreshed under its own keys, which the title had already re-filled with a fast-clear code, so whole blocks read as the clear value (0, 0, 0, 1) instead of what the GPU had just written. On screen these were large black rectangles at 8x8-workgroup granularity, at the same positions every frame.
Now an image whose length equals the surface's wins. A longer chain still serves a descriptor of its first mips when no exact image is pending, so the containment case it was written for is unchanged.
Tested
Windows 11, NVIDIA RTX 5070 (driver 610.88).
ctest: 426 of 426 pass on currentmainwith this PR and #1495 (unrelated files) applied.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 klosixgaming-arch on 2026-10-08T11:31:20Z.
Review: APPROVED
Good fix for storage texture pending lookup. This properly handles cases where multiple textures overlap at the same address by preferring exact matches over containment matches, preventing incorrect texture reuse.
Strengths:
This will improve rendering correctness by ensuring the right texture is found during pending lookups. Ready to merge.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T23:36:17Z.
Review: DISMISSED
The change itself reads right: preferring the image whose
guestBytesequals the sampled surface's, and keeping the first containing image as a fallback, leaves the chain-prefix case untouched.One thing is missing before this can merge:
FindPendingasked for the 1-mip size, should return the single-mip image, and for the first-mips-of-a-chain case still return the chain. The execution tests incore/libs/prx/libSceAgcDriver/tests/execution/(e.g.DccKeysFirstWrite.cpp) already drive pending images and can be extended. The test should fail on currentmainand pass with this change, and be registered in ctest.Build and the libSceAgcDriver ctest scope pass locally with the change applied; the Minecraft Dungeons II result on Windows/NVIDIA could not be verified here.
Imported from boykopovar/AnyPS5. Originally posted by TideOPL on 2026-10-10T00:21:13Z.
Thanks. I added the execution test
agc_driver_pending_exact_surface(tests/execution/PendingExactSurface.cpp, picked up by the existing glob, so it's in ctest). It writes mip 0 of a 2-mip 256x256 R32 surface, then a 1-mip surface at the same address. The chain's mip 0 lies past the 1-mip surface's bytes, so both stay pending, with the chain first.On current
mainthe second lookup returns the 327680-byte 2-mip chain. Full ctest passes on Linux and Windows.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T05:25:22Z.
The test that was asked for is in
3fba616bb5(a pending surface aliased by a pending mip chain), and this head passed the full Linux and Windows build in the merge-train run 38023415505, so the change request is resolved. Merging.