From 974bf58a215cbc71af2f16432fc65a3f50e0d6d1 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 7 Apr 2025 17:38:28 +0200 Subject: [PATCH] Backends: Vulkan: Build and warning fixes. (#8282) --- backends/imgui_impl_vulkan.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backends/imgui_impl_vulkan.cpp b/backends/imgui_impl_vulkan.cpp index b44513a2b..398b81f20 100644 --- a/backends/imgui_impl_vulkan.cpp +++ b/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;