AGC: the sampled-texture cache keys on the T# streaming-feedback fields, so a title that rotates them caches each texture several times #1790
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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-08T19:16:12Z.
Summary
MakeTextureKey(Graphics/src/ShaderResources.cpp:82onmain6b56175a) copies the eight raw T# words into the key. Three of the 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 them and ignores them (GuestTextureResource.cpp:103), so they never change what the texture returns, but they do change the key.Demon's Souls rotates MIP_STATS_COUNTER_EN and MIP_STATS_COUNTER_ID per use (counter ids 0x0d / 0x4d / 0xad). Each streaming texture in the level ends up under about six keys. Each new key is a fresh snapshot (vkCreateImage + vkAllocateMemory, about 5 MiB for a 2048x2048 BC texture), and the stale variants push live textures out under the budget.
Evidence
Demon's Souls (PPSA01341 v1.07), tutorial level, per 10 s:
[texture]trace for one address shows T# words that differ only in word 5 bit 25 and word 6 bits 0-7.Fix
MakeTextureKeyclears the three feedback fields before the words go into the key. Two descriptors that differ only in those fields now share one entry.Measured on our local build (an older
mainplus #157, #861 and our own patches), with an 8 GiB texture budget:The same run also raised the pipeline store's 256-entry bound, so the fps change is not from the key alone. The eviction and binding numbers are, since the pipeline bound only affects pipeline creation. The level's texture set is about 8 GiB, so with
main's fixed 2 GiB budget it still won't fit. #1059 sizes the budget from device memory. The key change applies either way: without it, the six variants of each texture compete for whatever budget there is.The fix is ready on a branch: https://github.com/boykopovar/AnyPS5/compare/main...fisherjoey:AnyPS5:perf/texture-key-ignore-feedback
Tests: the 195
agc_drivertests pass on the branch (rebased on6b56175a);agc_driver_buffer_formattimed out once under load and passed on rerun. I didn't add a test because the cache has no hook a test can observe the key through.Found on Linux 7.2 (Nobara 44), GCC 16, RTX 5070 Ti (595.91.07), with Demon's Souls PPSA01341 v1.07.
I'll open the PR if the approach looks right.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-08T20:35:10Z.
I reviewed
fisherjoey:perf/texture-key-ignore-feedbackagainst currentmain. The masks match the fieldsGuestTextureResource.cppdecodes as unreported streaming feedback: word 5 bits 8–19 and bit 25, plus word 6 bits 0–7. The descriptor fields that affect the returned texture remain in the key, so I don't see a semantic issue with this normalization.git diff --checkis clean. I haven't independently measured the title or run the reported AGC tests. The branch is based on6b56175a; current main is4b6ab6bb, so please rebase before opening the PR and rerun the focused checks on that head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-08T20:56:37Z.
Update: upstream
mainis nowaa277b3; the prepared texture-key branch is still based on6b56175(1 commit ahead, 22 behind). My earlier rebase note referred to the then-current4b6ab6b. Please rebase onaa277b3and rerun the focused AGC checks before opening the PR.