Repository navigation
fix(vk): mesh fallback flicker: wait for the last draw before clearing the shared buffers (#1383 review) - #1509
Merged
NotRexed merged 1 commit intoNov 10, 2026
Conversation
rakefire-impala
force-pushed
the
fix/mesh-fallback-flicker-barrier-before-reset
branch
from
November 10, 2026 10:50
9d50fe2 to
afb9212
Compare
…w read them Since NotRexed#1383 a recording thread's fallback programs share one record and payload pair. fallback_record clears the records (and the payload) at the start of each fallback draw, but the first barrier came after the clears: nothing ordered them after the previous fallback draw's vertex stage, which reads those records. The clear could overwrite records a draw still in flight was reading (the hazard raised in NotRexed#1383's review). A full barrier after end_pass, before the clears. tests/test_mesh_fallback.py checks it.
rakefire-impala
force-pushed
the
fix/mesh-fallback-flicker-barrier-before-reset
branch
from
November 10, 2026 11:31
afb9212 to
946a7a4
Compare
lucasvinicius73
pushed a commit
to lucasvinicius73/Hookshot
that referenced
this pull request
Nov 10, 2026
…w read them (NotRexed#1509) Since NotRexed#1383 a recording thread's fallback programs share one record and payload pair. fallback_record clears the records (and the payload) at the start of each fallback draw, but the first barrier came after the clears: nothing ordered them after the previous fallback draw's vertex stage, which reads those records. The clear could overwrite records a draw still in flight was reading (the hazard raised in NotRexed#1383's review). A full barrier after end_pass, before the clears. tests/test_mesh_fallback.py checks it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)