Add subpass dependency to ensure synchronization across frames#53
Merged
vblanco20-1 merged 6 commits intovblanco20-1:masterfrom Jan 2, 2022
Merged
Add subpass dependency to ensure synchronization across frames#53vblanco20-1 merged 6 commits intovblanco20-1:masterfrom
vblanco20-1 merged 6 commits intovblanco20-1:masterfrom
Conversation
Merged
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.
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:
(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.