mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 12:59:58 -04:00
Turn the lazy write-back on by default on Windows and take its row out of the settings menu.
The user asked for this once the flicker fix was measured. The single-frame flicker that kept it off in 0.7.0 came from frames drawn before the game's signal that their data was written, which the previous commit fixes; the lazy write-back only made the frames come faster, so the signal fell into the replay more often. wb_lazy = 0 in nx2navi.ini still turns it off, and an ini that already holds the key keeps its value. Elsewhere than Windows the default stays 0, as its fetch inside the access-fault handler has never run there. Measured on the build of the previous commit, 1,800 presented frames a run, standing in Hyrule Field by day with DLSS Performance, frame generation 4x and HDR. With the lazy write-back on and eight busy threads beside the game: 38 and 0 single-frame spikes with the fix switched off (408 and 44 frames whose signal came during the replay), 0 and 0 with it on (667 and 724 such frames). With it off and the same load: 0 spikes in four runs, two with the fix and two without, 86 to 140 such frames each. Without load, one run each: 88.5 frames a second with the fix against 93.3 without it with the lazy write-back on (GPU 7.2 against 6.8 ms a frame, 6.53 against 6.48 submissions a frame), 71.0 against 65.6 with it off, so the fix's cost is inside the run-to-run spread; every run ended cleanly without a fatal error. This build was started once with no setting anywhere: the lazy write-back was on, and the Screen tab shows no row for it. Not measured: play by hand with the lazy write-back on and the fix (the user's sessions so far ran with it off), other areas than Hyrule Field, and more than one run for the frame rates. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -108,10 +108,13 @@ static void unprobe_locked(uint64_t r) {
|
||||
plat_dec32(&nprb);
|
||||
}
|
||||
|
||||
// Lazy write-back (NX2NAVI_WB_LAZY, default 0, vk_memory.c "lazy write-back"). Off by default: with it on, single
|
||||
// frames come out with the whole scene lit differently (brighter, shadows off). The flight recorder's thumbnails of
|
||||
// 1,800 presents standing in Hyrule Field show none with it off and 10 to 180 with it on, most when other programs keep
|
||||
// the CPU busy; the cause is not found (2026-11-10). What a shader wrote into a mirrored pool is
|
||||
// Lazy write-back (NX2NAVI_WB_LAZY, default 1 on Windows and 0 elsewhere, vk_memory.c "lazy write-back"). It was off
|
||||
// by default in 0.7.0: with it on, single frames came out with the whole scene's shadowing missing, 10 to 180 of 1,800
|
||||
// presents standing in Hyrule Field with other programs keeping the CPU busy and none found with it off. That was
|
||||
// not this code's doing: frames were drawn from copies taken before the game's signal that their data was written
|
||||
// (vk_exec_xfer.c "events the CPU signals"), and with the write-backs gone the frames came faster and the signal fell
|
||||
// into the replay more often. With that fixed, two such runs under eight busy threads showed none.
|
||||
// What a shader wrote into a mirrored pool is
|
||||
// copied back into guest memory at the end of every submission, in case the CPU reads it. Ocarina's CPU does not read
|
||||
// most of it: standing in Hyrule Field, 66 MiB a frame went back over PCIe, 7 to 9 ms of each frame's 13 to 15 ms of
|
||||
// GPU time, and the write-back probe found no access to it in 40 s. So a range that went back once is armed here: its
|
||||
@@ -637,7 +640,7 @@ void mem_init(void) {
|
||||
if (cfg_bool("NX2NAVI_WB_PROBE")) { // a diagnosis: off, no access fault reaches probe_fault and nothing is probed
|
||||
plat_mem_access_hook(access_fault);
|
||||
__atomic_store_n(&prb_on, 1, __ATOMIC_RELEASE);
|
||||
} else if (cfg_bool("NX2NAVI_WB_LAZY")) { // off unless set; armed only once the back end can fetch (mem_lazy_enable)
|
||||
} else if (cfg_bool("NX2NAVI_WB_LAZY")) { // armed only once the back end can fetch (mem_lazy_enable)
|
||||
plat_mem_access_hook(access_fault);
|
||||
lz_want = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user