From a76bdf5e0817be887a4db3632a4e3f4e6b592337 Mon Sep 17 00:00:00 2001 From: toadjiang Date: Mon, 9 Nov 2026 10:45:05 -0800 Subject: [PATCH] Free all DLSS size slots when the preset changes evaluate's preset_dirty loop stopped at slot 3 of the five D.sizes entries, so a preset change left the features in slots 3 and 4 created with the old model: they kept running until the slot was evicted. The loop now covers the whole array through DLSS_SIZES instead of a literal. This is a plain bug fix with no switch: a preset change is a deliberate menu action, the loop frees the same entries it always did plus the two it missed, and nothing happens when the preset stays as it is. Built and run with the dlss_prewarm measurements; a preset change itself was not part of those runs. Co-Authored-By: Claude Sonnet 5.5 --- runtime/vk_dlaa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runtime/vk_dlaa.c b/runtime/vk_dlaa.c index 194c23b9..48af8738 100644 --- a/runtime/vk_dlaa.c +++ b/runtime/vk_dlaa.c @@ -294,6 +294,7 @@ static struct { unsigned cfg_seen; // cfg_version when preset was read uint64_t last_eval_ns; // plat_now_ns of the previous evaluation (FrameTimeDeltaInMsec) } D = {.mv_ok = -1, .cfg_seen = ~0u}; +#define DLSS_SIZES (sizeof D.sizes / sizeof D.sizes[0]) const VkTexImage *vk_dlaa_swap_img; VkImageView vk_dlaa_swap_view; @@ -949,7 +950,7 @@ static void evaluate(VkExec *ex, const VkExecTarget *dst) { VkCommandBuffer cb = ex->cb; vk_exec_barrier(ex); // what drew the scene is done (no pass is open here) if (D.preset_dirty) { // another model: features are created with it, so every size gets a new one - for (int i = 0; i < 3; i++) + for (size_t i = 0; i < DLSS_SIZES; i++) if (D.sizes[i].out) free_size(&D.sizes[i]); D.last = NULL, D.preset_dirty = 0; }