You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, so I found this trying to fix validation error. The issue
When dragging an ImGui window outside of the main application window, a synchronization hazard occurs due to incorrect pipeline barrier stage flags. The Vulkan backend uses VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT as the source stage in vkCmdPipelineBarrier, which causes a read-write hazard during external window operations.
Expected behavior
The pipeline barrier should properly synchronize the image layout transition when dragging windows outside the main window, without triggering any validation errors. This should be achieved by using the correct source stage flag (VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT).
Reproduction Steps:
Use ImGui docking branch with Vulkan backend
Enable synchronization validation
Create a window in the application
Drag the window outside the main application window
Version/Branch of Dear ImGui:
docking branch (1.91.5)
Back-ends:
imgui_impl_vulkan.cpp, sdl
Compiler, OS:
Windows 11 + msvc
Full config/build information:
No response
Details:
My Issue/Question:
Hi, so I found this trying to fix validation error.
The issue
When dragging an ImGui window outside of the main application window, a synchronization hazard occurs due to incorrect pipeline barrier stage flags. The Vulkan backend uses VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT as the source stage in vkCmdPipelineBarrier, which causes a read-write hazard during external window operations.
Validation Error Details
shCopy[ERROR] Validation Error: [ SYNC-HAZARD-WRITE-AFTER-READ ] Object 0: handle = 0x291d2876fa0, type = VK_OBJECT_TYPE_QUEUE; MessageID = 0x376bc9df vkQueueSubmit(): Hazard WRITE_AFTER_READ for entry 0, VkCommandBuffer 0x291efc487a0[] Submitted access info (submitted_usage: SYNC_IMAGE_LAYOUT_TRANSITION, command: vkCmdPipelineBarrier, seq_no: 1, reset_no: 112) Access info (prior_usage: SYNC_PRESENT_ENGINE_SYNCVAL_PRESENT_ACQUIRE_READ_SYNCVAL, read_barriers: VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT|VK_PIPELINE_STAGE_2_BOTTOM_OF_PIPE_BIT, batch_tag: 3367, vkAcquireNextImageKHR aquire_tag:3367: VkSwapchainKHR 0x1d4e2e0000000062[], image_index: 2image: VkImage 0x5dbcf90000000065[])Expected behavior
The pipeline barrier should properly synchronize the image layout transition when dragging windows outside the main window, without triggering any validation errors. This should be achieved by using the correct source stage flag (VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT).
Reproduction Steps:
Related discussion:
SYNC-HAZARD-WRITE-AFTER-READ error with swapchain acquisition and command buffer submission
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
// In imgui_impl_vulkan.cpp
vkCmdPipelineBarrier(fd->CommandBuffer,
VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, // srcStageMask (incorrect)
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, // dstStageMask
0,
0, nullptr,
0, nullptr,
1, &barrier);
Proposed Fix:
cppCopyvkCmdPipelineBarrier(fd->CommandBuffer,
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, // srcStageMask (correct)
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, // dstStageMask
0,
0, nullptr,
0, nullptr,
1, &barrier);
The text was updated successfully, but these errors were encountered: