vkback: check the present fence under the queue lock #50
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/vktory6--VKtory!50
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-50"
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?
@TheRifai on GitHub · 2026-12-01 05:20 UTC · original
TheRifai:vkback-present-fence-lock→main· +12 −4 · 1 files · 1 commits · closed without mergingWhat
The present blit's fence is submitted on the submission thread (
Queued::run, underdev::queue_lock), but the renderer checked and reset that same fence on the live thread, sovkGetFenceStatus/vkResetFencesraced the submission thread'svkQueueSubmit. The check now takes the same queue lock, serializing the two threads.Evidence
Reproduced with the validation layer on a camera sweep of the house save:
After the change, the same sweep logs no
UNASSIGNED-Threading-*line and no new VUID. (The VUID is timing-dependent, so the "before" run is the one that caught it; the "after" run is the same command on the patched tree.)@vktory6 on GitHub · 2026-12-01 07:35 UTC · original
Thank you, and the validation report is right: the fence check raced the submission thread. I'm closing this in favour of #39, which fixes the same race differently, for two reasons:
dev::queue_lockon the renderer thread makes the renderer wait whenever the submission thread holds the lock, and that thread holds it for every submit and present (and umem's binds take the same queue). The present path is built so that the renderer never waits there (see the comment above the fence check).vkAcquireNextImageKHRon the renderer can run while the submission thread is still insidevkQueuePresentKHR. A lock around the fence check doesn't cover that.#39 skips the frame while a present is still queued (
Out::queued > 0). That covers both objects and never blocks. Thanks for catching it!@TheRifai on GitHub · 2026-12-01 08:04 UTC · original
Makes sense — #39's skip-while-queued covers the swapchain half too and keeps the renderer off the lock entirely. Thanks for the clear write-up; closing this one is the right call.
Pull request closed