mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 01:49:59 -04:00
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:
@@ -482,6 +482,9 @@ extern volatile uint32_t vk_pool_kinds_used; // bit k: a pipeline was mad
|
||||
int vk_pool_marks_enabled(void); // NX2NAVI_TEX_DISUSE: modules get the marks
|
||||
extern volatile int32_t vk_pool_marks_missed; // modules indexing the pool that could not be marked
|
||||
void vk_pool_marks_read(const uint32_t *marks, uint32_t n); // vk_texture.c: slots marked since the last read
|
||||
// Texture lock held: 1 while the texture pool refresh looks its slots up (vk_exec_draw.c pool_sync_entries), 0 after.
|
||||
// Those lookups leave out a texture evicted by disuse, and are not counted as the texture being used.
|
||||
void vk_texture_pool_ctx(int on);
|
||||
VkDescriptorSetLayout vk_pool_set_layout(void); // the pools' layout (made on first use)
|
||||
VkDescriptorSetLayout vk_empty_set_layout(void); // set 1 of layouts without one
|
||||
// The upscaler stand-in (vk_tonemap.c): src (sampled) scaled to dw x dh and tonemapped into its own RGBA16F image, which
|
||||
|
||||
Reference in New Issue
Block a user