Fonts become white rectangles after upgrade to most recent ImGui/SDL3/Vulkan versions and after fixing ABI changes. #7595
Closed
NostraMagister
started this conversation in
Build/Link/Run/Fonts issues ONLY!
Replies: 1 comment
-
(For reference this has been moved to #7602) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I used ImGui 1.89.6 with SDL3 3.0.0 and Vulkan 1.3.250 and with a little tweak for SDL3 I had a good running
system using the ImGui window system to display 4 simultaneous webcams (captured with FFmpeg) as textures.
I upgraded ImGui 1.89.6 to 1.90.6, SDL3 3.0.0 to 3.1.2 and Vulkan 1.3.250 to 1.3.283 and fixed the ABI changes.
Everything still works fine BUT I have a problem with ImGui fonts. All text characters became white square blocks
BUT they can still be used (e.g. clicked to select web-cams) and the code continues to work correctly.
I ignored the following ImGui wiki comment because the default font worked fine before upgrading:
(4) Font atlas texture fails to upload to GPU.
This is often of byproduct of point 3. If you have large number of glyphs or multiple fonts, the texture may become too big for your graphics API. The typical result of failing to upload a texture is if every glyph or everything appears as empty black or white rectangle. Mind the fact that some graphics drivers have texture size limitation. If you are building a PC application, mind the fact that your users may use hardware with lower limitations than yours.
Based on the following ImGui change log comment I made some changes:
command-buffer to upload fonts. Removed ImGui_ImplVulkan_DestroyFontUploadObjects() which is now unnecessary.
No need to call ImGui_ImplVulkan_CreateFontsTexture() as it is done automatically in ImGui_ImplVulkan_NewFrame().
You can call ImGui_ImplVulkan_CreateFontsTexture() manually if you need to reload the font atlas texture.
(Vulkan: Adding leak prevention if the fonts need to be recreated #6943, Backends: Vulkan: fix FontDescriptorSet not free. #6715, Add ImGui_ImplVulkan_DestroyFontsTexture function #6327, Font Texture Atlas leaks when ImGui_ImplVulkan_CreateFontsTexture is called more than once #3743, Backends: Vulkan: Added missing font object destruction #4618)
I had the following code below BEFORE upgrade. The UploadVulkanFonts() method was called WITHOUT first calling this->LoadFonts() (which contain the ImGui's io.Fonts->AddFontDefault() or io.Fonts->AddFontFromFileTTF(...)). That resulted in the default font to be properly loaded anyway. I assumed that it was present standard in the ImGui Font Altas.
// Upload Vulkan backend Fonts into the GPU
void MainWindow::UploadVulkanFonts()
{
VkResult err = VK_SUCCESS;
}
Because ImGui_ImplVulkan_CreateFontsTexture() does not need to be called anymore
according the change log and ImGui_ImplVulkan_DestroyFontUploadObjects() doesn't
exist anymore, the REST/REMAINDER of the above method makes no sense anymore because there is
nothing in the command_buffer anymore. The pervious version of
ImGui_ImplVulkan_CreateFontsTexture(command_buffer) took the buffer as an argument
and filled it.
So I simply changed the above function with a no-op:
void MainWindow::UploadVulkanFonts(){return;}
It doesn't work and shows white cubes as the characters. Then, I also called ImGui's io.Fonts->AddFontDefault() and it doesn't work either, the cubes remain. The function DOES return a font handle for the default font. I assumed that ImGui_ImplVulkan_NewFrame() would load that font.
Can anyone tell me if there is an extra step to do to make the characters re-appear OR should this be converted in an issue?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions