Release the DLSS features with a larger input before a smaller one is made, so a DLSS mode picked in the menu no longer stripes the pause screen.

The rule that releases the kept features acted only after a feature had been freed. Picking ultra performance in play
made a feature of a third size while the gameplay and pause features stayed, with nothing freed, and the next pause was
striped as before. What the two cases share is a feature made while one with a larger input is alive; one made while a
smaller one is alive has never shown it. Both halves now apply unless dlss_idle_free is 2, and 0 only stops idle
features from being freed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-10 03:30:31 -05:00
parent 25ca858215
commit d726a4fcde
2 changed files with 27 additions and 21 deletions

View File

@@ -320,9 +320,9 @@
# characters, a little more flicker). Any other model by its letter, a to m: on slower RTX cards the older model e is # characters, a little more flicker). Any other model by its letter, a to m: on slower RTX cards the older model e is
# cheaper. Changes while the game runs take effect at once (DLSS starts a new history). # cheaper. Changes while the game runs take effect at once (DLSS starts a new history).
# dlss_preset = default # dlss_preset = default
# DLSS keeps one network per picture size (gameplay, the pause screen). 1: one unused for 3,600 frames is freed, and # DLSS keeps one network per picture size (gameplay, the pause screen). 1: one unused for 3,600 frames is freed.
# the others are made again with it when it comes back. 0: none is ever freed (about 0.5 GB more video memory after # 0: none is ever freed (about 0.5 GB more video memory after the first pause). 2: as 1, and the networks that stay
# the first pause). 2: freed, the others kept (shows striped pause screens; for tests). # are not made again when another is made (shows striped pause screens; for tests).
# dlss_idle_free = 1 # dlss_idle_free = 1
# Per-object motion vectors for DLSS: characters, animals and moving objects get their own motion instead of the # Per-object motion vectors for DLSS: characters, animals and moving objects get their own motion instead of the
# camera's, so DLSS keeps their history instead of smearing or rejecting it. Costs some CPU time each frame (about 1-2 ms # camera's, so DLSS keeps their history instead of smearing or rejecting it. Costs some CPU time each frame (about 1-2 ms

View File

@@ -511,19 +511,22 @@ static int image2d(uint32_t w, uint32_t h, VkFormat f, VkImageUsageFlags usage,
return vkCreateImageView(c->device, &vi, NULL, view) == VK_SUCCESS; return vkCreateImageView(c->device, &vi, NULL, view) == VK_SUCCESS;
} }
// A feature was released since the last one was made (destroy_size), and what follows from it (NX2NAVI_DLSS_IDLE_FREE). // Which features may stay alive when another is made (NX2NAVI_DLSS_IDLE_FREE). A feature made while one with a larger
// A pause of 3,600 frames frees the gameplay feature (stale_sizes); the unpause makes it again, and the pause screen's // input size is alive leaves that larger one drawing alternating bands of rows black or noise from then on, for as long
// feature, which had stayed, then drew alternating bands of rows black or noise at every later pause, for as long as // as it is used; seen for the pause screen's feature (the picture's size in and out), in two ways:
// the game stayed paused: in each of the 8 scripted runs of pause, unpause, pause in which the gameplay feature had // - a pause of 3,600 frames frees the gameplay feature (stale_sizes) and the unpause makes it again: every later pause
// been freed and in none of the 12 in which it had not, whatever the texture, write-back, HDR and frame generation // was striped, in each of 8 scripted runs of pause, unpause, pause in which it had been freed and in none of 12 in
// settings. Giving the kept feature its own sizes again at each evaluation changed nothing. Features made one after // which it had not, whatever the texture, write-back, HDR and frame generation settings;
// the other with none released in between do not show it (the gameplay feature, then the pause screen's, at every // - a DLSS mode picked in the menu makes a feature of a third size at the unpause, with nothing freed: the next pause
// first pause). So a feature is only ever made into that state: with a release since the last creation, the features // was striped (performance to ultra performance in play).
// that stayed are released first (release_kept) and made again when their size is next evaluated. With that rule none // Giving the kept feature its own sizes again at each evaluation changed nothing. A feature made while a smaller one
// of 5 runs in which the gameplay feature had been freed was striped. // is alive leaves the smaller one as it was (the pause screen's after the gameplay one, at every first pause). So when
// 1 (default) idle features are freed, and the kept ones are released before the next creation // a feature is made, the alive ones with a larger input are released first, and after a release since the last
// 0 idle features are never freed // creation all of them (release_kept); their images stay and each is made again when its size is next evaluated. With
// 2 idle features are freed and the kept ones stay (as before; shows the fault) // the second half alone, none of 5 runs in which the gameplay feature had been freed was striped.
// 1 (default) idle features are freed
// 0 idle features are never freed (about 0.5 GB more video memory after the first pause)
// 2 idle features are freed and nothing is released when a feature is made (as before; shows the fault)
static int feat_released; static int feat_released;
static int idle_free(void) { static int idle_free(void) {
@@ -1444,18 +1447,21 @@ static void stale_sizes(const struct Size *cur) {
} }
} }
// Before a feature is made after a release (feat_released): the features of the other sizes go too, their images stay. // Before a feature is made: the features of the other sizes with a larger input go, or all of them (all: a feature was
// The GPU may still be running an evaluation of theirs, so it finishes first, as in free_size. // released since the last creation, feat_released); their images stay. The GPU may still be running an evaluation of
static void release_kept(const struct Size *making) { // theirs, so it finishes first, as in free_size.
static void release_kept(const struct Size *making, int all) {
int n = 0; int n = 0;
for (int i = 0; i < DLSS_SIZES; i++) { for (int i = 0; i < DLSS_SIZES; i++) {
struct Size *s = &D.sizes[i]; struct Size *s = &D.sizes[i];
if (s == making || !s->feat) continue; if (s == making || !s->feat) continue;
if (!all && (uint64_t)s->w * s->h <= (uint64_t)making->w * making->h) continue;
if (!n++) vk_queue_lock(), vkDeviceWaitIdle(vk_ctx()->device), vk_queue_unlock(); if (!n++) vk_queue_lock(), vkDeviceWaitIdle(vk_ctx()->device), vk_queue_unlock();
N.release(s->feat), s->feat = NULL; N.release(s->feat), s->feat = NULL;
if (D.last == s) D.last = NULL; if (D.last == s) D.last = NULL;
} }
if (n) rt_log("dlaa: %d kept DLSS feature(s) released before a new one is made after a release; made again when used", n); if (n) rt_log("dlaa: %d DLSS feature(s) released before the one for %ux%u is made (%s); made again when used", n,
making->w, making->h, all ? "after a release" : "larger inputs");
} }
static void evaluate(VkExec *ex, const VkExecTarget *dst) { static void evaluate(VkExec *ex, const VkExecTarget *dst) {
@@ -1517,7 +1523,7 @@ static void evaluate(VkExec *ex, const VkExecTarget *dst) {
goto evaluated; goto evaluated;
} }
if (!e->feat) { if (!e->feat) {
if (feat_released && idle_free() == 1) release_kept(e); if (idle_free() != 2) release_kept(e, feat_released);
feat_released = 0; feat_released = 0;
p_setu(p, "CreationNodeMask", 1); p_setu(p, "CreationNodeMask", 1);
p_setu(p, "VisibilityNodeMask", 1); p_setu(p, "VisibilityNodeMask", 1);