Merge pull request #1263: with DLAA, fog and particles can be drawn over the smoothed picture, so dust in shrine fog no longer vanishes; off by default until checked on NVIDIA (ipavlin98)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-11-17 20:07:08 +03:00
commit 1974b671be
7 files changed
+128 -12

No files matched your search

+3 -3
View File
@@ -40,7 +40,7 @@ static const char *const known[] = {
"BIND_INC", "BIND_SKIP", "BIND_STATS", "BIND_UP", "BIND_X", "BIND_Y",
"BIND_ZL", "BIND_ZR", "BARRIER_MERGE", "BLOCK_VIEWS_3D", "CLIMB_FIX", "CLOTH_REALTIME", "COLOR_BRIGHTNESS", "COLOR_CONTRAST", "COLOR_GAMMA",
"COLOR_PRESET", "COLOR_SATURATION", "CONTACT_DEBUG", "CONTACT_SHADOWS", "CORE_DIAG", "CRIT", "CRIT_OUT",
"DESC_TEMPLATE", "DESWIZZLE", "DEVICE_PROFILE", "DIALOGUE_CLICK", "DISCORD_APP_ID", "DISCORD_IMAGE", "DISCORD_RPC", "DLAA", "DLAA_JITTER", "DLAA_MV", "DLAA_MASKDEBUG", "DLAA_MVDEBUG", "DLAA_OBJMV", "DLAA_SURVEY", "DLAA_TIMES", "DLSS", "DLSS_CHAR_MASK", "DLSS_PRESET", "DLSS_REACTIVE", "DUMP", "DUMP_BUF", "DUMP_DIR",
"DESC_TEMPLATE", "DESWIZZLE", "DEVICE_PROFILE", "DIALOGUE_CLICK", "DISCORD_APP_ID", "DISCORD_IMAGE", "DISCORD_RPC", "DLAA", "DLAA_EFFECTS_AFTER", "DLAA_JITTER", "DLAA_MV", "DLAA_MASKDEBUG", "DLAA_MVDEBUG", "DLAA_OBJMV", "DLAA_SURVEY", "DLAA_TIMES", "DLSS", "DLSS_CHAR_MASK", "DLSS_PRESET", "DLSS_REACTIVE", "DUMP", "DUMP_BUF", "DUMP_DIR",
"DUMP_LOG", "DYNAMIC_RES", "DYN_DELTA", "EXEFS", "FEEDBACK", "FIXED_RES_PATCH", "FIX_C0", "FIX_ZERO", "FLIGHT", "FLIGHT_AT", "FLIGHT_DIR", "FLIGHT_FRAMES",
"FLIGHT_SPIKE_MS", "FLIGHT_THUMBS", "FLUSH_SPAN", "FOV", "FOV_PATCH", "FPS60", "FPS_LIMIT", "FRAME_QUEUE",
"FREEZE_IDLE", "FREE_CORES",
@@ -83,7 +83,7 @@ static const struct { const char *key, *section; } sections[] = {
{"COLOR_BRIGHTNESS", "display"}, {"COLOR_CONTRAST", "display"}, {"COLOR_SATURATION", "display"},
{"COLOR_GAMMA", "display"}, {"HDR", "display"}, {"HDR_PEAK_NITS", "display"}, {"HDR_GAME_NITS", "display"},
{"HDR_UI_NITS", "display"}, {"HDR_HUE", "display"}, {"SHADOW_RES", "display"},
{"DLAA", "display"}, {"DLSS", "display"}, {"DLSS_PRESET", "display"}, {"DLSS_CHAR_MASK", "display"}, {"REFLEX", "display"}, {"FXAA", "display"},
{"DLAA", "display"}, {"DLSS", "display"}, {"DLSS_PRESET", "display"}, {"DLSS_CHAR_MASK", "display"}, {"DLAA_EFFECTS_AFTER", "display"}, {"REFLEX", "display"}, {"FXAA", "display"},
{"DEVICE_PROFILE", "display"}, {"ASSUME_FOCUS", "display"},
{"DISCORD_RPC", "discord"}, {"DISCORD_APP_ID", "discord"}, {"DISCORD_IMAGE", "discord"},
{"SHADOW_SCALE", "display"}, {"SHADOW_RANGE", "display"}, {"GRASS_RANGE", "display"}, {"CONTACT_SHADOWS", "display"},
@@ -139,7 +139,7 @@ static const CfgMeta metas[] = {
{"DYNAMIC_RES", "1", "0|1", LIVE}, // resolution.c res_dynres_live
{"UPSCALER", "fsr", "fsr|bilinear", LIVE}, {"SHARPNESS", "80", "0..100", LIVE},
{"DLAA", "0", "0|1", RESTART}, {"DLSS", "dlaa", "dlaa|quality|balanced|performance|ultra_performance", LIVE},
{"DLSS_PRESET", "default", "default|k|j", LIVE},
{"DLSS_PRESET", "default", "default|k|j", LIVE}, {"DLAA_EFFECTS_AFTER", "0", "0|1", LIVE},
{"DLSS_CHAR_MASK", "65", "0|35|65|100", LIVE}, {"REFLEX", "off", "off|on|boost", RESTART}, {"FXAA", "1", "0|1", LIVE},
{"LOD_STEADY", "0", "0|1", RESTART}, // sets steady
{"ASPECT", "fit", "fit|stretch", LIVE}, {"MOVIE_ASPECT", "keep", "keep|stretch", LIVE}, {"FOV", "100", "70..140", LIVE},
+1
View File
@@ -734,6 +734,7 @@ static void tab_screen(float scale) {
static const UiTextId chars[] = {UI_MENU_DLSS_CHARS_OFF, UI_MENU_DLSS_CHARS_LIGHT, UI_MENU_DLSS_CHARS_MEDIUM,
UI_MENU_DLSS_CHARS_FULL};
opt_choice("TOTK_DLSS_CHAR_MASK", UI_MENU_DLSS_CHARS, chars, 4, UI_MENU_DLSS_CHARS_DESC);
opt_toggle("TOTK_DLAA_EFFECTS_AFTER", UI_MENU_DLAA_EFFECTS_AFTER, UI_MENU_DLAA_EFFECTS_AFTER_DESC);
static const UiTextId reflex[] = {UI_MENU_REFLEX_OFF, UI_MENU_REFLEX_ON, UI_MENU_REFLEX_BOOST};
opt_choice("TOTK_REFLEX", UI_MENU_REFLEX, reflex, 3, UI_MENU_REFLEX_DESC);
opt_toggle("TOTK_FXAA", UI_MENU_FXAA, UI_MENU_FXAA_DESC);
+22
View File
@@ -496,6 +496,12 @@ static const char *const text_en[UI_TEXT_COUNT] = {
[UI_MENU_FIX_C0_DESC] = "Fills the driver-reserved constant bank c0 (storage sizes, dispatch size, point size, base instance) instead of reading zeros.",
[UI_MENU_FIX_ZERO] = "Zero new GPU memory",
[UI_MENU_FIX_ZERO_DESC] = "New GPU memory pools start zero-filled, as Switch memory does.",
[UI_MENU_DLAA_EFFECTS_AFTER] = "Fog and particles after DLAA",
[UI_MENU_DLAA_EFFECTS_AFTER_DESC] = "With DLAA, fog, dust and other particles are drawn over the picture DLSS has"
" already smoothed, as the game draws them without DLSS: small particles in "
"fog (shrines) no longer vanish or leave trails. Off: DLSS also processes "
"these effects, as before. DLAA mode only; the upscaling DLSS modes always "
"process them. Applies at once.",
[UI_MENU_BIND_SKIP] = "Skip repeated binds",
[UI_MENU_BIND_SKIP_DESC] = "Optimisation: skips bindings that did not change.",
[UI_MENU_SHADER_MEMO] = "Shader memo", [UI_MENU_SHADER_MEMO_DESC] = "Optimisation: remembers shader lookups.",
@@ -1076,6 +1082,12 @@ static const char *const text_ru[UI_TEXT_COUNT] = {
[UI_MENU_FIX_C0_DESC] = "Заполняет зарезервированный драйвером банк констант c0 (размеры хранилищ, размер запуска, размер точки, базовый экземпляр) вместо чтения нулей.",
[UI_MENU_FIX_ZERO] = "Обнулять новую память GPU",
[UI_MENU_FIX_ZERO_DESC] = "Новые пулы памяти GPU заполняются нулями, как память Switch.",
[UI_MENU_DLAA_EFFECTS_AFTER] = "Туман и частицы после DLAA",
[UI_MENU_DLAA_EFFECTS_AFTER_DESC] = "С DLAA туман, пыль и другие частицы рисуются поверх картинки, уже сглаженной"
" DLSS, как игра рисует их без DLSS: мелкие частицы в тумане (святилища) "
"больше не пропадают и не оставляют шлейфов. Выкл.: DLSS обрабатывает и эти "
"эффекты, как раньше. Только в режиме DLAA; режимы DLSS с повышением "
"разрешения обрабатывают их всегда. Применяется сразу.",
[UI_MENU_BIND_SKIP] = "Пропуск повторных привязок",
[UI_MENU_BIND_SKIP_DESC] = "Оптимизация: пропускает неизменившиеся привязки.",
[UI_MENU_SHADER_MEMO] = "Память шейдеров", [UI_MENU_SHADER_MEMO_DESC] = "Оптимизация: запоминает поиск шейдеров.",
@@ -1505,6 +1517,12 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = {
[UI_MENU_FIX_C0_DESC] = "Preenche o banco de constantes c0 reservado ao driver (tamanhos de armazenamento, tamanho do dispatch, tamanho do ponto, instância base) em vez de ler zeros.",
[UI_MENU_FIX_ZERO] = "Zerar memória nova da GPU",
[UI_MENU_FIX_ZERO_DESC] = "Novos pools de memória da GPU começam zerados, como a memória do Switch.",
[UI_MENU_DLAA_EFFECTS_AFTER] = "Névoa e partículas após o DLAA",
[UI_MENU_DLAA_EFFECTS_AFTER_DESC] = "Com DLAA, a névoa, a poeira e outras partículas são desenhadas sobre a "
"imagem já suavizada pelo DLSS, como o jogo as desenha sem DLSS: partículas "
"pequenas na névoa (santuários) não somem mais nem deixam rastros. Desligado:"
" o DLSS também processa esses efeitos, como antes. Só no modo DLAA; os modos"
" de DLSS que aumentam a resolução sempre os processam. Aplica-se na hora.",
[UI_MENU_BIND_SKIP] = "Pular bindings repetidos",
[UI_MENU_BIND_SKIP_DESC] = "Otimização: pula bindings que não mudaram.",
[UI_MENU_SHADER_MEMO] = "Memória de shaders", [UI_MENU_SHADER_MEMO_DESC] = "Otimização: lembra as buscas de shaders.",
@@ -2237,6 +2255,10 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = {
"基础实例),而不是读取零值。",
[UI_MENU_FIX_ZERO] = "清零新的 GPU 内存",
[UI_MENU_FIX_ZERO_DESC] = "新的 GPU 内存池初始内容为零,与 Switch 内存一致。",
[UI_MENU_DLAA_EFFECTS_AFTER] = "DLAA 之后绘制雾和粒子",
[UI_MENU_DLAA_EFFECTS_AFTER_DESC] = "开启 DLAA 时,雾、灰尘和其他粒子绘制在 DLSS 已平滑的画面之上,与游戏不用 DLSS 时的"
"绘制方式相同:雾中的细小粒子(神庙中)不再消失,也不再留下拖影。关闭:DLSS 也处理这些效果,与以"
"前相同。仅用于 DLAA 模式;提升分辨率的 DLSS 模式始终处理它们。立即生效。",
[UI_MENU_BIND_SKIP] = "跳过重复绑定",
[UI_MENU_BIND_SKIP_DESC] = "优化:跳过没有变化的绑定。",
[UI_MENU_SHADER_MEMO] = "着色器查找缓存",
+1 -1
View File
@@ -241,7 +241,7 @@ typedef enum {
UI_MENU_ASTC_BC, UI_MENU_ASTC_BC_DESC,
UI_MENU_LOD_GUARD, UI_MENU_LOD_GUARD_DESC,
UI_MENU_FIX_C0, UI_MENU_FIX_C0_DESC,
UI_MENU_FIX_ZERO, UI_MENU_FIX_ZERO_DESC,
UI_MENU_FIX_ZERO, UI_MENU_FIX_ZERO_DESC, UI_MENU_DLAA_EFFECTS_AFTER, UI_MENU_DLAA_EFFECTS_AFTER_DESC,
UI_MENU_BIND_SKIP, UI_MENU_BIND_SKIP_DESC,
UI_MENU_SHADER_MEMO, UI_MENU_SHADER_MEMO_DESC,
UI_MENU_PIPE_MEMO, UI_MENU_PIPE_MEMO_DESC,
+94 -8
View File
@@ -227,7 +227,8 @@ int vk_dlaa_available(void) { return vk_dlaa_wanted() && N.available; }
// So: after the G-buffer, a pass at the scene size with exactly one colour target (R11G11B10F or RGBA16F) and the D32F
// depth arms the frame with that pair; the next pass at most a quarter as wide ends the scene (no jitter after it) and,
// when the scene is as wide as the output, runs DLAA on the armed target first. Bloom, tonemap, post and HUD then all
// work on the anti-aliased picture.
// work on the anti-aliased picture. With DLAA the scene ends before that, at the first pass into the light target after
// the lighting: the fog and the particles then go over DLAA's picture (effects_point).
// Upscaling (a scene smaller than the output: TOTK_DLSS quality/balanced/performance, or the game's own 5/6): measured
// at a 960x536 scene, 1920x1080 output, the bloom and its composite write back into the light target at the scene size,
// then one full-screen draw (the FXAA shader below, which also scales) reads it into an output-sized R11G11B10F target
@@ -262,7 +263,13 @@ static struct {
VkImage last_color; // the target DLAA ran on last frame: another one means a new history
NgxParam *params;
int failed, reset;
uint64_t evals, frames_missed;
uint64_t evals, frames_missed, fx_frames; // fx_frames: DLAA ran before the effects (effects_point)
VkImage glight; // this frame: the light target among the G-buffer's targets (gbuf_light)
VkExecTarget glight_z; // that G-buffer's depth, the scene depth
VkImage light_z; // this frame: the D16 depth the lighting draws into the light target with
int fx_on; // dlaa_effects_after, read at each present while DLSS runs
int fx_seen, fx_open, fx_bad; // this frame: the point found / the scene not ended since / drawn on after it
uint32_t fx_steady; // DLSS frames in a row with the point found and nothing of the scene after it
// jitter (vk_dlaa_viewport)
VkImage jdepth; // the scene depth of the last frame DLAA ran on: passes drawing with it are jittered
float jx, jy; // the offset the next scene draws take, render pixels (window x right, y down)
@@ -1084,10 +1091,10 @@ static void evaluate(VkExec *ex, const VkExecTarget *dst) {
D.jdepth = z->image;
next_jitter(w, ow);
if (++D.evals == 1 || D.evals == 300 || D.evals % 3600 == 0) // 300: one early line with the frames counted
rt_log("dlaa: %llu frames anti-aliased (scene %ux%u, output %ux%u; %llu frames without the DLAA point, %llu with camera "
"motion, %llu with the characters' mask, %llu without a camera, %llu jitter holds; resets: %llu size, %llu "
"camera, %llu target; reactive mask %llu, without its copy %llu)",
(unsigned long long)D.evals, w, h, ow, oh, (unsigned long long)D.frames_missed,
rt_log("dlaa: %llu frames anti-aliased (scene %ux%u, output %ux%u; %llu before the effects, %llu frames without the "
"DLAA point, %llu with camera motion, %llu with the characters' mask, %llu without a camera, %llu jitter "
"holds; resets: %llu size, %llu camera, %llu target; reactive mask %llu, without its copy %llu)",
(unsigned long long)D.evals, w, h, ow, oh, (unsigned long long)D.fx_frames, (unsigned long long)D.frames_missed,
(unsigned long long)D.mv_frames, (unsigned long long)D.masked, (unsigned long long)D.mv_none,
(unsigned long long)D.holds, (unsigned long long)D.why[0], (unsigned long long)D.why[1],
(unsigned long long)D.why[2], (unsigned long long)R.made, (unsigned long long)R.missed);
@@ -1127,8 +1134,73 @@ static int bloom_start(const VkExec *ex, uint32_t scene_w) {
return a * 20 >= b * 19 && b * 20 >= a * 19;
}
// The light target is one of the G-buffer's targets (the emissive surfaces go into it there), the only one of a scene
// colour format and the depth's size. NULL when that is not so.
static void gbuf_light(const VkExec *ex) {
const VkExecTarget *z = &ex->depth, *l = NULL;
for (uint32_t i = 0; i < ex->pass_ncolor && i < 8; i++) {
const VkExecTarget *t = &ex->color[i];
if (!t->image || !scene_color(t->format) || t->width != z->width || t->height != z->height || t->level ||
t->samples > 1 || t->is3d)
continue;
if (l) return (void)(D.glight = VK_NULL_HANDLE);
l = t;
}
D.glight = l ? l->image : VK_NULL_HANDLE, D.glight_z = *z, D.light_z = VK_NULL_HANDLE;
}
// DLAA (the scene as wide as the output) runs on the solid scene alone, before the effects. Measured in a shrine and
// in the yard of Lookout Landing (3840x2160, frame dumps and a log of the passes into the light target): after the
// G-buffer the deferred lighting draws into the light target with a D16 depth of its own, and from there on every draw
// into the light target blends: in the shrine a fog layer with the scene depth, the volumetric fog drawn at half size
// and blended over the whole picture by a full-screen draw without depth (79 % of the pixels change), and the dust with
// the scene depth (dots of 1-3 pixels and soft discs); in the yard the field's effects composite without depth, then
// the particles with the scene depth; with an ability's targeting view open, the highlight of the objects it can take,
// with a D16 depth of its own, another one than the lighting's. Run at the bloom, DLSS took the dust and the fog in
// with the motion of the walls behind them and no jitter of their own, and wiped out the smallest motes. So the first
// pass into the light target after the lighting runs DLSS before it, and the effects are drawn over its picture without
// jitter, as the game draws them without DLSS. The lighting is the first pass into the light target with a D16 depth
// after the G-buffer, and its depth tells the lighting from the effects: the order of the effects changes from frame
// to frame (the yard's half-size effects pass is there in some frames only; the ability highlight comes before the
// fog layer in some frames and after it in others), and every rule that waited for one of them, or took any D16 pass
// for the lighting, ran DLSS before some effects in one frame and after them in the next, and the picture flickered.
// The point is also taken only where it held for FX_STEADY frames in a row with nothing of the scene drawn after it
// (fx_watch: a G-buffer pass, or the lighting's depth into the light target again, up to the bloom): a frame that
// breaks it puts DLSS back at the bloom until it holds again, so a frame the rule does not fit changes the picture at
// most once a second instead of from frame to frame.
// dlaa_effects_after = 0 (the Screen tab, read each frame): DLSS at the bloom, effects included.
#define FX_STEADY 60u
static int effects_point(const VkExec *ex) {
const VkExecTarget *c = &ex->color[0], *z = &ex->depth;
if (!D.fx_on || D.fx_bad || !D.glight || D.ended || ex->pass_ncolor != 1 || c->image != D.glight || c->level) return 0;
if (!D.light_z) {
if (z->image && z->format == VK_FORMAT_D16_UNORM) D.light_z = z->image;
return 0;
}
if (z->image == D.light_z) return 0;
unsigned o[2], s[2];
res_sizes(o, s);
if (c->width < o[0] || !scene_shaped(c) || !scene_large(c)) return 0;
D.fx_seen = D.fx_open = 1;
return D.fx_steady >= FX_STEADY;
}
static void fx_watch(const VkExec *ex) {
const VkExecTarget *z = &ex->depth;
if (bloom_start(ex, D.glight_z.width)) {
D.fx_open = 0;
return;
}
int light = 0;
for (uint32_t i = 0; i < ex->pass_ncolor && i < 8; i++) light |= ex->color[i].image == D.glight;
int geometry = ex->pass_ncolor >= 3 && z->image && z->format == VK_FORMAT_D32_SFLOAT && z->width >= D.gbuf_w;
if (geometry || (light && z->image && z->image == D.light_z)) D.fx_seen = D.fx_open = 0, D.fx_bad = 1;
}
int vk_dlaa_plan(const VkExec *ex, VkExecJob *j) {
const VkExecTarget *c = &ex->color[0], *z = &ex->depth;
if (D.fx_open && dl_active()) fx_watch(ex);
if (!dl_active() || D.done) return 0;
// The G-buffer: several colour targets with a D32F depth of at least DLAA_SCENE_MIN_W wide. Only the light target drawn after it
// arms the frame; at night the game draws into the light target alone with the scene depth before the G-buffer too,
@@ -1141,8 +1213,17 @@ int vk_dlaa_plan(const VkExec *ex, VkExecJob *j) {
if (c->image && c->format == VK_FORMAT_R8G8B8A8_UNORM && c->width == z->width && c->height == z->height &&
c->samples <= 1 && !c->is3d && (!D.ids_ok || c->width >= D.ids.width))
D.ids = *c, D.ids_ok = 1;
if (z->width >= D.gbuf_w) gbuf_light(ex);
return 0;
}
if (effects_point(ex)) {
D.color = *c, D.depth = D.glight_z, D.armed = 1;
D.end_fence = ex->fence, D.end_pos = ex->pos;
__atomic_store_n(&D.ended, 1, __ATOMIC_RELEASE);
D.done = 1, D.fx_frames++;
*j = (VkExecJob){.kind = VK_JOB_DLSS}; // DLAA in place
return 1;
}
// A pass into one scene colour target of the G-buffer's size or larger without depth while nothing is armed ends
// the scene once the bloom chain follows with still nothing armed: in the inventory (1.4.3) the preview's light
// target is drawn that way before the bloom, and with the scene depth only after it, while the menu is composed;
@@ -1272,16 +1353,21 @@ void vk_dlaa_frame(void) {
D.on = on;
// either way the next DLAA frame starts a new history from an unjittered frame
D.reset = 1, D.cam_prev_ok = 0, D.jit_ok = D.jit_used = D.armed = D.done = D.gbuf = D.ended = D.up = 0;
D.nodepth = VK_NULL_HANDLE;
D.fx_seen = D.fx_open = D.fx_bad = 0, D.fx_steady = 0;
D.nodepth = D.glight = D.light_z = VK_NULL_HANDLE;
D.hold = 0;
return;
}
if (!dl_active()) return;
D.fx_on = cfg_bool("TOTK_DLAA_EFFECTS_AFTER");
if (!D.done) D.frames_missed++;
else D.fx_steady = D.fx_seen ? D.fx_steady + (D.fx_steady < FX_STEADY) : 0;
D.fx_seen = D.fx_open = D.fx_bad = 0;
if (D.jit_used && !D.done) D.hold = 60, D.holds++; // jittered but not resolved: that frame shook
else if (D.hold) D.hold--;
if (!D.done) D.jit_ok = 0;
D.armed = D.done = D.jit_used = D.gbuf = D.ended = D.up = D.ids_ok = 0, D.nodepth = VK_NULL_HANDLE;
D.armed = D.done = D.jit_used = D.gbuf = D.ended = D.up = D.ids_ok = 0;
D.nodepth = D.glight = D.light_z = VK_NULL_HANDLE;
D.cam_addr = 0;
}