-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backends: Vulkan: Added missing font object destruction #4618
Backends: Vulkan: Added missing font object destruction #4618
Conversation
Hello @thomasherzog, |
Hello, |
8b83e0a
to
d735066
Compare
b3b85d8
to
0755767
Compare
c817acb
to
8d39063
Compare
Hi! Do you think this PR will be merged or is there any concerns? In comments on that linked issue it was mentioned that those resources might have been in use by recorded command buffet. One way to solve this issue is to expose That is just another way to look at it, this way you dont need to force device wait idle when it is not needed (first time textures are created) |
Here's my suggestion, but consider I don't fully understand the situation: Add void ImGui_ImplVulkan_DestroyFontsTexture()
{
ImGui_ImplVulkan_Data* bd = ImGui_ImplVulkan_GetBackendData();
ImGui_ImplVulkan_InitInfo* v = &bd->VulkanInitInfo;
if (bd->FontView)
{
vkDestroyImageView(v->Device, bd->FontView, v->Allocator);
bd->FontView = VK_NULL_HANDLE;
}
if (bd->FontImage)
{
vkDestroyImage(v->Device, bd->FontImage, v->Allocator);
bd->FontImage = VK_NULL_HANDLE;
}
if (bd->FontMemory)
{
vkFreeMemory(v->Device, bd->FontMemory, v->Allocator);
bd->FontMemory = VK_NULL_HANDLE;
}
} Add in // Destroy existing texture (if any)
if (bd->FontView || bd->FontImage || bd->FontMemory)
{
vkQueueWaitIdle(v->Queue);
ImGui_ImplVulkan_DestroyFontsTexture();
} This way one can prevent the wait idle by destroying themselves. |
Tagging @thomasherzog @lerppana @guybrush77 Basically I would like a proof-of-concept font reload (based on #3743 (comment)) that passes validation error, so I can merge a change. |
|
I have pushed a fix based on your last linked code + subsequent simplifications, see #6943 (comment) for details. Thanks all ! |
If you use the Vulkan backend and create the font texture twice, three object are not destroyed properly. This problem was already observed in issue #3743. Unfortunately, there wasn't a pull request which is why I'm making one now. Thanks to @guybrush77 who already solved this problem!
For completeness, below are the relevant validation layers without the fix.