From f23f41320263ab1859c8dc233001452cd41a84f3 Mon Sep 17 00:00:00 2001 From: Tobim6 <102646588+Tobim6@users.noreply.github.com> Date: Thu, 12 Nov 2026 16:23:20 +0100 Subject: [PATCH] Staged mirror uploads: a submission that reads through the device address table waits for the GPU The table names pools without a mirror, guest memory the GPU reads as it runs, and nothing marked such a submission live: with NX2NAVI_MIRROR_STAGE the submit wait ended once the replay had submitted, and the game wrote the next frame's foliage instances while the GPU still drew from them (small grass and moss flickering and sliding as the camera turned). Co-Authored-By: Claude Opus 5.5 --- runtime/vk_exec_draw.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runtime/vk_exec_draw.c b/runtime/vk_exec_draw.c index a561763e..596c978e 100644 --- a/runtime/vk_exec_draw.c +++ b/runtime/vk_exec_draw.c @@ -1545,6 +1545,12 @@ static VkDescriptorBufferInfo ssbo_info(VkExec *ex, int st, const GfxShaderRes * // submission as their draws: either way this ran for the guest submission. if (r->cbuf_slot == VK_GPA_CB_SLOT) { vk_mem_shadow_table_read(); + // What the table names is mostly guest memory itself (pools without a mirror), which the GPU reads as it runs: + // the submission's submit wait is the GPU's (vk_mem_take_live). Without this the staged mirror uploads + // (NX2NAVI_MIRROR_STAGE) ended the wait once the replay had submitted, and the game wrote the next frame's + // instances while the GPU still drew from them: the small grass and moss, which reach their instances through + // the table, flickered and slid over the ground as the camera turned (RX 580, Kokiri Forest, 2026-11-11). + vk_mem_note_live(); VkDescriptorBufferInfo t = vk_gpa_info(); return t.buffer ? t : (VkDescriptorBufferInfo){Z.zbuf, 0, VK_WHOLE_SIZE}; }