-
Notifications
You must be signed in to change notification settings - Fork 501
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
sokol_imgui.h: Automatically re-build sokol-gfx resources when Dear ImGui font data has changed. #1010
Conversation
Hmm... that change would leak textures and samplers because they wouldn't be destroyed anywhere. I think the intention is to call the newly exposed functions simgui_destroy_fonts_texture();
// ...
io.Fonts->AddFontFromMemoryTTF(dump_font, sizeof(dump_font), 16.0f, &fontCfg)
simgui_create_fonts_texture(...); ...apart from that, it would probably be a good idea though if I think I'll add the assert, otherwise it's to easy to accidentially leak textures. @Dvad do you have an opinion on this PR? |
I have added a couple of assert to protect from textures leaking in when ...I'm tending towards requiring the user to call those functions explicitly around |
Oh, it did not come to mind that kind of leak 😅. |
I think this PR is a good idea! |
Ok noted :) Then we should come up with a solution that works both implicitly during @elloramir: I'm going to add a couple of minor change requests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
Looks good, thanks! I'll try to do a bit of testing and the merge by tomorrow evening. |
Ok merged! I tested with Thanks for the PR! |
Every time you invoke the io->AddFontXXX functions, imgui invalidates the default atlas texture, as it rebuilds the texture packer and needs to reload the new atlas on the GPU.