Skip to content

Add subpass dependency to ensure synchronization across frames#53

Merged
vblanco20-1 merged 6 commits intovblanco20-1:masterfrom
pixelcluster:framesync-fix
Jan 2, 2022
Merged

Add subpass dependency to ensure synchronization across frames#53
vblanco20-1 merged 6 commits intovblanco20-1:masterfrom
pixelcluster:framesync-fix

Conversation

@pixelcluster
Copy link
Contributor

Currently, access to the depth attachment in the renderpasses is undersynchronized.
The submits wait on a semaphore that is signaled when an acquired image is available - however, I failed to find any spec guarantee that this semaphore will be signaled only after rendering to a previous frame has finished, be it by waiting for the present operation to finish or just for it to start. I did find a section of the spec indicating that images may be acquired and presented out of order:

There is no requirement for an application to present images in the same order that they were acquired - applications can arbitrarily present any image that is currently acquired.

(https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/chap33.html#vkQueuePresentKHR)
This, to me, indicates that acquiring images is generally independent from presenting them, and therefore, these two operations do not have to be synchronized. This theory is further supported by synchronization validation reporting write-after-write hazards (which would be expected in case of undersynchronization here), as pointed out in the comments for chapter 4 at vblanco20-1/vkguide-comments#7 (comment) .

This PR fixes the undersynchronization (and the validation errors) by including depth attachment-related stages in the subpass dependencies for the main renderpass and adding another dependency from subpass 0 to external. I have also applied the relevant changes to the tutorial code, which will be included in another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants