From 0b4fdac38dc6a92c5322b4ed922cecbf453a261d Mon Sep 17 00:00:00 2001 From: Tobim6 <102646588+Tobim6@users.noreply.github.com> Date: Thu, 12 Nov 2026 16:22:57 +0100 Subject: [PATCH] Defaults from the RX 580 runs: asynchronous replay, mesh emulation, mirror_hot 25, freeze_idle 1200, native zstd, game code at -O2; freeze and zstd and replay rows in the Lama patches tab. Co-Authored-By: Claude Opus 5.5 --- runtime/cfg.c | 5 ++++- runtime/ui/menu.cpp | 7 +++++++ runtime/ui_text.c | 11 +++++++++++ runtime/ui_text.h | 2 ++ runtime/vk_exec_draw.c | 1 + runtime/vk_memory.c | 2 ++ runtime/vk_pipeline.c | 1 + tools/make_game.py | 1 + 8 files changed, 29 insertions(+), 1 deletion(-) diff --git a/runtime/cfg.c b/runtime/cfg.c index 6add4819..bed3d8e0 100644 --- a/runtime/cfg.c +++ b/runtime/cfg.c @@ -91,6 +91,7 @@ static const char *const known[] = { // The nx2navi.ini section a key cfg_set may write goes to when the file lacks it (nx2navi.ini.example's sections). static const struct { const char *key, *section; } sections[] = { // the menu's Lama patches tab (ui/menu.cpp tab_lama) + {"ZSTD_NATIVE", "performance"}, {"MESH_EMU_MB", "performance"}, {"MESH_EMU_TASKS", "performance"}, {"MESH_EMU_BATCH", "performance"}, {"VEC_INDEX_FIX", "performance"}, {"GUEST_OPT", "performance"}, {"PASS_TIMES", "diagnostics"}, {"DUMP_KEY", "diagnostics"}, {"FPS_LIMIT", "frame rate"}, {"FPS60", "frame rate"}, {"RTSS", "frame rate"}, @@ -254,7 +255,7 @@ static const CfgMeta metas[] = { // offer's number, which this setting or the menu accepts), always (every room, the save still copied first), or a number. {"COOP_ACCEPT", "ask", NULL, LIVE}, // Advanced: scheduling - {"ASYNC_PREEMPT", "1", "0|1|2", RESTART}, {"REPLAY_ASYNC", "0", "0|1", RESTART}, + {"ASYNC_PREEMPT", "1", "0|1|2", RESTART}, {"REPLAY_ASYNC", "1", "0|1", RESTART}, {"REPLAY_WORKERS", "3", "0..16", RESTART}, {"REPLAY_PIPE", "0", "0..4", RESTART}, {"FREE_CORES", "0", "0|1", RESTART}, {"TIMER_1MS", "1", "0|1", RESTART}, // dynamic resolution (dynres.c): the scene follows the GPU time toward DYN_RES_TARGET milliseconds @@ -303,7 +304,9 @@ static const CfgMeta metas[] = { {"MIRROR_HOT", "25", "0..1000", RESTART}, {"FREEZE_IDLE", "1800", "0..100000", RESTART}, {"VRAM_HEAP_LIMIT", "auto", NULL, RESTART}, // vk_device.c vram_heap_limits: auto, 0 or MiB {"UPLOAD_BATCH_MB", "256", NULL, RESTART}, // vk_memory.c: MiB of staging before a batch goes early, 0 no limit + {"MESH_EMULATION", "1", "0|1", RESTART}, {"MESH_EMU_MB", "256", "32..2048", RESTART}, {"MESH_EMU_TASKS", "16384", "256..262144", RESTART}, {"MESH_EMU_BATCH", "1", "0|1", RESTART}, {"VEC_INDEX_FIX", "0", "0|auto|1", RESTART}, + {"GUEST_OPT", "2", "1|2", RESTART}, // tools/make_game.py: the next Rebuild the Game {"PASS_TIMES", "0", "0|1", RESTART}, {"DUMP_KEY", "", NULL, RESTART}, // vk_crumbs.c, vk_dump.c // textures and memory {"ASTC", "auto", "auto|gpu|native|cpu", RESTART}, {"MEMORY", "auto", "auto|import|mirror|verify", RESTART}, diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index 49dd4c48..0341e6d7 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -1633,6 +1633,7 @@ static void tab_lama(float scale) { static const char *const values[] = {"", "512", "1024", "2048", "4096", "8192"}; const char *names[] = {menu_text(UI_MENU_AUTO), "512", "1024", "2048", "4096", "8192"}; opt_choice_list("NX2NAVI_TEX_RELEASED_MAX", UI_MENU_LAMA_RELEASED, values, names, 6, UI_MENU_LAMA_RELEASED_DESC); + } opt_slider("NX2NAVI_MIRROR_HOT", UI_MENU_LAMA_MIRROR_HOT, 0, 100, UI_MENU_LAMA_MIRROR_HOT_DESC, 5, "%.0f %%"); { // vk_device.c vram_heap_limits static const char *const values[] = {"auto", "0"}; @@ -1643,7 +1644,13 @@ static void tab_lama(float scale) { const char *names[] = {"128 MB", "256 MB", "512 MB", "1024 MB", menu_text(UI_MENU_LAMA_NO_LIMIT)}; opt_choice_list("NX2NAVI_UPLOAD_BATCH_MB", UI_MENU_LAMA_UPLOAD_BATCH, values, names, 5, UI_MENU_LAMA_UPLOAD_BATCH_DESC); opt_toggle("NX2NAVI_ASTC_SCRATCH_KEEP", UI_MENU_LAMA_ASTC_KEEP, UI_MENU_LAMA_ASTC_KEEP_DESC); + { // vk_memory.c freeze_pass: submissions a region stays unwritten before it is frozen + static const char *const values[] = {"1800", "1200", "600", "60", "0"}; + const char *names[] = {"1800", "1200", "600", "60", menu_text(UI_MENU_OFF)}; + opt_choice_list("NX2NAVI_FREEZE_IDLE", UI_MENU_LAMA_FREEZE, values, names, 5, UI_MENU_LAMA_FREEZE_DESC); + opt_toggle("NX2NAVI_ZSTD_NATIVE", UI_MENU_LAMA_ZSTD, UI_MENU_LAMA_ZSTD_DESC); // ov_zstd.c trusted opt_group(UI_MENU_LAMA_RENDER); + opt_toggle("NX2NAVI_REPLAY_ASYNC", UI_MENU_LAMA_ASYNC, UI_MENU_LAMA_ASYNC_DESC); // vk_backend.c const bool native = vk_mesh_shader_native() != 0; // vk_exec_draw.c: the emulation only where the GPU lacks them if (native) opt_disable_next(UI_MENU_LAMA_MESH_NATIVE); opt_toggle("NX2NAVI_MESH_EMULATION", UI_MENU_LAMA_MESH_EMU, UI_MENU_LAMA_MESH_EMU_DESC); diff --git a/runtime/ui_text.c b/runtime/ui_text.c index a497bcda..c7729e2d 100644 --- a/runtime/ui_text.c +++ b/runtime/ui_text.c @@ -139,6 +139,17 @@ static const char *const text_en[UI_TEXT_COUNT] = { "of -O1: the game's own threads run faster on a slower CPU. The build takes " "several times longer.", [UI_MENU_LAMA_GUEST_OPT_NOTE] = "at the next rebuild", + [UI_MENU_LAMA_FREEZE] = "Freeze idle memory after", + [UI_MENU_LAMA_FREEZE_DESC] = "Submissions a memory region stays unwritten before it is made read-only, so the write " + "tracking can skip it. 1800 (about 15 s): few thaws and small tracking queries. 60: " + "the game thaws regions all the time and every thaw stalls a frame. Off: no stalls, but " + "the tracking scans all memory every frame.", + [UI_MENU_LAMA_ZSTD] = "Native data decompression", + [UI_MENU_LAMA_ZSTD_DESC] = "Decompresses the game's zstd data with the PC's libzstd instead of the game's own " + "decoder translated from the console. Lighter streaming while you move.", + [UI_MENU_LAMA_ASYNC] = "Asynchronous replay", + [UI_MENU_LAMA_ASYNC_DESC] = "Translates the game's GPU commands on a thread of their own instead of the game's, so " + "the game prepares the next frame meanwhile.", [UI_MENU_LAMA_PASS_TIMES] = "Pass times in the log", [UI_MENU_LAMA_PASS_TIMES_DESC] = "GPU time of every render pass and dispatch goes to the log, with the largest " "viewport each kind of pass draws with. Costs a little frame time.", diff --git a/runtime/ui_text.h b/runtime/ui_text.h index 6ef06b5c..8875d9f7 100644 --- a/runtime/ui_text.h +++ b/runtime/ui_text.h @@ -335,6 +335,8 @@ typedef enum { // the Lama patches tab (ui/menu.cpp tab_lama): the settings of the RX 580 patches, English only UI_MENU_TAB_LAMA, UI_MENU_LAMA_INTRO, UI_MENU_LAMA_MEMORY, UI_MENU_LAMA_RENDER, UI_MENU_LAMA_BUILD, UI_MENU_LAMA_DIAG, + UI_MENU_LAMA_FREEZE, UI_MENU_LAMA_FREEZE_DESC, UI_MENU_LAMA_ZSTD, UI_MENU_LAMA_ZSTD_DESC, + UI_MENU_LAMA_ASYNC, UI_MENU_LAMA_ASYNC_DESC, UI_MENU_LAMA_RELEASED, UI_MENU_LAMA_RELEASED_DESC, UI_MENU_LAMA_CLOBBER, UI_MENU_LAMA_CLOBBER_DESC, UI_MENU_LAMA_MIRROR_HOT, UI_MENU_LAMA_MIRROR_HOT_DESC, diff --git a/runtime/vk_exec_draw.c b/runtime/vk_exec_draw.c index 80b75de4..e5b6509f 100644 --- a/runtime/vk_exec_draw.c +++ b/runtime/vk_exec_draw.c @@ -5593,6 +5593,7 @@ static int mesh_emu_draw_prim(VkExec *ex) { static int mesh_emu_on(void) { static int on = -1; if (on < 0) { + on = !vk_ctx()->has_mesh_shader && rt_knob("MESH_EMULATION", "1"); if (on) rt_log("vk: mesh shaders emulated with compute (NX2NAVI_MESH_EMULATION)"); } return on; diff --git a/runtime/vk_memory.c b/runtime/vk_memory.c index ec28eadc..e278f085 100644 --- a/runtime/vk_memory.c +++ b/runtime/vk_memory.c @@ -3471,6 +3471,8 @@ static uint64_t hot_frame0, n_demoted; static void hot_check(void) { if (mirror_hot < 0) { + const char *v = cfg_value("NX2NAVI_MIRROR_HOT"); // the settings row's default (25) when unset + int p = v && *v ? atoi(v) : 25; mirror_hot = p < 0 ? 0 : p > 1000 ? 1000 : p; if (mirror_hot) rt_log("mem: pools copied %d%% of their size a frame stay in system memory (NX2NAVI_MIRROR_HOT)", mirror_hot); } diff --git a/runtime/vk_pipeline.c b/runtime/vk_pipeline.c index 887a5134..92bb5445 100644 --- a/runtime/vk_pipeline.c +++ b/runtime/vk_pipeline.c @@ -2839,6 +2839,7 @@ static Layout *layout_get(Bindings *B) { // set 0 gets a template per bind point. Caller holds P.lock. static int mesh_emu_on(void) { static int on = -1; + if (on < 0) on = rt_knob("MESH_EMULATION", "1"); return on; } diff --git a/tools/make_game.py b/tools/make_game.py index 0f5cbe26..8d95d4bb 100644 --- a/tools/make_game.py +++ b/tools/make_game.py @@ -1448,6 +1448,7 @@ def runtime_cmd(clang, clangxx, inc, level=0, fast=None, msys=None, first=()): and its command, which is part of its objects' keys, stays as it was. NX2NAVI_GUEST_OPT (an environment variable, or guest_opt in nx2navi.ini) 1 builds the lifted code at -O1; by default -O2: the game's own threads run it and bound the frame on a slower CPU; the build takes several times longer.""" + guest_opt = '-O1' if os.environ.get('NX2NAVI_GUEST_OPT', '').strip() == '1' else '-O2' # -O2 unless guest_opt = 1 def cmd_for(src, dst): cpp = src.suffix in ('.cpp', '.cxx') # the lifted code at -O1 (its size makes -O2 slow to build), the runtime at -O2; neither may assume strict