From 0e76baad3600d4b7ae09db2be53d4376adf7bd5d Mon Sep 17 00:00:00 2001 From: chrg6 Date: Fri, 13 Nov 2026 05:58:10 -0500 Subject: [PATCH] Limit replay_small to 0..63, where it can match a group. A group too small to share out has fewer than 64 draws (2 x CHUNK_DRAWS), so a threshold of 64 or more never matched in group_start and the setting did nothing. The setting's range is now 0..63, the menu's slider ends at 60 in steps of 4, and a value of 64 or more from nx2navi.ini reads as 63 with one line in the log. Co-Authored-By: Claude Opus 5.5 --- nx2navi.ini.example | 9 +++++---- runtime/cfg.c | 2 +- runtime/ui/menu.cpp | 2 +- runtime/vk_exec.c | 5 +++++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/nx2navi.ini.example b/nx2navi.ini.example index 7f905d44..b891c064 100644 --- a/nx2navi.ini.example +++ b/nx2navi.ini.example @@ -97,10 +97,11 @@ # Also in the menu: Game, Testing, Start next frame early. # tail_early = 0 # EXPERIMENTAL, with replay_workers. replay_pipe = N (1 to 4, default 0): the submitting thread goes on past up to N -# groups its workers still record. replay_small = N (default 0, needs replay_pipe): a group of N draws or more that is -# too small to share out goes whole to one worker. Kokiri Forest standing on an RX 7900 XT with FSR 4, tail_early = 1, -# replay_workers = 5, replay_pipe = 4 and replay_small = 16: 63 instead of 45 fps with all of them off. Also in the -# menu: Game, Testing, Helpers work ahead (replay_pipe) and Helpers take small jobs (replay_small). +# groups its workers still record. replay_small = N (0 to 63, default 0, needs replay_pipe): a group of N draws or more +# that is too small to share out (fewer than 64 draws) goes whole to one worker; 64 or more reads as 63. Kokiri Forest +# standing on an RX 7900 XT with FSR 4, tail_early = 1, replay_workers = 5, replay_pipe = 4 and replay_small = 16: 63 +# instead of 45 fps with all of them off. Also in the menu: Game, Testing, Helpers work ahead (replay_pipe) and Helpers +# take small jobs (replay_small). # replay_pipe = 0 # replay_small = 0 # EXPERIMENTAL, THE GAME CRASHES WITH 1. 1 lifts the virtual core gate: guest threads run without the console's limit diff --git a/runtime/cfg.c b/runtime/cfg.c index 30caeea6..02972559 100644 --- a/runtime/cfg.c +++ b/runtime/cfg.c @@ -293,7 +293,7 @@ static const CfgMeta metas[] = { {"REPLAY_PIPE", "0", "0..4", RESTART}, {"REPLAY_WORKERS", "auto", "auto|0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16", RESTART}, // vk_exec.c rw_init, vk_exec_replay_workers_auto {"TAIL_EARLY", "0", "0|1", RESTART}, // vk_exec.c "the early tail" - {"REPLAY_SMALL", "0", "0..1024", RESTART}, // vk_exec.c group_start + {"REPLAY_SMALL", "0", "0..63", RESTART}, // vk_exec.c group_start {"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 {"DYN_RES", "0", "0|1", LIVE}, {"DYN_RES_TARGET", "16.7", "1..100", LIVE}, {"DYN_RES_STEP", "45", "8..600", LIVE}, diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index 5dd9f1e6..57228714 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -1505,7 +1505,7 @@ static void tab_game(float scale) { if (!workers) opt_disable_next(UI_MENU_NEEDS_WORKERS); opt_slider("NX2NAVI_REPLAY_PIPE", UI_MENU_REPLAY_PIPE, 0, 4, UI_MENU_REPLAY_PIPE_DESC, 1, "%.0f"); if (!pipe) opt_disable_next(workers ? UI_MENU_NEEDS_PIPE : UI_MENU_NEEDS_WORKERS); - opt_slider("NX2NAVI_REPLAY_SMALL", UI_MENU_REPLAY_SMALL, 0, 64, UI_MENU_REPLAY_SMALL_DESC, 4, "%.0f"); + opt_slider("NX2NAVI_REPLAY_SMALL", UI_MENU_REPLAY_SMALL, 0, 60, UI_MENU_REPLAY_SMALL_DESC, 4, "%.0f"); opt_toggle("NX2NAVI_TAIL_EARLY", UI_MENU_TAIL_EARLY, UI_MENU_TAIL_EARLY_DESC); // The debug menu, a tool for testing with English text of its own: off unless switched on here if (dbg_supported()) { diff --git a/runtime/vk_exec.c b/runtime/vk_exec.c index c48d3c1e..5b1fbd23 100644 --- a/runtime/vk_exec.c +++ b/runtime/vk_exec.c @@ -2103,6 +2103,11 @@ static void rw_init(void) { RW.pipe = RW.n <= 0 || pipe <= 0 ? 0 : pipe > LIVE_GROUPS ? LIVE_GROUPS : pipe; if (RW.pipe) RW.help_dc = vk_exec_draw_ctx_new(); RW.small = RW.pipe ? cfg_int("NX2NAVI_REPLAY_SMALL") : 0; + if (RW.small >= 2 * CHUNK_DRAWS) { // a group that large is cut into chunks (group_start): no group would match + rt_log("vk: NX2NAVI_REPLAY_SMALL = %d: groups of %d draws or more are shared out anyway, so %d is used (0..%d)", + RW.small, 2 * CHUNK_DRAWS, 2 * CHUNK_DRAWS - 1, 2 * CHUNK_DRAWS - 1); + RW.small = 2 * CHUNK_DRAWS - 1; + } if (RW.small > 0) rt_log("vk: a group of %d draws or more goes whole to one replay worker (NX2NAVI_REPLAY_SMALL)", RW.small); else RW.small = 0;