Open koplas opened 2 years ago
A subpass dependency as described in https://developer.arm.com/documentation/101897/0200/fragment-shading/multipass-rendering should fix this issue.
Code snippet:
VkSubpassDependency subpassDependency = {};
subpassDependency.srcSubpass = 0;
subpassDependency.dstSubpass = 1;
subpassDependency.srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT |
VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT |
VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT;
subpassDependency.dstStageMask = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT |
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT |
VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT |
VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT;
subpassDependency.srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT |
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT
subpassDependency.dstAccessMask = VK_ACCESS_INPUT_ATTACHMENT_READ_BIT |
VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT |
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT |
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
subpassDependency.dependencyFlags = VK_DEPENDENCY_BY_REGION_BIT;
Thanks for raising this issue. I get the same sync validation messages and noticed that this also happens for other samples (e.g. MSAA). We probably should do a full sync run for all samples to ensure that they all validate clean against sync val.
May be too challenging to fix right now. Lets track it for future framework changes
We really need to fix this. This issue has been open for too long and is causing issues esp. for people using AMD hardware.
I had an artifact like this when I was implementing SSAO. I was thinking it was a synchronization problem. The artifact didn`t disappear when I fixed synchronization. In the end it was all about dividing by zero in my fragment shader.
This is definitely a sync issue (see earlier comments and linked issues/PRs). I can reproduce it on my side.
The sample "subpasses" has missing synchronization, which leads to display artifacts.
To reproduce enable Synchronization Validation Layers and start the sample. Then switch the Render technique between "Subpasses" and "Renderpasses". Following validation errors are printed:
Note: The display artifacts are visible only when the "Subpasses" option is selected.
vulkaninfo.txt