|
@@ -26,6 +26,7 @@
|
|
|
|
|
|
// CHANGELOG
|
|
|
// (minor and older changes stripped away, please see git history for details)
|
|
|
+// 2025-04-07: Vulkan: Deep-copy ImGui_ImplVulkan_InitInfo::PipelineRenderingCreateInfo's pColorAttachmentFormats buffer when set, in order to reduce common user-error of specifying a pointer to data that gets out of scope. (#8282)
|
|
|
// 2025-02-14: *BREAKING CHANGE*: Added uint32_t api_version to ImGui_ImplVulkan_LoadFunctions().
|
|
|
// 2025-02-13: Vulkan: Added ApiVersion field in ImGui_ImplVulkan_InitInfo. Default to header version if unspecified. Dynamic rendering path loads "vkCmdBeginRendering/vkCmdEndRendering" (without -KHR suffix) on API 1.3. (#8326)
|
|
|
// 2025-01-09: Vulkan: Added IMGUI_IMPL_VULKAN_MINIMUM_IMAGE_SAMPLER_POOL_SIZE to clarify how many image sampler descriptors are expected to be available in descriptor pool. (#6642)
|
|
@@ -1174,6 +1175,16 @@ 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)
|
|
|
+ {
|
|
|
+ // Deep copy buffer to reduce error-rate for end user (#8282)
|
|
|
+ VkFormat* formats_copy = (VkFormat*)IM_ALLOC(sizeof(VkFormat) * v->PipelineRenderingCreateInfo.colorAttachmentCount);
|
|
|
+ memcpy(formats_copy, v->PipelineRenderingCreateInfo.pColorAttachmentFormats, sizeof(VkFormat) * v->PipelineRenderingCreateInfo.colorAttachmentCount);
|
|
|
+ v->PipelineRenderingCreateInfo.pColorAttachmentFormats = formats_copy;
|
|
|
+ }
|
|
|
+#endif
|
|
|
|
|
|
ImGui_ImplVulkan_CreateDeviceObjects();
|
|
|
|
|
@@ -1187,6 +1198,8 @@ void ImGui_ImplVulkan_Shutdown()
|
|
|
ImGuiIO& io = ImGui::GetIO();
|
|
|
|
|
|
ImGui_ImplVulkan_DestroyDeviceObjects();
|
|
|
+ IM_FREE((void*)bd->VulkanInitInfo.PipelineRenderingCreateInfo.pColorAttachmentFormats);
|
|
|
+
|
|
|
io.BackendRendererName = nullptr;
|
|
|
io.BackendRendererUserData = nullptr;
|
|
|
io.BackendFlags &= ~ImGuiBackendFlags_RendererHasVtxOffset;
|