fix(window): silence per-frame and setup-path Vulkan validation errors (#153) #154
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!154
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "claude/issue-153"
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?
Resolves #153.
Two distinct Vulkan validation errors the native frame loop emitted, both originating in Crafter.Graphics.
Problem 1 — per-frame acquire-barrier access/stage mismatch (the spammy one)
The acquire→GENERAL barrier hardcoded
dstAccessMask = SHADER_WRITE | TRANSFER_WRITEbut used the per-pass stage union as its dst stage mask. For an all-compute frame the union narrows toCOMPUTE_SHADER, which does not supportTRANSFER_WRITE, soVUID-vkCmdPipelineBarrier-pImageMemoryBarriers-02820fired every frame.Fix: derive the access mask from the same stage union via a new
SwapchainWriterAccess()helper (mirroring the existingSwapchainStageUnion), applied to both the acquiredstAccessMaskand the presentsrcAccessMask(the latter had the mirror-image latent inconsistency).Problem 2 — setup-path command-buffer/buffer lifecycle errors
StartInit/FinishInit(andGetCmd/EndCmd) reuse the shareddrawCmdBuffers[currentBuffer]. With no steady-state wait-idle, the loop's last submission of that buffer may still be in flight when mid-session scene setup runs (building map meshes / acceleration structures), so the old code re-began (VUID-vkBeginCommandBuffer-commandBuffer-00049) and re-submitted (VUID-vkQueueSubmit-pCommandBuffers-00071) a pending buffer, and resources freed in theStartInit..FinishInitbracket could still be referenced by it (vkDestroyBuffer-in-use).Fix: drain the queue at the start of
StartInit/GetCmdbefore re-recording. Setup is rare (not the per-frame path), so a wait-idle is fine —FinishInit/EndCmdalready wait-idle at the end.Tests
SwapchainBarrierScope(pure CPU) extended withSwapchainWriterAccesscoverage: compute-only access isSHADER_WRITEonly (noTRANSFER_WRITE— the VUID-02820 trap), transfer pulls inTRANSFER_WRITE, conservative union folds in both.SetupCmdBufferReuse— a real-frame-loop regression test (same harness asFrameLoopSync) driving a compute pass plus interleaved mid-sessionStartInit/FinishInitrounds, asserting the validation layer stays silent.FrameLoopSynccannot catch problem 1 because it runs with no passes (the union falls back to the conservative writer set, which includes TRANSFER).Verified both halves of
SetupCmdBufferReusefail — reproducing the exact VUIDs from the issue — when their respective fix is reverted. Full suite: 25 passed (crafter-build test --jobs=1).🤖 Generated with Claude Code