render3d/vk: the kept descriptor sets start over after 256 textures are freed

gvk_sc_make's cache (program + bound textures -> a set in the kept pool) evicted
nothing until the pool's 8192 sets filled. A texture freed - a photograph's
thumbnail, a wall frame, any picture a screen loads - left its entries and their
sets behind for good, since its handle's generation moved on and the key could
never match again: 262 KB over 12 minutes of the user's play, and bound only by
the pool, hours away.

gvk_tex_release counts the releases (gvk_sc_dead); at GVK_SC_DEAD_MAX (256) the
next frame's start resets the kept pool and empties the cache (gvk_kpool_reset,
which waits for the frame in flight), and each draw still in use makes its set
again the first time it is drawn - the budget is the live combinations plus at
most 256 textures' dead ones. The declared reason on gvk_sc_make was the
swapchain's, copied; it now says what the cache is and what bounds it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 13:41:35 +03:00
parent f38581754a
commit 99f8749949
3 changed files with 9 additions and 1 deletions

View file

@ -493,6 +493,7 @@ function gvk_tex_release(render3d_st: mut Render3dState, tex: int) -> void {
render3d_st.gvk_tex_image[tex] = zero; render3d_st.gvk_tex_view[tex] = zero; render3d_st.gvk_tex_mem[tex] = zero
render3d_st.gvk_tex_levels[tex] = 0; render3d_st.gvk_tex_layers[tex] = 0; render3d_st.gvk_tex_vkfmt[tex] = 0
render3d_st.gvk_tex_gen[tex] = render3d_st.gvk_tex_gen[tex] + 1
render3d_st.gvk_sc_dead += 1 # its kept sets are dead now (gvk_frame_reset)
}
# the per-level and per-layer views gvk_view_of made of a texture go with it: kept, each held its