From f38428fa4d67e6b736c281cac0df59a79f44cc1d Mon Sep 17 00:00:00 2001 From: chrg6 Date: Wed, 11 Nov 2026 05:18:37 -0500 Subject: [PATCH] Make the wait on the GPU's signal the default again after a frame's first submission. The fence's wait cost about 4.5 % of the frames a second, and the player who reported the flicker still sees it and black frames with it. wb_split = 0 keeps the fence's wait for whoever wants to compare. Co-Authored-By: Claude Fable 5.2 --- nx2navi.ini.example | 2 +- runtime/cfg.c | 2 +- runtime/vk_sync.c | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/nx2navi.ini.example b/nx2navi.ini.example index 1e447edc..2808da6c 100644 --- a/nx2navi.ini.example +++ b/nx2navi.ini.example @@ -841,7 +841,7 @@ # about 0.7 ms less of every frame in the open (6 % at 85 frames a second), but the game then reads visibility # results that may be a frame old, and things near the camera can come and go from frame to frame. With shadow # storage (Linux, Wine) 1 changes nothing; 2 forces it there as well, for tests. -# wb_split = 0 +# wb_split = 1 # 1: what the game's shaders write into its memory is copied back from the video card once, and after that only when # the game's CPU code touches it (most of it never is: 66 MiB a frame in Hyrule Field), for about a third more frames # a second in open areas. 0: copied back at the end of every GPU submission, as in 0.7.0. diff --git a/runtime/cfg.c b/runtime/cfg.c index c352c9c9..53889fdf 100644 --- a/runtime/cfg.c +++ b/runtime/cfg.c @@ -310,7 +310,7 @@ static const CfgMeta metas[] = { {"VK_NOOPT", "0", "0|1", RESTART}, // vk_pipeline.c noopt_flag // diagnostics {"TRACE", "", NULL, RESTART}, {"FLIGHT", "0", "0|1", RESTART}, {"FLIGHT_SPIKE_MS", "100", "0..60000", RESTART}, - {"WB_FENCE_LIMIT", "65536", "0..1073741824", RESTART}, {"WB_MERGE", "1", "0|1", RESTART}, {"WB_EXACT", "1", "0|1", RESTART}, {"MEM_CENSUS", "0", "0|1", RESTART}, {"WB_NO_REUP", "1", "0|1", RESTART}, {"WB_PROBE", "0", "0|1", RESTART}, {"WB_SPLIT", "0", "0|1|2", RESTART}, {"WB_LAZY", WB_LAZY_DEFAULT, "0|1", RESTART}, {"HEAP_LAZY", "0", "0|1", RESTART}, {"WB_LAZY_TOUCH", "0", "0..16", RESTART}, {"WB_LAZY_CHUNK", "0", "0|1", RESTART}, {"FLUSH_UPLOAD", "0", "0|1", RESTART}, {"GPA_TWIN_MAX_KB", "0", "0..1048576", RESTART}, + {"WB_FENCE_LIMIT", "65536", "0..1073741824", RESTART}, {"WB_MERGE", "1", "0|1", RESTART}, {"WB_EXACT", "1", "0|1", RESTART}, {"MEM_CENSUS", "0", "0|1", RESTART}, {"WB_NO_REUP", "1", "0|1", RESTART}, {"WB_PROBE", "0", "0|1", RESTART}, {"WB_SPLIT", "1", "0|1|2", RESTART}, {"WB_LAZY", WB_LAZY_DEFAULT, "0|1", RESTART}, {"HEAP_LAZY", "0", "0|1", RESTART}, {"WB_LAZY_TOUCH", "0", "0..16", RESTART}, {"WB_LAZY_CHUNK", "0", "0|1", RESTART}, {"FLUSH_UPLOAD", "0", "0|1", RESTART}, {"GPA_TWIN_MAX_KB", "0", "0..1048576", RESTART}, {"WB_MERGE_MAX", "32", "1..256", RESTART}, {"TEXUP_LOG_MS", "0", "0..60000", RESTART}, // vk_texture.c vk_texstat_frame {"VMA_BLOCK_MB", "64", "16..256", RESTART}, // vk_headroom.c vk_vma_block_size {"ASTC_BC_PROBE", "0", "0|1", RESTART}, // vk_texture.c astc_probe_alpha diff --git a/runtime/vk_sync.c b/runtime/vk_sync.c index f11d8261..9ded5489 100644 --- a/runtime/vk_sync.c +++ b/runtime/vk_sync.c @@ -74,8 +74,9 @@ static int hold_max = -1; // ---- the executed timeline // The wait after a frame's first submission (nvn_api_core.c nvnQueueSubmitCommands) is there so that the GPU has run -// that submission's passes before the game rewrites what they read. It is the fence's wait (NX2NAVI_WB_SPLIT=0, the -// default). NX2NAVI_WB_SPLIT=1 makes it a wait on exec_tl, a second timeline that reaches a submission's value when +// that submission's passes before the game rewrites what they read. With NX2NAVI_WB_SPLIT=0 it is the fence's wait. +// The default is 1 again: the fence's wait cost about 4.5 % of the frames a second and the flicker it was put in +// against was still reported with it. NX2NAVI_WB_SPLIT=1 makes it a wait on exec_tl, a second timeline that reaches a submission's value when // the GPU has executed its own commands: the replay ends the part before the write-backs (vk_exec.c, // vk_sync_split_exec; vk_memory.c vk_mem_mirror_end: what the shaders wrote into VRAM mirrors goes back to guest // memory), that part signals exec_tl, and the write-backs follow in a part of their own, which signals the timeline