perf(ui): scope inter-dispatch barrier to the swapchain image (#48) #88
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Catcrafts/Crafter.Graphics!88
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "claude/issue-48"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
UIRenderer::Dispatchinserted a queue-wideVkMemoryBarrier(SHADER_WRITE -> SHADER_READ|WRITE) before every dispatch after the first. As a global memory barrier it flushes/invalidates all shader caches, even though the only hazard is the read-modify-write of the single swapchain storage image that every UI pass shares. A typical quads/circles/images/text frame pays 3 of these.This narrows it to a
VkImageMemoryBarrierscoped to the swapchain image's subresource (COMPUTE_SHADER -> COMPUTE_SHADER,GENERAL -> GENERAL, no layout transition). Same correctness — later passes still observe earlier passes' writes — but only this image's caches are flushed; unrelated buffers/images are no longer invalidated.Honest limit
This is a narrower cache flush only. The execution dependency stays compute->compute over the whole queue, so the passes still do not overlap. Eliminating the barriers entirely requires fusing consecutive passes into one dispatch, tracked separately in #47 and intentionally out of scope here.
Per the issue's Do NOT: a
VkBufferMemoryBarrierwould be the wrong barrier type for an image hazard and would corrupt output — this uses an image barrier.Testing
crafter-build test— 7 passed.Screenshots
Resolves #48