-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
CustomRect API problems (AddCustomRectRegular) #8107
Comments
Before everything: have you thoroughly measured the performance cost of texture changes? |
I've been working on completely rewriting this system, so it's going to change and I am unlikely to want to put much energy into fixing the existing one, but I will investigate your 3 issues and at minimum try to make sure the new system doesn't have them. I'll keep this open in the meanwhile. Thanks! EDIT I believe if we at least fix (1) which is very easy, it should reduce the occurrences of (2). |
In case of drawing a lot of buttons with custom image and text (Tabs) amount of draw calls was reduced from 27 and 5 to 1 and 1. It improved FPS a little.
It is not a common use case though. It is webgl version on a very outdated hardware. There are other things to improve, but apart from some minor problems, merging of atlases gave me a small visible improvement. |
I forgot to make previous message as a reply. But tl;dr I believe that on more or less modern hardware it wouldn't be a problem, but I have a very specific use case where every small optimization matters. |
Thank you for your thoughtful initial post and answer. |
Yes, it is low priority. I can set texture width and in case of problems I can patch my fork of ImGui to fix at least some mentioned problems. But I believe that hardcoding of width and making manual padding will solve all my issues without touching imgui. |
Version/Branch of Dear ImGui:
Version 1.91.4, Branch: master
Back-ends:
does not apply
Compiler, OS:
does not apply
Full config/build information:
Details:
My Issue:
I use ImGui to draw a custom service menu with some additional graphics like button texture, company logo etc. So far I used additional texture atlas for custom graphics. But for performance reasons I have tried to pack custom graphics in ImGui atlas using custom rect API as described in using-custom-colorful-icons.
It worked fine most of the time, but I found several limitations:
pot(max(custom rects widths) + TexGlyphPadding)
. It can be optionally disabled with ImFontAtlasFlags_ like other things, but it is nice to have consideration.MCVE is not enough for demonstration, so, I prepared the patch file for example_sdl2_opengl3 instead. Unfortunately github doesn't want to attach .patch files, so I provide its content below (it might be easier to make a fork and add link to the commit, but I'm too lazy to make a fork for it at this point).
0001-custom-rect-example.patch
Result looks like this:
requested: 6 colored rects
result: 4 colored rects were added next to each other, 2 rects were silently skipped
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
No response
The text was updated successfully, but these errors were encountered: