-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Multi-viewports Vulkan Bug "RenderPasses incompatible" #3522
Labels
Comments
ocornut
changed the title
Docking Vulkan Bug "RenderPasses incompatible"
Multi-viewports Vulkan Bug "RenderPasses incompatible"
Oct 11, 2020
The issue has been resolved by this change: Thank you for your good work on this great repository! |
lolrobbe2
pushed a commit
to lolrobbe2/luna
that referenced
this issue
Oct 13, 2022
ocornut/imgui#3522 (VK_FORMAT_B8G8R8A8_UNORM)
Ribosome2
added a commit
to Ribosome2/rasengan
that referenced
this issue
Oct 14, 2022
ocornut
added a commit
that referenced
this issue
Apr 30, 2024
ocornut
pushed a commit
that referenced
this issue
Apr 30, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Build used
Short: Docking GLFW Vulkan, This bug can occur on any Platform.
Version tested:
What is the issue?
This issue is about ImGui causing vulkan validation errors if an VkRenderPass that uses a different valid format for attachment 0, than ImGui would select by default, is passed to ImGui_ImplVulkan_Init. The issue only ocures if at least one UI-Box is dragged out of the main window -> when ImGui has to create its own windows.
What causes the issue?
As ImGui creates separate VkRenderPass objects for each window and then selects its default format for attachment 0, the main and the custom window can have different color formats for attachment 0, if the user selects an other valid format.
This leads to the VkRenderPass objects being incompatible (https://vulkan.lunarg.com/doc/view/1.2.154.1/windows/vkspec.html#renderpass-compatibility).
This wouldn't be a problem if ImGui would use two different VkPipeline objects (each created with the corresponding VkRenderPass) for rendering,
but as it doesn't an issue is caused by the call to ImGui_ImplVulkan_RenderWindow performed by ImGui::RenderPlatformWindowsDefault() when calling ImGui_ImplVulkan_SetupRenderState through calling ImGui_ImplVulkan_RenderDrawData,
because ImGui_ImplVulkan_SetupRenderState binds the global Pipeline g_Pipeline, wich is incompatible with the current renderpass (The renderpass created by ImGui), as it was created with a different format for attachment 0,
because ImGui selected the format used by this window's renderPass(The currently bound renderpass) and the Main window's renderpass (The one used to create g_Pipeline) uses an user selected format for attachment 0 and they don't have to match.
How can it be fixed?
This issue can be fixed in multiple ways, but the best solution I have come up with is to create separate pipelines for the other windows' renderpasses. This would mean that g_Pipeline would be unused and that each ImGui_ImplVulkanH_Window would have its own VkPipeline object.
Standalone, minimal, complete and verifiable example:
Go into eyample_glfw_vulkan/main.cpp
Change line 214 from:
" const VkFormat requestSurfaceImageFormat[] = { VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_B8G8R8_UNORM, VK_FORMAT_R8G8B8_UNORM };"
to " const VkFormat requestSurfaceImageFormat[] = { VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_B8G8R8_UNORM, VK_FORMAT_R8G8B8_UNORM };"
On a platform that supports both VK_FORMAT_B8G8R8A8_UNORM and VK_FORMAT_R8G8B8A8_UNORM
Then run the programm and drag one window like the DEMO window out of the main window.
The actual error produced:
[vulkan] Debug report from ObjectType: 0
Message: Validation Error: [ VUID-vkCmdDrawIndexed-renderPass-02684 ] Object 0: handle = 0x92d209000000002c, type = VK_OBJECT_TYPE_UNKNOWN; Object 1: handle = 0xbd54020000000007, type = VK_OBJECT_TYPE_UNKNOWN; | MessageID = 0x8cb637c2 | vkCmdDrawIndexed(): RenderPasses incompatible between active render pass w/ VkNonDispatchableHandle 0x92d209000000002c[] and pipeline state object w/ VkNonDispatchableHandle 0xbd54020000000007[] Attachment 0 is not compatible with 0: They have different formats.. The Vulkan spec states: The current render pass must be compatible with the renderPass member of the VkGraphicsPipelineCreateInfo structure specified when creating the VkPipeline bound to VK_PIPELINE_BIND_POINT_GRAPHICS (https://vulkan.lunarg.com/doc/view/1.2.154.0/windows/1.2-extensions/vkspec.html#VUID-vkCmdDrawIndexed-renderPass-02684)
Final words
I would be happy if this issue would be resolved, because it took me a lot of time and effort to find it an I don't want others to have to struggle to, like this poor guy(https://stackoverflow.com/questions/61231840/imgui-vulkan-validation-layer-error-when-undocking).
Sincerely MoritzR200
The text was updated successfully, but these errors were encountered: