Evict textures no shader sampled for 30 seconds while video memory or the system's commit runs low.

The texture pool refresh looks up every registered slot, so the textures of every area the game keeps loaded never
counted as idle and their memory only grew. Marked shaders now store into a buffer with one word per pool slot. Every
four submissions that recorded work, the replay copies it out and clears it, and the texture side notes when each
texture was last sampled. Under VRAM pressure or low commit, once idle textures are gone, live textures that come back
intact and were not sampled for 1800 presents go too. Their keys are held, so the pool refresh keeps the stand-in until
a shader samples that slot again, and the next refresh makes the texture again.

Fragment shaders that neither discard nor write depth, sample mask, stencil reference or memory keep early depth tests
(EarlyFragmentTests), so the marks do not take away early depth rejection. Alpha to coverage leaves the dynamic state
while marks are on, so each pipeline knows whether early tests are safe. Disuse eviction waits until every module that
indexes the pool was marked and two reads arrived. NX2NAVI_TEX_DISUSE=0 (tex_disuse = 0) turns it off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 1a4c896150a748f9275c3024e96af3055db94af4)
This commit is contained in:
chrg6
2026-11-09 14:36:12 -05:00
committed by tangerineturtle1
parent d016a6dc86
commit dc9f164afc
8 changed files with 334 additions and 58 deletions

View File

@@ -149,6 +149,10 @@
# A render target that needs an image of its own takes the image of a released one of the same size and format
# instead of making a new one (0 = always a new image).
# tex_reuse = 1
# 1: shaders mark the textures they sample, so that while video memory or the system's memory runs low, textures no
# shader sampled for a while go, even those the game keeps registered (the areas it has loaded); one sampled again is
# made again within a few frames. The first start after changing it builds the pipelines again. 0: such textures stay.
# tex_disuse = 1
# Host zstd decoder in place of the game's (0 = the game's), and a check that decodes every call both ways and logs
# the differences (1 = on; slow).
# zstd_native = 1