Let the game go on while the GPU runs the end of the last frame, with tail_early = 1.

The game waits each frame until the GPU has finished the frame before. In Hyrule Field with FSR 4 the last of that
work is one part of 4.7 ms, the temporal upscaler and the interface drawn after it, then 1.4 ms of write-backs, and
what the game reads of the frame is done before the upscaler runs. With NX2NAVI_TAIL_EARLY the replay records that
tail into a command buffer of its own, and when it hands the CPU nothing but timestamps, writes no pool memory but
inline uniform updates of mirrored blocks and reads no guest memory late, the write-backs go to the queue before it
with the executed timeline's signal. The game's waits end there, and the GPU runs the tail while the next frame is
prepared. The GPU's commands are the same; a tail that fails a test goes as before. Off by default.

RX 7900 XT, Ryzen 7 5800X3D, 3440x1440, FSR 4 Native AA, one batch, replay workers off: 50.7 against 42.5 fps
standing and 56.0 against 45.9 along the field route; with FSR 3.1, 51.8 against 47.8 and 54.9 against 52.3. With
three replay workers, FSR 4, standing: 63.5 against 49.4. The screenshots matched those without it standing, along
the route and through warps to five areas, with no black frame outside the loading screens of both.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
epicmeme546
2026-11-12 17:41:47 -05:00
parent d03446d4eb
commit aec5e72051
14 changed files with 315 additions and 11 deletions

View File

@@ -7201,7 +7201,14 @@ static void op_update_ub(VkExec *ex, const p_update_ub *u) {
VK_MEM_PICK(sp);
VkBufferCopy cp = {o, sp.offset, u->size};
vkCmdCopyBuffer(ex->cb, b, sp.buffer, 1, &cp);
vk_mem_gpu_wrote(&sp, u->size);
// In a submission's tail (vk_exec.c "the early tail") an update of a mirrored block reaches guest memory with the
// results the game reads, from the bytes here, and takes no write-back: one after the tail would land when the
// game is already writing the next frame's data. Not with the lazy write-back, where the block's pages may be
// armed and a store into them would wait for the GPU (memory.c lazy_fault): the update is noted as ever there,
// and the tail goes after the write-backs as before.
if (vk_exec_tail() && !vk_mem_wb_lazy() && vk_mem_mirrored(u->dst, u->size))
vk_exec_tail_ub(ex->fence, u->dst, u->data, u->size);
else vk_mem_gpu_wrote(&sp, u->size);
vk_usnap_drop(u->dst, u->size);
ex->recorded++;
vk_mem_count(sp.cls, VK_MUSE_GPU_WRITE, u->size);