perf(agc): key sampled textures without the streaming-feedback fields #1865
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1865"
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 fisherjoey on 2026-10-08T22:25:03Z.
What
MakeTextureKeycopies the eight raw T# words into the sampled-texture cache key. Three fields in those words are texture-streaming feedback: MIN_LOD_WARN (word 5 bits 8-19), MIP_STATS_COUNTER_EN (word 5 bit 25) and MIP_STATS_COUNTER_ID (word 6 bits 0-7).DecodeTextureResourcereads and ignores them, so they never change the texture, but they do change the key. Demon's Souls rotates the counter fields per use, so each streaming texture ends up under about six keys. Every new key is a fresh snapshot (about 5 MiB for a 2048x2048 BC texture), and the stale variants push live textures out under the budget.MakeTextureKeynow clears those three fields before the words go into the key, so two descriptors that differ only in them share one entry.Closes #1790.
Tested
Linux 7.2 (Nobara 44), GCC 16, RTX 5070 Ti, driver 595.91.07.
main(ae91d978), no conflicts.ctest -R "agc_driver|guest_agc_driver": 202 of 202 pass, withoutAPS5_WRITE_WATCH_IMPORTS.agc_driver_lds_atomics64andagc_driver_scalar_sop1are excluded; they fail on unmodifiedmainon this GPU too (the first one hangs it).python3 tools/check_conventions.py --base origin/main: passes.Before the change, every evicted entry was a stale key of a texture still cached under another key (711 of 711, 780 of 780 and 948 of 948 in three windows). These numbers come from a local build (an older
mainwith #861 and other patches) that also raised the pipeline store's 256-entry bound, so the fps change isn't from the key alone. The eviction and binding numbers are. The level's texture set is about 8 GiB, so it still won't fitmain's fixed 2 GiB budget; #1059 sizes the budget from device memory. Without this change the six variants of each texture compete for whatever budget there is.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 repositoryImported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-08T23:05:34Z.
Added a test (1dcefb40).
SampledTexturesShareEntryin ShaderResources compares two T#s through the cache's own key and hash.RunGuestTextureResourceTestschecks that T#s differing only in MIN_LOD_WARN, MIP_STATS_COUNTER_EN or MIP_STATS_COUNTER_ID share an entry, and that a different base address, format or CORNER_SAMPLE (word 5 bit 23, between the cleared fields) still gives a separate one.On
main(f1451396with only the test cherry-picked),agc_driver_graphicsfails:On the branch it passes. Also rebased on
f1451396.Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T19:43:15Z.
Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head
36997299, merged ontomain8b393b6ein one build with 31 other PRs that had no Windows run.agc_driver_graphics, which includesGuestTextureResource.cpp, passes.guest_offline_imports, broken by #2359 (reported there).No title was run.
🤖 Addressed by Claude Code