Keep the scene at render_scale when DLSS cannot run

A DLSS mode (quality, balanced, performance) shrank the scene to 67, 58 or 50 % of the output and sharpened the
material textures' mip bias to match, even when nvngx_dlss.dll was missing and NGX reported DLSS as not available.
The game's plain scaling then stretched the smaller scene, and the negative bias made textures shimmer in motion.

With dlaa = 1 the scene size now waits on nvngx_dlss.dll next to totk.exe (checked before the device exists, as
the size is decided then) and follows render_scale without it. The mip bias applies only when NGX came up with
DLSS. dlaa = 0 keeps the documented size with the game's scaling, without the bias.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
itaskaev2andClaude Opus 5.5 authored and Valiantsin Dzerakh committed 2026-11-02 17:04:07 +03:00
1 parent 55ba4d312d
commit 438aa41747
5 files changed
+33 -3

No files matched your search

+22
View File
@@ -36,6 +36,7 @@
#include "cfg.h"
#include "host.h"
#include "platform/platform.h"
#define BASE_W 1920
#define BASE_H 1080
@@ -55,6 +56,23 @@ static struct {
double dlss_k; // TOTK_DLSS quality/balanced/performance: the scene's share of the output, else 0
} R;
// The scene size is decided before the device exists, so NGX cannot be asked yet. With dlaa on, NGX loads DLSS from
// nvngx_dlss.dll next to totk.exe (vk_dlaa.c vk_dlaa_init): without that file DLSS never runs, and a DLSS mode would
// leave the game's plain scaling at 50..67 % of the output. dlaa = 0 keeps the documented size with the game's scaling.
static int dlss_dll(void) {
#ifdef _WIN32
if (!cfg_bool("TOTK_DLAA")) return 1;
char exe[1024], path[1024 + 32];
if (!plat_exe_path(exe, sizeof exe)) return 1;
char *last = plat_last_sep(exe);
if (!last) return 1;
snprintf(path, sizeof path, "%.*s/nvngx_dlss.dll", (int)(last - exe), exe);
return plat_file_exists(path);
#else
return 1;
#endif
}
static void decide(void) {
if (R.decided) return;
R.decided = 1;
@@ -78,6 +96,10 @@ static void decide(void) {
{"quality", 2.0 / 3.0}, {"balanced", 0.58}, {"performance", 0.5}};
for (int i = 0; cfg_bool("TOTK_DLAA") && i < 3; i++)
if (!strcmp(m, dlss[i].name)) R.dlss_k = dlss[i].k;
if (R.dlss_k && !dlss_dll()) {
rt_log("resolution: DLSS %s needs nvngx_dlss.dll next to totk.exe, which is missing: the scene follows render_scale", m);
R.dlss_k = 0;
}
if (R.dlss_k) {
k = R.dlss_k;
R.scene_set = 1;