Offer DLSS multi frame generation at 2x, 3x and 4x.

framegen_multiplier (2, 3 or 4, live) sets how many frames the display gets per rendered frame while NVIDIA DLSS frame generation runs, and a DLSS multiplier row under Frame generation in the Screen tab sets it. nx2navi_dlssg.dll now passes that count to Streamline and reports the GPU's limit (numFramesToGenerateMax) through a new optional export, nx2sl_frames_max; with an older DLL the game keeps to 2x. A value above the limit is clamped to it with a log line, and the menu lists only what the GPU and driver allow, with a note saying why the rest are missing. The Frame generation row now says "in use: off" and why when DLSS frame generation was set but does not run.

The pacer divides the frame limit by the multiplier in effect, as it already halved it for FSR 3.1, so the display gets the limit and VSync at the display's rate drops no generated frames; RivaTuner Statistics Server stays out while DLSS frame generation runs, since it counts generated frames. With DLSS 2x a limit of 60 now shows 60 on screen instead of 120.

nx2navi_dlssg.dll has to be rebuilt (tools/build_dlssg.py) for 3x and 4x.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-09 11:58:47 -05:00
parent 26eb249026
commit c745a9ef2f
13 changed files with 244 additions and 31 deletions

View File

@@ -52,6 +52,7 @@
#include "host.h"
#include "layout.h"
#include "platform/platform.h"
#include "vk_dlssg.h"
#include "vk_fg.h"
#define STEP_SAMPLES 5
@@ -199,6 +200,10 @@ static int movie_cap_hz(void) {
return hz && ov_movie_live() ? hz : 0;
}
// Frames on screen per game frame while frame generation runs: 2 with AMD's (vk_fg.cpp, one generated frame), the
// multiplier with NVIDIA's (vk_dlssg.c, one to three); 1 while neither generates (off, or paused for the menu).
static int generated_factor(void) { return vk_fg_generating() ? 2 : vk_dlssg_multiplier(); }
// RivaTuner Statistics Server (rtss_limit.c) gets the same limit; while it limits this process the pacer holds no
// frames, so the two never stack. NX2NAVI_RTSS=0 and frame generation (RTSS would count the generated frames) keep it out.
uint64_t frame_step_cap_ns(void) {
@@ -208,7 +213,8 @@ uint64_t frame_step_cap_ns(void) {
const char *e = cfg_get("NX2NAVI_RTSS");
rtss_allowed = !(e && !strcmp(e, "0"));
}
int rtss = rtss_allowed && !vk_fg_wanted();
int rtss = rtss_allowed && !vk_fg_wanted() && !vk_dlssg_active();
int gen = generated_factor();
int movie_hz = movie_cap_hz();
static int movie_was, movie_logs;
if (!!movie_hz != movie_was) {
@@ -222,14 +228,15 @@ uint64_t frame_step_cap_ns(void) {
rtss_limit_want(rtss ? 0 : -1);
return 0;
}
// unlimited during a movie: the movie's rate, doubled for frame generation's halving below
double hz = limit_hz == -2 ? movie_hz * (vk_fg_generating() ? 2 : 1)
// unlimited during a movie: the movie's rate, times frame generation's factor for the division below
double hz = limit_hz == -2 ? movie_hz * gen
: shown_hz(limit_hz ? limit_hz : gfx_window_refresh_hz());
double max = frame_free_running() ? LIMIT_FREE_MAX_HZ : LIMIT_MAX_HZ;
if (hz > max) hz = max;
// Frame generation presents a generated frame between each two of the game's (vk_fg.cpp): the game is paced at
// half the limit then, so the screen shows the limit
if (vk_fg_generating()) hz /= 2;
// Frame generation presents one to three generated frames between each two of the game's: the game is paced at the
// limit over that factor (half, a third, a quarter), so the screen shows the limit. With VSync and the limit at the
// display's rate, the generated frames then fill the display's refreshes and none is dropped.
if (gen > 1) hz /= gen;
if (movie_hz && hz > movie_hz) hz = movie_hz;
rtss_limit_want(rtss ? (int64_t)(hz * 1000 + 0.5) : -1);
if (rtss_limit_active()) return 0;