diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp index bfcf3e7e4..c2c4b17c8 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp @@ -1623,6 +1623,7 @@ void VulkanRenderer::Initialize() void VulkanRenderer::Shutdown() { + DeleteFontTextures(); Renderer::Shutdown(); SubmitCommandBuffer(); WaitDeviceIdle(); @@ -2675,6 +2676,7 @@ void VulkanRenderer::RecreateSwapchain(bool mainWindow, bool skipCreate) Vector2i size; if (mainWindow) { + ImGui_ImplVulkan_DestroyFontsTexture(); ImGui_ImplVulkan_Shutdown(); gui_getWindowPhysSize(size.x, size.y); } diff --git a/src/imgui/imgui_impl_vulkan.cpp b/src/imgui/imgui_impl_vulkan.cpp index 723f153c9..f9a23166d 100644 --- a/src/imgui/imgui_impl_vulkan.cpp +++ b/src/imgui/imgui_impl_vulkan.cpp @@ -465,6 +465,15 @@ void ImGui_ImplVulkan_DestroyFontsTexture() if (g_FontView) { vkDestroyImageView(v->Device, g_FontView, v->Allocator); g_FontView = VK_NULL_HANDLE; } if (g_FontImage) { vkDestroyImage(v->Device, g_FontImage, v->Allocator); g_FontImage = VK_NULL_HANDLE; } if (g_FontMemory) { vkFreeMemory(v->Device, g_FontMemory, v->Allocator); g_FontMemory = VK_NULL_HANDLE; } + + ImGuiIO& io = ImGui::GetIO(); + auto texture = io.Fonts->TexID; + if(texture != (ImTextureID)nullptr) + { + ImGui_ImplVulkan_DeleteTexture(texture); + delete (ImGuiTexture*)texture; + io.Fonts->TexID = nullptr; + } } bool ImGui_ImplVulkan_CreateFontsTexture(VkCommandBuffer command_buffer)