diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index d33fee27..01cae30e 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -62,6 +62,8 @@ int wide_available(void); const char *const *vk_color_preset(const char *name); int vk_hdr_wanted(void); int vk_hdr_active(void); +int vk_dlaa_needs_restart(void); +int vk_dlssg_wanted(void); double frame_step_limit_hz(void); int frame_limit_adjustable(void); int rtss_limit_state(void); @@ -828,10 +830,9 @@ static void row_upscaling(void) { int cur = 0; for (int i = 0; i < n; i++) if (list[i].kind == now.kind && list[i].mode == now.mode) cur = i; - bool temporal = now.kind >= DLSS; int nv = opt_choice_index("NX2NAVI_UPSCALER", UI_MENU_UPSCALING, names, n, cur, 1, dlss ? UI_MENU_UPSCALING_DESC : UI_MENU_UPSCALING_DESC_FSR, - temporal && dlss ? menu_text(UI_MENU_UPSCALING_DLSS_NOTE) : nullptr); + dlss && vk_dlaa_needs_restart() ? menu_text(UI_MENU_AFTER_RESTART) : nullptr); if (nv < 0 || nv >= n) return; const Entry e = list[nv]; opt_apply("NX2NAVI_UPSCALER", e.kind == FSR1 ? "fsr" : "bilinear"); @@ -842,10 +843,9 @@ static void row_upscaling(void) { } // "in use: off" under the HDR value when the game started with HDR on but the swapchain is not HDR10 (the display or -// Windows' HDR switch is off, vk_hdr_surface_format); else the restart note. +// Windows' HDR switch is off, vk_hdr_surface_format). The row's "after restart" comes from the setting itself (cfg.c). static const char *hdr_note(void) { - const char *restart = menu_text(UI_MENU_HDR_NOTE); - if (!vk_hdr_wanted() || vk_hdr_active() || !*gfx_window_present_mode() || !cfg_bool("NX2NAVI_HDR")) return restart; + if (!vk_hdr_wanted() || vk_hdr_active() || !*gfx_window_present_mode() || !cfg_bool("NX2NAVI_HDR")) return nullptr; static char note[96]; snprintf(note, sizeof note, menu_text(UI_MENU_PRESENT_IN_USE), menu_text(UI_MENU_FRAMEGEN_OFF)); return note; @@ -877,9 +877,11 @@ static void row_framegen(void) { // NVIDIA DLSS (vk_dlssg.c, through Streamline and nx2navi_dlssg.dll) is listed on NVIDIA GPUs now that Reflex paces it // from the frame's start and generated frames are presented; elsewhere only while it is set int n = dlss || cur == 2 ? 3 : 2; + // AMD's follows the setting; NVIDIA's is set up with the device, so only a change to or from it waits for a restart + const bool restart = dlss && (cur == 2) != (vk_dlssg_wanted() != 0); int nv = opt_choice_index("NX2NAVI_FRAMEGEN", UI_MENU_FRAMEGEN, names, n, cur, 0, dlss ? UI_MENU_FRAMEGEN_DESC : UI_MENU_FRAMEGEN_DESC_FSR, - menu_text(dlss ? UI_MENU_FRAMEGEN_NOTE : UI_MENU_FRAMEGEN_NOTE_FSR)); + menu_text(restart ? UI_MENU_AFTER_RESTART : dlss ? UI_MENU_FRAMEGEN_NOTE : UI_MENU_FRAMEGEN_NOTE_FSR)); if (nv >= 0 && nv < n) opt_apply("NX2NAVI_FRAMEGEN", values[nv]); } @@ -1516,8 +1518,8 @@ extern "C" void menu_boot_set(int phase, long long done, long long total) { g_boot_phase.store(phase, std::memory_order_release); } -// A box in the middle of the screen in the menu's look (ui/menu_skin.cpp skin_boot_panel): the title, the step with its -// count and a bar, and why it happens. The input queue is left alone: keys pressed now reach the menu once the game runs. +// A box in the middle of the screen in the menu's look (ui/menu_skin.cpp skin_boot_panel): the title and the step with +// its count and a bar. The input queue is left alone: keys pressed now reach the menu once the game runs. extern "C" int menu_boot_frame(const MenuTarget *t) { if (g_failed_flag() || g_boot_phase.load(std::memory_order_acquire) < 0) return 0; // -1: done, a black frame if (!g_ctx_ok) make_context(); @@ -1550,7 +1552,7 @@ extern "C" int menu_boot_frame(const MenuTarget *t) { snprintf(step, sizeof step, ui_text(phase == 1 ? UI_BOOT_SHADERS : UI_BOOT_PIPELINES), done, total); else snprintf(step, sizeof step, "%s", ui_text(UI_BOOT_STARTING)); - const char *title = ui_text(UI_BOOT_TITLE), *hint = ui_text(UI_BOOT_HINT); + const char *title = ui_text(UI_BOOT_TITLE); // the box in the menu's look (ui/menu_skin.cpp): a filled bar while there is a count, else a sweeping segment ImFont *body = ImGui::GetFont(); @@ -1560,7 +1562,7 @@ extern "C" int menu_boot_frame(const MenuTarget *t) { float frac = -1; if ((phase == 1 || phase == 2) && total > 0) frac = done <= 0 ? 0 : done >= total ? 1 : (float)done / (float)total; float s = (float)fmod((now - g_boot_t0) / 1e9 * 0.8, 2.0); - skin_boot_panel(ImGui::GetForegroundDrawList(), head, head_px, body, body_px, title, step, hint, frac, s < 1 ? s : 2 - s, + skin_boot_panel(ImGui::GetForegroundDrawList(), head, head_px, body, body_px, title, step, frac, s < 1 ? s : 2 - s, (float)t->width, (float)t->height, scale); ImGui::Render(); return ImGui::GetDrawData()->TotalVtxCount > 0; diff --git a/runtime/ui/menu_skin.cpp b/runtime/ui/menu_skin.cpp index c0f2bec2..e1bbabb4 100644 --- a/runtime/ui/menu_skin.cpp +++ b/runtime/ui/menu_skin.cpp @@ -461,12 +461,11 @@ bool skin_tab_item(const char *id, const char *text, int flags, float s, ImFont } void skin_boot_panel(ImDrawList *dl, ImFont *head, float head_px, ImFont *body, float body_px, const char *title, - const char *step, const char *hint, float frac, float sweep, float w, float h, float s) { + const char *step, float frac, float sweep, float w, float h, float s) { const float pad = 38 * s, gap = 16 * s, bar_h = 12 * s, fh = skin_filigree_height(s); - ImVec2 ts = head->CalcTextSizeA(head_px, FLT_MAX, 0, title), ss = body->CalcTextSizeA(body_px, FLT_MAX, 0, step), - hs = body->CalcTextSizeA(body_px * 0.8f, FLT_MAX, 0, hint); - float pw = fminf(fmaxf(fmaxf(fmaxf(ts.x, hs.x), ss.x), 560 * s) + pad * 2, w - 24 * s); - float ph = pad + ts.y + fh + gap * 0.4f + ss.y + gap * 0.7f + bar_h + gap * 1.4f + hs.y + pad; + ImVec2 ts = head->CalcTextSizeA(head_px, FLT_MAX, 0, title), ss = body->CalcTextSizeA(body_px, FLT_MAX, 0, step); + float pw = fminf(fmaxf(fmaxf(ts.x, ss.x), 560 * s) + pad * 2, w - 24 * s); + float ph = pad + ts.y + fh + gap * 0.4f + ss.y + gap * 0.7f + bar_h + pad; ImVec2 a(floorf((w - pw) / 2), floorf((h - ph) / 2)), b(a.x + pw, a.y + ph); skin_panel(dl, a, b, s); float y = a.y + pad; @@ -493,6 +492,4 @@ void skin_boot_panel(ImDrawList *dl, ImFont *head, float head_px, ImFont *body, fill(x0 + run * at, x0 + run * at + span); } dl->AddRect(ba, bb, rgba(110, 90, 58, 1), 2 * s, 0, 1.3f * s); - y += bar_h + gap * 1.4f; - dl->AddText(body, body_px * 0.8f, ImVec2(floorf((w - hs.x) / 2), y), rgba(214, 198, 166, 0.85f), hint); } diff --git a/runtime/ui/menu_skin.h b/runtime/ui/menu_skin.h index ea45397c..95e28581 100644 --- a/runtime/ui/menu_skin.h +++ b/runtime/ui/menu_skin.h @@ -41,9 +41,9 @@ void skin_panel(ImDrawList *dl, ImVec2 a, ImVec2 b, float s, float alpha = 1); // The boot screen's box (menu.cpp menu_boot_frame) centred in a w x h frame: the panel, the title in gold over the // divider, the step's line, a bar filled to frac (0..1; a negative frac: a short segment sweeping at position sweep -// 0..1, no count yet) and the hint under it. +// 0..1, no count yet). void skin_boot_panel(ImDrawList *dl, ImFont *head, float head_px, ImFont *body, float body_px, const char *title, - const char *step, const char *hint, float frac, float sweep, float w, float h, float s); + const char *step, float frac, float sweep, float w, float h, float s); // A button widget drawn as skin_button with its label centred and skin_cursor round it while selected or hovered (the // save menu's Load and Cancel). True when pressed (click, A, Enter). size: as for ImGui::Button. diff --git a/runtime/ui_text.c b/runtime/ui_text.c index b592e2e7..931b8769 100644 --- a/runtime/ui_text.c +++ b/runtime/ui_text.c @@ -481,18 +481,16 @@ static const char *const text_en[UI_TEXT_COUNT] = { "now.", [UI_MENU_CHEAT_UNSUPPORTED] = "not supported", [UI_MENU_CHEAT_UNSUPPORTED_DESC] = "This cheat cannot be used with this version of the game:", - [UI_BOOT_TITLE] = "Preparing shaders", [UI_BOOT_HINT] = "This happens once after an update or a graphics driver change.", + [UI_BOOT_TITLE] = "Preparing shaders", [UI_BOOT_STARTING] = "Starting", [UI_BOOT_SHADERS] = "Shaders: %lld of %lld", [UI_BOOT_PIPELINES] = "Pipelines: %lld of %lld", [UI_MENU_UPSCALING] = "Upscaling", [UI_MENU_UPSCALING_DESC] = "How the picture is smoothed and scaled to your window.", - [UI_MENU_UPSCALING_DLSS_NOTE] = "DLSS on or off: after restart", [UI_MENU_UPSCALING_DESC_FSR] = "How the picture is smoothed and scaled to your window.", [UI_MENU_FRAMEGEN] = "Frame generation", [UI_MENU_FRAMEGEN_DESC] = "Adds generated frames for smoother motion. Needs DLSS or FSR 3.1.", [UI_MENU_FRAMEGEN_OFF] = "Off", - [UI_MENU_HDR_NOTE] = "after restart", [UI_MENU_HDR_ENHANCED] = "Enhanced", [UI_MENU_HDR_NATIVE] = "Native (the game's)", - [UI_MENU_FRAMEGEN_NOTE] = "after restart; needs DLSS or FSR 3.1", + [UI_MENU_FRAMEGEN_NOTE] = "needs DLSS or FSR 3.1", [UI_MENU_FRAMEGEN_NEEDS] = "choose a DLSS or FSR 3.1 mode under Upscaling first", [UI_MENU_FRAMEGEN_NEEDS_FSR] = "choose an FSR 3.1 mode under Upscaling first", [UI_MENU_FRAMEGEN_NOTE_FSR] = "needs FSR 3.1", @@ -958,7 +956,7 @@ static const char *const text_ru[UI_TEXT_COUNT] = { "его при следующем запуске (несколько минут), или нажмите «Пересобрать игру сейчас».", [UI_MENU_CHEAT_UNSUPPORTED] = "не поддерживается", [UI_MENU_CHEAT_UNSUPPORTED_DESC] = "Этот чит нельзя использовать с этой версией игры:", - [UI_BOOT_TITLE] = "Подготовка шейдеров", [UI_BOOT_HINT] = "Это происходит один раз после обновления или смены видеодрайвера.", + [UI_BOOT_TITLE] = "Подготовка шейдеров", [UI_BOOT_STARTING] = "Запуск", [UI_BOOT_SHADERS] = "Шейдеры: %lld из %lld", [UI_BOOT_PIPELINES] = "Конвейеры: %lld из %lld", [UI_MENU_CHEATS_REBUILD] = "Пересобрать игру сейчас", [UI_MENU_CHEATS_REBUILD_DESC] = "Некоторые читы меняют код игры и ещё не собраны в неё: они новые или изменены, " @@ -1438,7 +1436,7 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = { "Recompilar o jogo agora.", [UI_MENU_CHEAT_UNSUPPORTED] = "não suportado", [UI_MENU_CHEAT_UNSUPPORTED_DESC] = "Este cheat não pode ser usado com esta versão do jogo:", - [UI_BOOT_TITLE] = "Preparando shaders", [UI_BOOT_HINT] = "Isso acontece uma vez após uma atualização ou troca do driver de vídeo.", + [UI_BOOT_TITLE] = "Preparando shaders", [UI_BOOT_STARTING] = "Iniciando", [UI_BOOT_SHADERS] = "Shaders: %lld de %lld", [UI_BOOT_PIPELINES] = "Pipelines: %lld de %lld", [UI_MENU_CHEATS_REBUILD] = "Recompilar o jogo agora", [UI_MENU_CHEATS_REBUILD_DESC] = "Alguns cheats alteram o código do jogo e ainda não foram compilados nele: são " @@ -2018,7 +2016,7 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = { [UI_MENU_CHEAT_REBUILD_DESC] = "此金手指修改游戏代码,并且是在游戏构建后新增或修改的。游戏会在下次启动时把它构建进去(几分钟),也可以使用“立即重新构建游戏”。", [UI_MENU_CHEAT_UNSUPPORTED] = "不支持", [UI_MENU_CHEAT_UNSUPPORTED_DESC] = "此金手指不能用于此游戏版本:", - [UI_BOOT_TITLE] = "正在准备着色器", [UI_BOOT_HINT] = "仅在更新或更换显卡驱动后进行一次。", + [UI_BOOT_TITLE] = "正在准备着色器", [UI_BOOT_STARTING] = "正在启动", [UI_BOOT_SHADERS] = "着色器:%lld / %lld", [UI_BOOT_PIPELINES] = "管线:%lld / %lld", [UI_MENU_CHEATS_REBUILD] = "立即重新构建游戏", [UI_MENU_CHEATS_REBUILD_DESC] = "有些金手指会修改游戏代码,但尚未构建进游戏:它们是新增或修改的,或上次重新构建失败或被取消。将关闭游戏;安装程序会把它们构建进去(几分钟)并重新启动游戏。上次存档之后的进度会丢失。", diff --git a/runtime/ui_text.h b/runtime/ui_text.h index 6ed33776..e480011b 100644 --- a/runtime/ui_text.h +++ b/runtime/ui_text.h @@ -239,12 +239,12 @@ typedef enum { UI_MENU_CHEAT_REBUILD, UI_MENU_CHEAT_REBUILD_DESC, UI_MENU_CHEAT_UNSUPPORTED, UI_MENU_CHEAT_UNSUPPORTED_DESC, UI_MENU_LAST_ID = UI_MENU_CHEAT_UNSUPPORTED_DESC, // the boot screen while the boot prewarm prepares shaders and pipelines (boot.c, ui/menu.cpp menu_boot_frame) - UI_BOOT_TITLE, UI_BOOT_HINT, UI_BOOT_STARTING, + UI_BOOT_TITLE, UI_BOOT_STARTING, UI_BOOT_SHADERS, UI_BOOT_PIPELINES, // printf: "%lld" done, "%lld" total // the settings menu's Picture rows for this game (ui/menu.cpp tab_screen): one upscaling choice (bilinear, FSR 1 // or a DLSS mode) and the picture's resolution - UI_MENU_UPSCALING, UI_MENU_UPSCALING_DESC, UI_MENU_UPSCALING_DLSS_NOTE, UI_MENU_FRAMEGEN, UI_MENU_FRAMEGEN_DESC, - UI_MENU_FRAMEGEN_OFF, UI_MENU_FRAMEGEN_NOTE, UI_MENU_FRAMEGEN_NEEDS, UI_MENU_HDR_NOTE, UI_MENU_HDR_ENHANCED, UI_MENU_HDR_NATIVE, + UI_MENU_UPSCALING, UI_MENU_UPSCALING_DESC, UI_MENU_FRAMEGEN, UI_MENU_FRAMEGEN_DESC, + UI_MENU_FRAMEGEN_OFF, UI_MENU_FRAMEGEN_NOTE, UI_MENU_FRAMEGEN_NEEDS, UI_MENU_HDR_ENHANCED, UI_MENU_HDR_NATIVE, UI_MENU_GAME_RES, UI_MENU_GAME_RES_DESC, UI_MENU_GAME_RES_NATIVE, // the same rows' texts on a GPU DLSS does not run on (not NVIDIA): the menu leaves DLSS out there UI_MENU_UPSCALING_DESC_FSR, UI_MENU_FRAMEGEN_DESC_FSR, UI_MENU_FRAMEGEN_NOTE_FSR, diff --git a/runtime/vk_dlaa.c b/runtime/vk_dlaa.c index b0e8d26a..78dc773a 100644 --- a/runtime/vk_dlaa.c +++ b/runtime/vk_dlaa.c @@ -120,6 +120,13 @@ int vk_dlaa_wanted(void) { static int fsr3(void) { return !N.ngx_up && !strcmp(cfg_value("NX2NAVI_TAA"), "fsr3"); } int vk_dlaa_fsr3(void) { return vk_dlaa_wanted() && fsr3(); } +// The upscaler the menu has set cannot start in this run: DLSS when NGX was never tried (a device made without its +// extensions), FSR 3.1 while NGX is up and serves the run. A DLSS this PC could not bring up is not waiting for a restart. +int vk_dlaa_needs_restart(void) { + if (!cfg_bool("NX2NAVI_DLAA")) return 0; + return strcmp(cfg_value("NX2NAVI_TAA"), "fsr3") ? !N.ngx_up && !N.tried : N.ngx_up; +} + static int core_load(void) { if (N.tried) return N.loaded; N.tried = 1; diff --git a/runtime/vk_dlaa.h b/runtime/vk_dlaa.h index 879beda6..b225190b 100644 --- a/runtime/vk_dlaa.h +++ b/runtime/vk_dlaa.h @@ -9,6 +9,7 @@ int vk_dlaa_wanted(void); // the setting is on (the device may still lack DLSS) int vk_dlaa_fsr3(void); +int vk_dlaa_needs_restart(void); // the menu's upscaler cannot start in this run // Frame generation (vk_fg.cpp): the depth and motion vectors of the frame DLSS or FSR 3.1 last ran on, with its jitter // and whether its history reset; 1 once per evaluation (0: none since the last call). The images stay valid until the // next frame's scene draws over them, after this present. diff --git a/runtime/widescreen.c b/runtime/widescreen.c index 04e61bb6..077340ae 100644 --- a/runtime/widescreen.c +++ b/runtime/widescreen.c @@ -79,10 +79,9 @@ static unsigned picture_height(void) { // picks. The share is written to +240 at every change of the setting (the menu switches the mode live); the set goes on // RES_FIXED_AFTER presents after the first, once the controller has filled the fields the fixed path keeps. #define RES_FIXED_AFTER 120 -// The share follows the upscaler that runs, not the setting: DLSS and FSR 3.1 start only after a restart -// (vk_dlaa_wanted is read once) and DLSS only where NGX came up (vk_dlaa_available), so a mode picked in the menu, or one -// this PC cannot run, no longer shrinks the scene with nothing to scale it back up. A mode change while one runs still -// applies at once. +// The share follows the upscaler that runs, not the setting: DLSS starts only after a restart and only where NGX came up +// (vk_dlaa_available), so a mode picked in the menu, or one this PC cannot run, no longer shrinks the scene with nothing +// to scale it back up. FSR 3.1 and a mode change while one runs apply at once. // dlaa switched off in the menu stops DLSS at once (vk_dlaa.c vk_dlaa_frame reads it each frame), so the share follows // the setting too: the scene goes back to the game's own scale instead of staying small with nothing to enlarge it. static double dlss_share(void) { diff --git a/tools/menu_preview.cpp b/tools/menu_preview.cpp index 1acbab78..c477afdd 100644 --- a/tools/menu_preview.cpp +++ b/tools/menu_preview.cpp @@ -275,7 +275,7 @@ static void scene_boot(float w, float h, float scale, ImFont *title) { char step[160]; snprintf(step, sizeof step, ui_text(UI_BOOT_PIPELINES), 1603LL, 3235LL); skin_boot_panel(ImGui::GetForegroundDrawList(), title, title->FontSize, ImGui::GetFont(), ImGui::GetFontSize(), - ui_text(UI_BOOT_TITLE), step, ui_text(UI_BOOT_HINT), 1603.0f / 3235.0f, 0, w, h, scale); + ui_text(UI_BOOT_TITLE), step, 1603.0f / 3235.0f, 0, w, h, scale); } // ---- the rasteriser: every triangle of the draw lists, its colour times the font atlas, blended over the image