Browse Source

Backends: Vulkan: Build and warning fixes. (#8282)

ocornut 5 tháng trước cách đây
mục cha
commit
974bf58a21
1 tập tin đã thay đổi với 4 bổ sung2 xóa
  1. 4 2
      backends/imgui_impl_vulkan.cpp

+ 4 - 2
backends/imgui_impl_vulkan.cpp

@@ -1175,9 +1175,9 @@ bool    ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info)
         IM_ASSERT(info->RenderPass != VK_NULL_HANDLE);
 
     bd->VulkanInitInfo = *info;
-    ImGui_ImplVulkan_InitInfo* v = &bd->VulkanInitInfo;
 #ifdef IMGUI_IMPL_VULKAN_HAS_DYNAMIC_RENDERING
-    if (bd->VulkanInitInfo.PipelineRenderingCreateInfo.pColorAttachmentFormats != NULL)
+    ImGui_ImplVulkan_InitInfo* v = &bd->VulkanInitInfo;
+    if (v->PipelineRenderingCreateInfo.pColorAttachmentFormats != NULL)
     {
         // Deep copy buffer to reduce error-rate for end user (#8282)
         VkFormat* formats_copy = (VkFormat*)IM_ALLOC(sizeof(VkFormat) * v->PipelineRenderingCreateInfo.colorAttachmentCount);
@@ -1198,7 +1198,9 @@ void ImGui_ImplVulkan_Shutdown()
     ImGuiIO& io = ImGui::GetIO();
 
     ImGui_ImplVulkan_DestroyDeviceObjects();
+#ifdef IMGUI_IMPL_VULKAN_HAS_DYNAMIC_RENDERING
     IM_FREE((void*)bd->VulkanInitInfo.PipelineRenderingCreateInfo.pColorAttachmentFormats);
+#endif
 
     io.BackendRendererName = nullptr;
     io.BackendRendererUserData = nullptr;