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

Vulkan global pipeline is unable to distinguish user render-pass vs gw renderpass. #3253

Closed
FunMiles opened this issue May 21, 2020 · 3 comments

Comments

@FunMiles
Copy link
Contributor

Version/Branch of Dear ImGui:

Version: commit 9a363c7c922c04440d0b1901a61e14b796c84fae
Branch: docking
Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_vulkan.cpp + imgui_impl_glfw.cpp
Compiler: clang++
Operating System: Mac OS X / Linux

My Issue/Question:

I am using the docking branch of Dear ImGui in a code of mine. Everything works fine but when one of the Dear ImGui windows is given a new system window, the Vulkan Khronos debug layer gives an error:

Validation Error: [ VUID-vkCmdDrawIndexed-renderPass-02684 ] Object 0: handle = 0x5c000000005c, type = VK_OBJECT_TYPE_RENDER_PASS; Object 1: handle = 0xe000000000e, type = VK_OBJECT_TYPE_RENDER_PASS; | MessageID = 0x8cb637c2 | vkCmdDrawIndexed(): RenderPasses incompatible between active render pass w/ VkRenderPass 0x5c000000005c[] and pipeline state object w/ VkRenderPass 0xe000000000e[] Attachment 4294967295 is not compatible with 1: The first is unused while the second is not.. 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://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkCmdDrawIndexed-renderPass-02684)

I have investigated and the cause is fairly simple. The Dear ImGui rendering system has two paths: one for the main user-created window, in which, for Vulkan the user sets-up the render pass. The other path is the one used for any new window created when un-docking a window from the main window. In that path, ImGui has created its own render pass and keeps it as wd->RenderPass.
However, there is only one VkPipeline ( g_Pipeline ) created. That pipeline is created with the user-supplied render pass. And in general, there's no guarantee that the render pass created for the window is compatible with the user-supplied one.

The solution is to create a pipeline for the internally-created windows and use that pipeline for drawing such windows. The only difficulty is that the window/rendering context is not currently passed to ImGui_ImplVulkan_RenderDrawData.
I will probably start by adding an optional last argument passing the pipeline to be used and if not supplied, the current g_Pipeline will be used.

Standalone, minimal, complete and verifiable example:
I have debugged the issue. I can create a complete verifiable example in the context of the Vookoo framework
It's not exactly what you'd call a minimal example. Is that useful?

@ocornut
Copy link
Owner

ocornut commented Sep 3, 2020

Hello @FunMiles, I haven't been able to look at this in details but a thoughtful pull-request would be appreciated to fix the issue, if you understand it yourself.

@FunMiles
Copy link
Contributor Author

FunMiles commented Sep 6, 2020

HI @ocornut, I have created a pull-request. It refactors some shader-module creation code and adds one member to the externally visible ImGui_ImplVulkanH_Window structure and one arguments to ImGui_ImplVulkan_RenderDrawData with a default argument.
The resulting code should be backward compatible, only requiring to recompile because of the change to the size of the structure.

@ocornut
Copy link
Owner

ocornut commented Sep 8, 2020

All fixed by #3459, thank you!

@ocornut ocornut closed this as completed Sep 8, 2020
ocornut added a commit that referenced this issue Apr 30, 2024
…indow::Pipeline (#6325, #6305, #7398, #3459, #3253, #3522)

As this is currently unused and misleading. Next commit will add a separate pipeline for secondary viewport.
ocornut pushed a commit that referenced this issue Apr 30, 2024
…6325, #6305, #7398, #3459, #3253, #3522)

Edited from original commit: moved ImGui_ImplVulkan_CreatePipeline() call from ImGui_ImplVulkanH_CreateOrResizeWindow() to ImGui_ImplVulkan_CreateWindow().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants