Size the scene by a DLSS mode only where DLSS can run, and log whether fxaa = 0 found the game's FXAA

The DLSS modes already apply only with dlaa on (3de0839), so the DLL check no longer looks at dlaa, and off Windows,
where vk_dlaa.c is no-op stubs, a DLSS mode no longer shrinks the scene. fxaa = 0 names the FXAA shader it skipped,
or reports a minute of frames without it, so a translator change that moves FXAA_FS shows on any GPU.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-11-02 17:11:14 +03:00
1 parent 9263989625
commit 3ee347b248
3 files changed
+27 -9

No files matched your search

+8 -5
View File
@@ -56,12 +56,11 @@ 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.
// The scene size is decided before the device exists, so NGX cannot be asked yet. 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. Off Windows vk_dlaa.c is built as no-op stubs, so there is no DLSS at all.
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);
@@ -69,7 +68,7 @@ static int dlss_dll(void) {
snprintf(path, sizeof path, "%.*s/nvngx_dlss.dll", (int)(last - exe), exe);
return plat_file_exists(path);
#else
return 1;
return 0;
#endif
}
@@ -97,7 +96,11 @@ static void decide(void) {
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()) {
#ifdef _WIN32
rt_log("resolution: DLSS %s needs nvngx_dlss.dll next to totk.exe, which is missing: the scene follows render_scale", m);
#else
rt_log("resolution: DLSS %s runs on Windows only: the scene follows render_scale", m);
#endif
R.dlss_k = 0;
}
if (R.dlss_k) {
+16 -1
View File
@@ -669,8 +669,19 @@ static uint64_t spirv_hash(const GfxShader *s) {
int vk_dlaa_skip_draw(VkExec *ex, const GfxShader *fs) {
static uint64_t frame_read = ~0ull;
static int fxaa = 1;
// fxaa = 0 reports once whether it found the game's FXAA draw: the first skip, or a minute of frames (3600) with
// none, which is what a translator change that moves FXAA_FS looks like on every GPU, with or without DLSS
static uint64_t fx_off_frames;
static int fx_found, fx_reported;
uint64_t f = __atomic_load_n(&gfx_counters.frames, __ATOMIC_RELAXED);
if (f != frame_read) frame_read = f, fxaa = cfg_bool("TOTK_FXAA"); // once a frame: the menu switches it live
if (f != frame_read) { // once a frame: the menu switches it live
frame_read = f, fxaa = cfg_bool("TOTK_FXAA");
if (!fxaa && !fx_found && !fx_reported && ++fx_off_frames == 3600) {
fx_reported = 1;
rt_log("dlaa: fxaa = 0 found no draw of the game's FXAA in %llu frames (its fragment shader is not in "
"FXAA_FS): the FXAA stays on", (unsigned long long)fx_off_frames);
}
}
if (fxaa && !D.up) return 0; // nothing to skip: no shader lookup per draw at the defaults
if (!fs) return 0;
uint64_t h = spirv_hash(fs);
@@ -678,6 +689,10 @@ int vk_dlaa_skip_draw(VkExec *ex, const GfxShader *fs) {
for (size_t i = 0; i < sizeof FXAA_FS / sizeof FXAA_FS[0]; i++) known |= h == FXAA_FS[i];
if (!known) return 0;
if (!ex->depth.image) return D.scaler_skipped = D.up; // the scaling pass
if (!fxaa && !fx_found) {
fx_found = 1;
rt_log("dlaa: fxaa = 0 skips the game's FXAA (fragment shader %016llx)", (unsigned long long)h);
}
return !fxaa;
}
+3 -3
View File
@@ -195,9 +195,9 @@
# totk.exe; elsewhere the setting does nothing. The HUD is drawn after it and is not touched. Read at start.
# dlaa = 0
# What DLSS works from: dlaa (the 3D scene at full size), quality, balanced or performance (the scene at 67, 58 or
# 50 % of the output, scaled up by DLSS; these replace render_scale and sharpen texture filtering to match). With dlaa
# = 0 the game's own scaling is used at that size, without the sharper filtering. With dlaa = 1 but no nvngx_dlss.dll
# next to totk.exe the scene follows render_scale. Read at start.
# 50 % of the output, scaled up by DLSS; these replace render_scale and sharpen texture filtering to match). They apply
# only with dlaa = 1 and nvngx_dlss.dll next to totk.exe, on Windows; otherwise the scene follows render_scale. Read at
# start.
# dlss = dlaa
# The game's own FXAA after the post effects; with DLAA on it is not needed. Changes while the game runs take effect at
# once.