Browse Source

Backends: Vulkan: ImGui_ImplVulkan_CreatePipeline() for secondary viewport always use the RenderPass created by the ImGui_ImplVulkanH_CreateOrResizeWindow(). (#8946, #8110)

ocornut 1 week ago
parent
commit
1f020e526a
2 changed files with 4 additions and 4 deletions
  1. 1 3
      backends/imgui_impl_vulkan.cpp
  2. 3 1
      backends/imgui_impl_vulkan.h

+ 1 - 3
backends/imgui_impl_vulkan.cpp

@@ -1322,8 +1322,6 @@ bool    ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info)
         IM_ASSERT(info->DescriptorPoolSize > 0);
     if (info->UseDynamicRendering)
         IM_ASSERT(info->PipelineInfoMain.RenderPass == VK_NULL_HANDLE && info->PipelineInfoForViewports.RenderPass == VK_NULL_HANDLE);
-    else if (info->PipelineInfoForViewports.RenderPass == NULL)
-        info->PipelineInfoForViewports.RenderPass = info->PipelineInfoMain.RenderPass;
 
     bd->VulkanInitInfo = *info;
 
@@ -2014,7 +2012,7 @@ static void ImGui_ImplVulkan_CreateWindow(ImGuiViewport* viewport)
         }
         else
         {
-            IM_ASSERT(pipeline_info->RenderPass != VK_NULL_HANDLE && "Did you set ImGui_ImplVulkan_InitInfo::PipelineInfoForViewports.RenderPass?"); // Since 1.92.4 it is required.
+            pipeline_info->RenderPass = wd->RenderPass;
         }
 #endif
         bd->PipelineForViewports = ImGui_ImplVulkan_CreatePipeline(v->Device, v->Allocator, VK_NULL_HANDLE, &v->PipelineInfoForViewports);

+ 3 - 1
backends/imgui_impl_vulkan.h

@@ -69,8 +69,10 @@
 // Specify settings to create pipeline and swapchain
 struct ImGui_ImplVulkan_PipelineInfo
 {
-    // For Main and Secondary viewports
+    // For Main viewport only
     VkRenderPass                    RenderPass;                     // Ignored if using dynamic rendering
+
+    // For Main and Secondary viewports
     uint32_t                        Subpass;                        //
     VkSampleCountFlagBits           MSAASamples = {};               // 0 defaults to VK_SAMPLE_COUNT_1_BIT
 #ifdef IMGUI_IMPL_VULKAN_HAS_DYNAMIC_RENDERING