fix(vk): mesh fallback flicker: wait for the last draw before clearing the shared buffers (#1383 review) #1509
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!1509
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/mesh-fallback-flicker-barrier-before-reset"
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?
Since #1383, a recording thread's mesh fallback programs share one record/payload buffer pair. Each fallback draw clears it at the start, but nothing ordered that clear after the previous fallback draw finished reading it. This adds the barrier. It's the write-after-read hazard raised in #1383's review, which the merged version doesn't include yet.
Part of splitting up #1023.
Problem
fallback_recorddoes, in order:end_pass(cmd)vkCmdFillBuffer(records ...), and the payload fillfull_barrier(cmd)The previous fallback draw's vertex stage reads those records. Without a barrier between that draw and step 2, the fill can overwrite records an earlier draw in flight is still reading. On a GPU without mesh shaders, that can show up as fallback-drawn geometry (foliage, grass) flickering or drawing the wrong primitives.
Change
A
full_barrier(cmd)afterend_pass, before the fills. Six lines, including the comment and a test check.full_barrieralready skips itself when nothing was recorded since the last one, so back-to-back fallback draws pay one barrier, not two.Tests
tests/test_mesh_fallback.pychecks for a barrier betweenend_passand the first records fill. The check fails on main without this change.Risk
Only fallback draws (GPUs without
VK_EXT_mesh_shader) take this path. The cost is one barrier per fallback draw, which already has several.Tested on
VK_EXT_mesh_shader)