From e132cac0e5ebc07e8b5bdbdef6f26abb23177c91 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 30 Jan 2021 14:38:58 +1000 Subject: [PATCH] ImGui: Clear memory for font after creating texture --- src/frontend-common/imgui_impl_dx11.cpp | 2 ++ src/frontend-common/imgui_impl_opengl3.cpp | 1 + src/frontend-common/imgui_impl_vulkan.cpp | 1 + 3 files changed, 4 insertions(+) diff --git a/src/frontend-common/imgui_impl_dx11.cpp b/src/frontend-common/imgui_impl_dx11.cpp index 9748cb8fd..ffd7c50d7 100644 --- a/src/frontend-common/imgui_impl_dx11.cpp +++ b/src/frontend-common/imgui_impl_dx11.cpp @@ -314,6 +314,8 @@ static void ImGui_ImplDX11_CreateFontsTexture() desc.MaxLOD = 0.f; g_pd3dDevice->CreateSamplerState(&desc, &g_pFontSampler); } + + io.Fonts->ClearTexData(); } bool ImGui_ImplDX11_CreateDeviceObjects() diff --git a/src/frontend-common/imgui_impl_opengl3.cpp b/src/frontend-common/imgui_impl_opengl3.cpp index 3ad3f57d1..c58b9b8ce 100644 --- a/src/frontend-common/imgui_impl_opengl3.cpp +++ b/src/frontend-common/imgui_impl_opengl3.cpp @@ -298,6 +298,7 @@ bool ImGui_ImplOpenGL3_CreateFontsTexture() // Restore state glBindTexture(GL_TEXTURE_2D, last_texture); + io.Fonts->ClearTexData(); return true; } diff --git a/src/frontend-common/imgui_impl_vulkan.cpp b/src/frontend-common/imgui_impl_vulkan.cpp index 06e0a2c44..4bed4d499 100644 --- a/src/frontend-common/imgui_impl_vulkan.cpp +++ b/src/frontend-common/imgui_impl_vulkan.cpp @@ -577,6 +577,7 @@ bool ImGui_ImplVulkan_CreateFontsTexture(VkCommandBuffer command_buffer) // Store our identifier io.Fonts->TexID = (ImTextureID)(intptr_t)&g_FontTexture; + io.Fonts->ClearTexData(); return true; }