KhronosGroup / OpenXR-SDK-Source

Sources for OpenXR loader, basic API layers, and example code.
https://khronos.org/openxr
Apache License 2.0
650 stars 239 forks source link

vulkan synchronization validation error inside xrEndFrame implementation #478

Open jmoguill opened 3 months ago

jmoguill commented 3 months ago

I'm getting a vulkan validation error. It seems the error occurs inside the OpenXR source code, when xrEndFrame is called. I enabled VK_LUNARG_api_dump to dump the vulkan calls..... it seems that xrEndFrame internally issues a call to vkCmdPipelineBarrier, but the srcAccessMask and dstAccessMask are set to VK_ACCESS_NONE....

        srcAccessMask:                  VkAccessFlags = 0 (VK_ACCESS_NONE)
        dstAccessMask:                  VkAccessFlags = 0 (VK_ACCESS_NONE)
        oldLayout:                      VkImageLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL (2)
        newLayout:                      VkImageLayout = VK_IMAGE_LAYOUT_GENERAL (1)
        srcQueueFamilyIndex:            uint32_t = 0
        dstQueueFamilyIndex:            uint32_t = 4294967294

....

I get a synchronization error: WRITE AFTER WRITE hazard....

Validation Error: [ SYNC-HAZARD-WRITE-AFTER-WRITE ] Object 0: handle = 0x2b7e8080eb0, type = VK_OBJECT_TYPE_QUEUE; | MessageID = 0x5c0ec5d6 | vkQueueSubmit(): Hazard WRITE_AFTER_WRITE for entry 0, VkCommandBuffer 0x2b7f744f840[], Submitted access info (submitted_usage: SYNC_IMAGE_LAYOUT_TRANSITION, command: vkCmdPipelineBarrier, seq_no: 1, VkImage 0x30f5a50000000020[VrVkSwapchain_color_0], reset_no: 2). Access info (prior_usage: SYNC_COLOR_ATTACHMENT_OUTPUT_COLOR_ATTACHMENT_WRITE, write_barriers: 0, queue: VkQueue 0x2b7e8080eb0[], submit: 69, batch: 0, batch_tag: 79, command: vkCmdEndRenderPass, command_buffer: VkCommandBuffer 0x2b7f7d725f0[commandList[0]], seq_no: 5, renderpass: VkRenderPass 0x45a74f000000004a[], reset_no: 1).

This is with OpenXR version 1.0.34, and vulkan validation layer 275....

Please advise? are the srcAccessMask and dstAccessMask incorrect?

rpavlik commented 3 months ago

OpenXR itself only publishes the loader and a few other pieces of software, not an implementation of xrEndFrame. What runtime are you using? That is who has the validation error.

rpavlik-bot commented 2 months ago

An issue (number 2305) has been filed to correspond to this issue in the internal Khronos GitLab (Khronos members only: KHR:openxr/openxr#2305 ), to facilitate working group processes.

This GitHub issue will continue to be the main site of discussion.