From 324f85602f516dce1142ecb3face1419da75f340 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 7 Nov 2026 00:18:52 +0000 Subject: [PATCH] Clear the uniform overlays once their copies are recorded After vk_exec_ub_flush the full barrier barrier_to records makes the copied bytes visible, so later bindings can read the real buffer. The overlays stayed until the submission's end instead: every later binding inside their span scanned them, and a block an overlay covered in part got a merged scratch copy that the descriptor build skip then left alone. With the updates between passes overlaid too (Great Sky Island: 274 of 594 per submission) that was 290 merged copies and 1.1 ms more replay a frame, more than the barriers saved on the GPU (0.3 ms). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BspNcezsiV8zT8wcnXrrME --- runtime/vk_exec_draw.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/runtime/vk_exec_draw.c b/runtime/vk_exec_draw.c index 195c516b..730664c5 100644 --- a/runtime/vk_exec_draw.c +++ b/runtime/vk_exec_draw.c @@ -3381,6 +3381,11 @@ void vk_exec_ub_flush(VkExec *ex) { ex->recorded++; } OV.np = 0; + // The full barrier barrier_to records next makes the copied bytes visible: later bindings read the real buffer, + // as after an update copied at once, and need no overlay lookups or merged copies (ov_at answers 0 for them, so + // the descriptor build skip rebuilds the draws that bound an overlay) + OV.n = 0; + ov_span(); OV.c_flush++; }