mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 16:49: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:
@@ -183,6 +183,11 @@ int vk_replay_async(void) {
|
||||
return on;
|
||||
}
|
||||
|
||||
// With the replay on its own thread a submission's value covers its replay too, and the wait stays the fence's.
|
||||
static int vk_be_exec_wait(uint64_t value, uint64_t timeout_ns) {
|
||||
return vk_replay_async() ? vk_sync_fence_wait(value, timeout_ns) : vk_sync_exec_wait(value, timeout_ns);
|
||||
}
|
||||
|
||||
// The front end's view (nvn_api_core.c, nvn_api_cmd.c): replay is asynchronous only on this back end.
|
||||
int gfx_replay_async(void) { return gfx_backend() == &gfx_vulkan_backend && vk_replay_async(); }
|
||||
|
||||
@@ -606,6 +611,7 @@ const GfxBackend gfx_vulkan_backend = {
|
||||
.program_release = vk_be_program_release,
|
||||
.submit = vk_be_submit,
|
||||
.fence_wait = vk_sync_fence_wait,
|
||||
.exec_wait = vk_be_exec_wait,
|
||||
.fence_done = vk_sync_fence_done,
|
||||
.present = vk_be_present,
|
||||
.frame_start = vk_dlssg_frame_start,
|
||||
|
||||
Reference in New Issue
Block a user