Vulkan icon indicating copy to clipboard operation
Vulkan copied to clipboard

Tweak the basic subpass dependencies

Open krOoze opened this issue 5 years ago • 5 comments

fix #665

krOoze avatar Feb 07 '20 19:02 krOoze

Thanks for your PR. I'll try to take a look at this as soon as possible, but it may take some time.

SaschaWillems avatar Feb 09 '20 16:02 SaschaWillems

LGTM so far. Will do a bit of additional testing before merging.

SaschaWillems avatar Feb 13 '20 17:02 SaschaWillems

Sorry for the long delay, but haven't had time to test this earlier. I checked with all samples, and except for one this works as expected. The only sample no longer working properly is the pipeline statistics one, so before merging I would need to fix that sample to e.g. create it's own render pass.

Will need some additional time to test this though, as this may have potential side effects except for the one obviously visible in the pipeline statistics sample.

SaschaWillems avatar Mar 05 '20 19:03 SaschaWillems

Right, I faced the same problem. Sync is fundamentally untestable. And I don't really want to inspect each of the 50 examples manually neither.

Let's perhaps start with just the Triangle example first: #681.

PS: For that matter I have not even touched the samples that override the render pass creation. They might have a similar problem as the base\triangle code does....

krOoze avatar Mar 05 '20 20:03 krOoze

Been continuing with redoing synchronization and command buffer creation for my samples and started to tackle some of the more complex sample.

With the following barrier in the base I don't get any sync validation errors anymore:

	dependencies[0].srcSubpass = VK_SUBPASS_EXTERNAL;
	dependencies[0].dstSubpass = 0;
	dependencies[0].srcStageMask = VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT;
	dependencies[0].dstStageMask = VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT;
	dependencies[0].srcAccessMask = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
	dependencies[0].dstAccessMask = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT;

	dependencies[1].srcSubpass = VK_SUBPASS_EXTERNAL;
	dependencies[1].dstSubpass = 0;
	dependencies[1].srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
	dependencies[1].dstStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
	dependencies[1].srcAccessMask = 0;
	dependencies[1].dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_COLOR_ATTACHMENT_READ_BIT;

This is similar to what LunarG is doing in the cube sample distributed with the SDK.

I haven't tested with all samples yet, but a good chunk now runs with clean sync validation using that barrier.

SaschaWillems avatar Oct 29 '21 09:10 SaschaWillems

I did an initial pass to fix the basic dependencies as per discussion in #665.

I hope it's okay if I close this PR then.

SaschaWillems avatar Jan 01 '23 08:01 SaschaWillems