Window::SaveFrame touches the swapchain image after it was presented (validation error on every capture) #157
Labels
No labels
claude:blocked
claude:done
claude:failed
claude:in-progress
claude:ready
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Catcrafts/Crafter.Graphics#157
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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
Window::SaveFramereads backimages[currentBuffer]afterRender()has already handed that image tovkQueuePresentKHR. With the validation layer on, every call logs one error:Reproduced on an RTX 4090 (driver 610.57.04, Wayland) with
CRAFTER_GRAPHICS_VALIDATION=1: render a few frames, callSaveFrame. Line numbers below refer to6aa0338.Root cause
The documented contract is "state after Render() returns" (
interfaces/Crafter.Graphics-Window.cppm:246-250).Render()presents atimplementations/Crafter.Graphics-Window.cpp:956.SaveFrame(:1268) then records, on that same image:PRESENT_SRC_KHR → TRANSFER_SRC_OPTIMALbarrier (:1335-1346),vkCmdCopyImageToBuffer(:1359),PRESENT_SRC_KHR(:1370).At that point the image belongs to the presentation engine.
Impact
Device::validationErrorCount == 0cannot callSaveFramebefore the assertion.tests/UIFallbackParity(pending, part of the descriptor-set fallback change) reads the counter before the capture for this reason.Suggested fix
Capture inside the frame, before the image is released: a one-shot "capture this frame" request that makes
Render()copy the swapchain image to a staging buffer after the last pass and before theGENERAL → PRESENT_SRC_KHRtransition, with the PNG written once that frame's fence has signalled.SaveFramecan keep its signature and become "render one more frame and capture it".