Drop only stale released textures under VRAM pressure, let textures give way only when the system's commit runs low, and count the heightmap slots a finalize now leaves current.

Above the VRAM pressure threshold the released textures that come back intact were dropped oldest first, however recently released. The game releases and takes back hundreds a frame in towns, so the list is mostly those, and each drop was made and uploaded again within frames and freed nothing. With the budget taken as 7.5 GiB (NX2NAVI_VRAM_BUDGET_MB), seven minutes of teleports between Hyrule Field, Kakariko Village, the Graveyard, Death Mountain Trail and Kokiri Forest dropped 82,288 and stayed over the budget throughout; with 11 GiB, 178 draws met a texture that was gone. They now go by the rule drop_stale keeps (released STALE_FRAMES ago and idle): on the same tour 34,699 drops, a fifth fewer textures made again, a third less time the render thread waited on textures, 4 draws of a missing texture instead of 11, and the slowest 1 % of frames in Hyrule Field afterwards at 32 fps instead of 22.

Past the process's own commit bound (tex_proc_commit_mb), textures were dropped and idle live ones evicted as under a low system commit. The bound compares the commit less the video memory in use, and a dropped texture lowers both sides alike, so nothing a drop did could bring the process back under it: textures went one after the other for as long as the rest of the process stayed large, and the ground flickered white with the system's commit to spare (#434). The bound now only writes its line into the log.

The perf trace's texture origins line counts the slots a finalize leaves current because another texture of the same parameters was registered at the storage since (the terrain heightmaps of pull request #535): 173 at the load of a Hyrule Field save, and between 40 and 365 every 60 frames while Link runs through the field, each of which the old rule left stale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
epicmeme546
2026-11-11 12:53:58 -05:00
parent b5789c6bec
commit 7b201d868e
2 changed files with 37 additions and 18 deletions

View File

@@ -266,10 +266,11 @@
# which game memory gets no copy in video memory (memory = mirror), which costs far more frame time than a texture
# uploaded again. 0: textures never give way for video memory.
# tex_vram_pressure = 80
# Megabytes this process may commit before textures give way as they do while the system's commit runs low. Windows
# counts video memory against the commit; with a discrete GPU the video memory in use is left out of the comparison,
# since it is not in RAM. Default: the installed memory, at least 24576, so that it does not depend on the size of the
# page file. 0: no bound of its own; only the system's commit counts. On Linux it counts the
# Megabytes of this process's commit above which the log says so. Windows counts video memory against the commit;
# with a discrete GPU the video memory in use is left out of the comparison, since it is not in RAM. Textures no longer
# give way at this bound: dropping one lowers both sides of the comparison alike, so nothing they could do brought the
# process under it, and the ground flickered white while the system had commit to spare. They give way only while the
# system's commit runs low. Default: the installed memory, at least 24576. 0: no bound. On Linux it counts the
# process's resident anonymous memory, which stays under the installed memory, so there only a smaller value holds.
# tex_proc_commit_mb = 32768
# 1: a texture the game releases or takes back, with nothing else changed at its address, puts the texture table's