Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix image transitions among Samples using Dynamic_Rendering #983

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Mateusz-Kowalewski-Mobica
Copy link
Contributor

With new versions of VVL for Samples which are using Dynamic_Rendering it appear synchronization issue described here:
KhronosGroup/Vulkan-ValidationLayers#7193 (comment)

I identify all Samples which are using that extension and I fix it.

Note: For Shader_Object Sample I need to wait for fix regarding latest union of C or C++ framework (It can't be tested right now)

@@ -372,6 +372,10 @@ void DynamicRendering::build_command_buffers()
{
vkb::image_layout_transition(draw_cmd_buffer,
swapchain_buffers[i].image,
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming the acquisition of the swapchain image is protected by a fence guarding it from the prior present, I don't see why this wouldn't be VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT (or better yet VK_PIPELINE_STAGE_2_NONE), especially as the source layout is "undefined", meaning we don't care about the contents of this image anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From that issue I mentioned seems that changing layout will happen earlier than waiting for rasterization write to image.

I'm not that much experience Vulkan engineer, but this sentence seems reasonable:
There should be additional execution dependency with COLOR_ATTACHMENT_OUTPUT stage, otherwise image transition can start before image acquire operation finished. The destination stage is set to COLOR_ATTACHMENT_OUTPUT and this guarantees that writes from rasterization will wait. But the image layout transition happens earlier, and by setting source stage to COLOR_ATTACHMENT_OUTPUT we create execution dependency with semaphore wait operation (we chain with pWaitDstStageMask which also specifies COLOR_ATTACHMENT_OUTPUT ).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have to defer to someone with a better understanding of this than myself then. I don't quite get why the dstStage isn't sufficient to ensure the proper ordering.

@SaschaWillems SaschaWillems self-requested a review May 6, 2024 15:36
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.

None yet

2 participants