From 5c5b1914d50be65adf64d81938d6bd62e4d975f5 Mon Sep 17 00:00:00 2001 From: chrg6 Date: Fri, 13 Nov 2026 05:54:37 -0500 Subject: [PATCH] Keep the sizes frame generation still uses when the upscaler's idle sizes are freed. With frame generation and no upscaler, idle_release freed every DLSS size other than the last one at each present from 600 presents after the switch, without waiting for the GPU. The scene's size can change from frame to frame, so a size the frame before used could still be in flight. A size now goes only after it went unused for as many evaluations; its DLSS feature, unused since the upscaler went off, is released as before. Co-Authored-By: Claude Opus 5.5 --- runtime/vk_dlaa.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/runtime/vk_dlaa.c b/runtime/vk_dlaa.c index ef03bdc7..8bc8969c 100644 --- a/runtime/vk_dlaa.c +++ b/runtime/vk_dlaa.c @@ -3047,8 +3047,13 @@ static void idle_release(void) { int n = 0; for (int i = 0; i < DLSS_SIZES; i++) { struct Size *s = &D.sizes[i]; - if (D.fgo && s == D.last) { // frame generation's motion images without an upscaler (fg_only_frame) stay - if (s->feat) { // a DLSS feature made for the same sizes (DLAA) does not + // Frame generation without an upscaler (fg_only_frame) makes its motion images in the size of the scene's + // size at every frame, and that size can change from one frame to the next: a size it used within the last + // IDLE_FREE_PRESENTS evaluations may still be in flight, and destroy_size does not wait for the GPU. Such a + // size stays, and so does the last one; a DLSS feature made for the same sizes (DLAA) goes, since the upscaler + // that used it has been off for that long. + if (D.fgo && (s == D.last || s->used + IDLE_FREE_PRESENTS > (uint64_t)D.evals)) { + if (s->feat) { rt_log("dlaa: the DLSS feature at %ux%u went unused for %d presents with the upscaler off: released; " "its size's motion images stay for frame generation", s->w, s->h, IDLE_FREE_PRESENTS); N.release(s->feat), s->feat = NULL, feat_released = 1;