Let the upscaler stand-in's scratch images make room for a new size instead of refusing it.

The cache kept the first eight sizes and formats for the whole run and refused every other one, so after a few
window, resolution or DLSS mode changes the stand-in's blit of a new size was left out, while the old sizes' images
stayed. A new size now takes a free entry or the one used longest ago, whose image goes through the deferred
destruction after the tonemap pass drops its views of it (vk_tonemap_forget), before another image can take its
handle. tests/scratch_lru_check.py checks the choice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-12 23:17:36 -05:00
parent d77572c69c
commit a4310491de
7 changed files with 173 additions and 7 deletions

View File

@@ -161,7 +161,14 @@ static void tm_filter_log(int easu, int edge, uint32_t sw, uint32_t sh, uint32_t
: "the edge-adaptive pass is not there");
}
// Views of the scratch images the pass samples, kept for the process (the scratch images live as long).
// Views of the scratch images the pass samples, kept as long as the image: vk_tonemap_forget drops those of an image
// fallback_scratch frees, which also gives their places back.
void vk_tonemap_forget(VkImage src) {
for (int i = 0; i < TM.nviews;)
if (TM.views[i].img == src) vk_defer_view(TM.views[i].view), TM.views[i] = TM.views[--TM.nviews];
else i++;
}
static VkImageView tm_view(VkImage img, VkFormat f) {
for (int i = 0; i < TM.nviews; i++)
if (TM.views[i].img == img && TM.views[i].f == f) return TM.views[i].view;