From f18b051040f7381c515c67c6f3d1bd063868b821 Mon Sep 17 00:00:00 2001 From: VictorSCosta Date: Fri, 6 Nov 2026 19:57:02 -0300 Subject: [PATCH] Show the temporal upscaler in the performance overlay. The overlay's picture lines named the scene size and the present's scaling but not DLSS or FSR. An Upscaler line after the 3D scene now shows the backend that ran (vk_dlaa_name: FSR with its version, or DLSS) and the DLSS mode, or none while DLAA is off. Co-Authored-By: Claude Opus 5.5 --- runtime/ui/menu.cpp | 26 +++++++++++++++++++------- runtime/ui_text.c | 7 ++++--- runtime/ui_text.h | 2 +- runtime/vk_dlaa.c | 11 +++++++++++ runtime/vk_dlaa.h | 1 + 5 files changed, 36 insertions(+), 11 deletions(-) diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index fe2bcd2e..b318c3b6 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -52,6 +52,7 @@ void rt_log(const char *fmt, ...) __attribute__((format(printf, 1, 2))); void vk_queue_lock(void); void vk_queue_unlock(void); void res_sizes(unsigned out[2], unsigned scene[2]); +const char *vk_dlaa_name(void); // vk_dlaa.h double frame_step_limit_hz(void); extern const int rt_game_version; extern const char rt_port_version[]; @@ -1360,16 +1361,26 @@ static void perf_label(UiTextId label, const ImVec4 &c) { static float perf_gb(float mb) { return mb < 0 ? -1 : mb / 1024; } -// The picture lines: the window, the game image the present shows and the 3D scene it holds (resolution.c), how the -// present scales the image to the window (gfx_present.c, the last present), the frame limit and the presentation mode -// in use. +// The DLSS mode's name as the menu shows it, for the upscaler line. +static UiTextId dlss_mode_text(const char *m) { + return !strcmp(m, "quality") ? UI_MENU_DLSS_QUALITY : !strcmp(m, "balanced") ? UI_MENU_DLSS_BALANCED + : !strcmp(m, "performance") ? UI_MENU_DLSS_PERFORMANCE : !strcmp(m, "ultra_performance") ? UI_MENU_DLSS_ULTRA + : UI_MENU_DLSS_DLAA; +} + +// The picture lines: the window, the game image the present shows and the 3D scene it holds (resolution.c), the +// temporal upscaler that scales the scene (vk_dlaa.c, DLSS or FSR, with its mode), how the present scales the image to +// the window (gfx_present.c, the last present), the frame limit and the presentation mode in use. static void perf_picture(const MenuTarget *t, const ImVec4 &c) { unsigned out[2], scene[2]; res_sizes(out, scene); - char v[6][64]; + char v[7][64]; snprintf(v[0], sizeof v[0], menu_text(UI_MENU_OV_FMT_SIZE), t->width, t->height); snprintf(v[1], sizeof v[1], menu_text(UI_MENU_OV_FMT_SIZE), (unsigned)t->image_w, (unsigned)t->image_h); snprintf(v[2], sizeof v[2], menu_text(UI_MENU_OV_FMT_SCENE), scene[0], scene[1], scene[0] * 100.0 / out[0]); + const char *up = vk_dlaa_name(); + if (up) snprintf(v[6], sizeof v[6], "%s, %s", up, menu_text(dlss_mode_text(cfg_value("TOTK_DLSS")))); + else snprintf(v[6], sizeof v[6], "%s", menu_text(UI_MENU_OV_NONE)); if (t->scaler == 2) { int s = cfg_int("TOTK_SHARPNESS"); snprintf(v[3], sizeof v[3], menu_text(UI_MENU_OV_FMT_FSR), s < 0 ? 0 : s > 100 ? 100 : s); @@ -1385,17 +1396,18 @@ static void perf_picture(const MenuTarget *t, const ImVec4 &c) { if (hz > 0) snprintf(v[4], sizeof v[4], menu_text(UI_MENU_OV_FPS), hz); const char *pm = present_name(gfx_window_present_mode()); snprintf(v[5], sizeof v[5], "%s", pm ? pm : menu_text(UI_MENU_OV_NONE)); - static const UiTextId labels[6] = {UI_MENU_OV_WINDOW, UI_MENU_OV_OUTPUT, UI_MENU_OV_SCENE, + static const UiTextId labels[7] = {UI_MENU_OV_WINDOW, UI_MENU_OV_OUTPUT, UI_MENU_OV_SCENE, UI_MENU_OV_UPSCALER, UI_MENU_OV_SCALING, UI_MENU_OV_LIMIT, UI_MENU_OV_PRESENT}; + static const int order[7] = {0, 1, 2, 6, 3, 4, 5}; // the upscaler line after the scene it scales if (!ImGui::BeginTable("##perfp", 2, ImGuiTableFlags_SizingFixedFit)) return; float vw = 0; for (auto &s : v) vw = fmaxf(vw, ImGui::CalcTextSize(s).x); ImGui::TableSetupColumn("##p0", ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("##p1", ImGuiTableColumnFlags_WidthFixed, vw); - for (int i = 0; i < 6; i++) { + for (int i = 0; i < 7; i++) { perf_label(labels[i], c); ImGui::TableNextColumn(); - perf_right(v[i], false); + perf_right(v[order[i]], !up && order[i] == 6); } ImGui::EndTable(); } diff --git a/runtime/ui_text.c b/runtime/ui_text.c index 8ef51cba..26c41d76 100644 --- a/runtime/ui_text.c +++ b/runtime/ui_text.c @@ -476,7 +476,7 @@ static const char *const text_en[UI_TEXT_COUNT] = { [UI_MENU_OV_FMT_MHZ] = "%.0f MHz", [UI_MENU_OV_FMT_GB] = "%.1f GB", [UI_MENU_OV_FMT_GB_OF] = "/ %.1f GB", [UI_MENU_OV_GAME_GB] = "game %.1f GB", [UI_MENU_OV_FMT_MS] = "%.2f ms", [UI_MENU_OV_PER_FRAME] = "%.1f per frame", [UI_MENU_OV_WINDOW] = "Window", [UI_MENU_OV_OUTPUT] = "Game image", [UI_MENU_OV_SCENE] = "3D scene", - [UI_MENU_OV_SCALING] = "Scaling", [UI_MENU_OV_LIMIT] = "Frame limit", [UI_MENU_OV_PRESENT] = "Presentation", + [UI_MENU_OV_UPSCALER] = "Upscaler", [UI_MENU_OV_SCALING] = "Scaling", [UI_MENU_OV_LIMIT] = "Frame limit", [UI_MENU_OV_PRESENT] = "Presentation", [UI_MENU_OV_FMT_SIZE] = "%ux%u", [UI_MENU_OV_FMT_SCENE] = "%ux%u, %.0f%%", [UI_MENU_OV_FMT_FSR] = "AMD FSR 1, sharpness %d%%", [UI_MENU_OV_SCALE_NONE] = "none (1:1)", [UI_MENU_OV_SCALE_BILINEAR] = "bilinear", @@ -960,7 +960,7 @@ static const char *const text_ru[UI_TEXT_COUNT] = { [UI_MENU_OV_FMT_MHZ] = "%.0f МГц", [UI_MENU_OV_FMT_GB] = "%.1f ГБ", [UI_MENU_OV_FMT_GB_OF] = "/ %.1f ГБ", [UI_MENU_OV_GAME_GB] = "игра %.1f ГБ", [UI_MENU_OV_FMT_MS] = "%.2f мс", [UI_MENU_OV_PER_FRAME] = "%.1f за кадр", [UI_MENU_OV_WINDOW] = "Окно", [UI_MENU_OV_OUTPUT] = "Изображение игры", [UI_MENU_OV_SCENE] = "3D-сцена", - [UI_MENU_OV_SCALING] = "Масштабирование", [UI_MENU_OV_LIMIT] = "Лимит кадров", [UI_MENU_OV_PRESENT] = "Вывод кадров", + [UI_MENU_OV_UPSCALER] = "Апскейлер", [UI_MENU_OV_SCALING] = "Масштабирование", [UI_MENU_OV_LIMIT] = "Лимит кадров", [UI_MENU_OV_PRESENT] = "Вывод кадров", [UI_MENU_OV_FMT_SIZE] = "%ux%u", [UI_MENU_OV_FMT_SCENE] = "%ux%u, %.0f%%", [UI_MENU_OV_FMT_FSR] = "AMD FSR 1, резкость %d%%", [UI_MENU_OV_SCALE_NONE] = "нет (1:1)", [UI_MENU_OV_SCALE_BILINEAR] = "билинейное", @@ -1330,7 +1330,7 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = { [UI_MENU_OV_FMT_MHZ] = "%.0f MHz", [UI_MENU_OV_FMT_GB] = "%.1f GB", [UI_MENU_OV_FMT_GB_OF] = "/ %.1f GB", [UI_MENU_OV_GAME_GB] = "jogo %.1f GB", [UI_MENU_OV_FMT_MS] = "%.2f ms", [UI_MENU_OV_PER_FRAME] = "%.1f por quadro", [UI_MENU_OV_WINDOW] = "Janela", [UI_MENU_OV_OUTPUT] = "Imagem do jogo", [UI_MENU_OV_SCENE] = "Cena 3D", - [UI_MENU_OV_SCALING] = "Escala", [UI_MENU_OV_LIMIT] = "Limite de quadros", [UI_MENU_OV_PRESENT] = "Apresentação", + [UI_MENU_OV_UPSCALER] = "Upscaler", [UI_MENU_OV_SCALING] = "Escala", [UI_MENU_OV_LIMIT] = "Limite de quadros", [UI_MENU_OV_PRESENT] = "Apresentação", [UI_MENU_OV_FMT_SIZE] = "%ux%u", [UI_MENU_OV_FMT_SCENE] = "%ux%u, %.0f%%", [UI_MENU_OV_FMT_FSR] = "AMD FSR 1, nitidez %d%%", [UI_MENU_OV_SCALE_NONE] = "nenhuma (1:1)", [UI_MENU_OV_SCALE_BILINEAR] = "bilinear", @@ -1983,6 +1983,7 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = { [UI_MENU_OV_WINDOW] = "窗口", [UI_MENU_OV_OUTPUT] = "游戏画面", [UI_MENU_OV_SCENE] = "3D 场景", + [UI_MENU_OV_UPSCALER] = "超分辨率", [UI_MENU_OV_SCALING] = "缩放", [UI_MENU_OV_LIMIT] = "帧率上限", [UI_MENU_OV_PRESENT] = "呈现模式", diff --git a/runtime/ui_text.h b/runtime/ui_text.h index dd4fe343..69f1dd21 100644 --- a/runtime/ui_text.h +++ b/runtime/ui_text.h @@ -225,7 +225,7 @@ typedef enum { UI_MENU_OV_FMT_PCT, UI_MENU_OV_FMT_TEMP, UI_MENU_OV_FMT_POWER, UI_MENU_OV_FMT_MHZ, UI_MENU_OV_FMT_GB, UI_MENU_OV_FMT_GB_OF, UI_MENU_OV_GAME_GB, UI_MENU_OV_FMT_MS, UI_MENU_OV_PER_FRAME, // the picture lines: window, game image and 3D scene sizes, the scaling to the window, frame limit and presentation - UI_MENU_OV_WINDOW, UI_MENU_OV_OUTPUT, UI_MENU_OV_SCENE, UI_MENU_OV_SCALING, UI_MENU_OV_LIMIT, UI_MENU_OV_PRESENT, + UI_MENU_OV_WINDOW, UI_MENU_OV_OUTPUT, UI_MENU_OV_SCENE, UI_MENU_OV_UPSCALER, UI_MENU_OV_SCALING, UI_MENU_OV_LIMIT, UI_MENU_OV_PRESENT, UI_MENU_OV_FMT_SIZE, // "%ux%u" UI_MENU_OV_FMT_SCENE, // "%ux%u, %.0f%%": the scene and its share of the game image's width UI_MENU_OV_FMT_FSR, // "AMD FSR 1, sharpness %d%%" diff --git a/runtime/vk_dlaa.c b/runtime/vk_dlaa.c index 35005c5b..b229e35f 100644 --- a/runtime/vk_dlaa.c +++ b/runtime/vk_dlaa.c @@ -291,6 +291,16 @@ static int be_available(void) { return fsr_backend() ? vk_ffx_available() : N.av int vk_dlaa_available(void) { return vk_dlaa_wanted() && be_available(); } +static int dl_active(void); +static uint64_t dl_evals(void); + +// The temporal upscaler at work, for the performance overlay (ui/menu.cpp perf_picture): "FSR 4.1.2" or "DLSS" once +// it has run, NULL while DLAA is off, failed or has not run yet. +const char *vk_dlaa_name(void) { + if (!dl_active() || !dl_evals()) return NULL; + return fsr_backend() ? vk_ffx_version() : "DLSS"; +} + // ---------------------------------------------------------------- where DLAA runs in TotK's frame // Measured (TOTK_DUMP, frame 2100 at Lookout Landing, 2560x1440 scene): the G-buffer passes draw into five targets with // the scene depth (d32f at the scene size), one of them the R11G11B10F light target; lighting and the transparents @@ -369,6 +379,7 @@ const VkTexImage *vk_dlaa_swap_img; VkImageView vk_dlaa_swap_view; static int dl_active(void) { return be_available() && !D.failed && D.on; } +static uint64_t dl_evals(void) { return D.evals; } static void dl_fail(const char *what, NgxResult r) { rt_log("dlaa: %s failed (%08x): DLAA off for this run", what, (unsigned)r); diff --git a/runtime/vk_dlaa.h b/runtime/vk_dlaa.h index 82b98113..fa492330 100644 --- a/runtime/vk_dlaa.h +++ b/runtime/vk_dlaa.h @@ -14,6 +14,7 @@ void vk_dlaa_device_exts(const VkExtensionProperties *have, uint32_t nhave, cons void vk_dlaa_init(void); // 1 when dlaa is on and NGX came up with DLSS (after vk_dlaa_init): a DLSS mode's smaller scene is scaled up by DLSS. int vk_dlaa_available(void); +const char *vk_dlaa_name(void); // "FSR 4.1.2" or "DLSS" once DLAA ran, NULL otherwise (the performance overlay) // vk_exec.c vk_exec_pass_begin, once the pass's targets are resolved and before its barrier: arms the frame on the // scene's light target or, at the first quarter-width pass after it, runs DLAA on that target. Each present ends the // frame (vk_dlaa_frame).