mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 12:59:58 -04:00
End the wait after a frame's first submission when its passes are through, not its write-backs.
Every frame the render thread waited about 5 ms for the GPU after the frame's first submission, with the game CPU-bound in every area. The wait is there so that the GPU has run that submission's passes before the game rewrites what they read. But the submission also ends with the write-backs of what its shaders wrote, 60 MiB merged into guest memory in 3 to 4 ms of GPU time, and the wait covered those too. The write-backs now go into a part of their own. The part before them signals a second timeline, the executed timeline, and the first-submission wait waits on that; the write-back part signals the timeline as before, so every fence the game asks for still covers them, in the same queue order. wb_split = 0 keeps one part and the old wait. Not measured in the game yet. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -660,6 +660,9 @@ NVN_API(nvnQueueSubmitCommands) {
|
||||
// point). Copies of the data at submit made it worse, a mix of two frames' versions.
|
||||
// NX2NAVI_SUBMIT_FINISH=<mask>: bit i waits after the i-th submission of a frame (default 0x1); a plain 1 waits
|
||||
// after every submission, 0 never.
|
||||
// The wait is for the submission's passes, which is what the rewrite races with: exec_wait leaves out the
|
||||
// write-backs of what they wrote (vk_sync.c exec_tl), which nothing here needs before the game goes on. The fences
|
||||
// the game itself waits on cover them as before.
|
||||
static long long finish_mask = -2;
|
||||
if (finish_mask == -2) {
|
||||
const char *e = cfg_get("NX2NAVI_SUBMIT_FINISH");
|
||||
@@ -667,7 +670,7 @@ NVN_API(nvnQueueSubmitCommands) {
|
||||
if (e && *e && finish_mask == 1 && !(e[0] == '0' && (e[1] == 'x' || e[1] == 'X'))) finish_mask = -1; // "1": all
|
||||
}
|
||||
int idx = nvn_submits_in_frame++;
|
||||
if (finish_mask && f && (finish_mask == -1 || (idx < 63 && (finish_mask >> idx & 1)))) gfx_backend()->fence_wait(f, UINT64_MAX);
|
||||
if (finish_mask && f && (finish_mask == -1 || (idx < 63 && (finish_mask >> idx & 1)))) gfx_backend()->exec_wait(f, UINT64_MAX);
|
||||
}
|
||||
|
||||
// The producer (1.2.1 main f_70008c6460) releases the read lock on obj+0x538 at lr 0x70008c70c8; when
|
||||
|
||||
Reference in New Issue
Block a user