-
-
Notifications
You must be signed in to change notification settings - Fork 820
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
Improve OpenGL text drawing performance. #3003
Conversation
Great PR! Please pay attention to the following items before merging: Files matching
This is an automatically generated QA checklist based on modified files. |
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.
Thanks for adding your first pull request to Stellarium. If you have questions, please do not hesitate to contact us.
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.
Thanks!
Even though this improves performance, this is still a hack, so it deserves a comment explaining why this object is static and what OS environment needs this. |
I tend to agree with @10110111 on this. The Qt docs of this class warns to be careful when interacting with the GL state. Can we guarantee that nothing can break when we leave a static object for re-use? (Or is it better to use an instance member variable in StelPainter and take care of this?) |
Instance member will be worse because it will partially restore the performance dip, since StelPainter is created and destroyed multiple times per frame. |
Maybe then the StelPainter should be kept alive and handed around for a longer time? |
It's not as easy, because StelPainter restores GL state on destruction. This would require a large refactoring. |
Yes, I know. But if creation&destruction, i.e., state switching&restoring, happen so often, of course this is a plausible cause of slowdown. If we can hand around a StelPainter for a longer time, it should save a lot of overhead. |
I got report about performance regression in Windows also :( |
Does this PR improve the situation? |
macOS 13.2.1, MBP, M1 |
@unpacklo could you share your |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
The code that this PR changed has now been removed, hopefully the performance will be acceptable now. The PR itself is therefore obsolete. |
We can close this, thanks to all participants! |
Description
Improve text drawing performance with OpenGL by using a static instance of
QOpenGLPaintDevice
. I still haven't narrowed down exactly what is causing the performance problem but I can see creating a newQOpenGLPaintDevice
causes everydrawText()
call to create and destroy GL buffer objects.Yields about a 2x speedup for my typical setup which draws lots of lines for the celestial sphere.
Fixes # (issue)
Screenshots (if appropriate):
Before, 10 FPS:
After, 20 FPS:
Type of change
How Has This Been Tested?
Manually ran the change with a locally built stellarium and profiled with Instruments.
Test Configuration:
Intel UHD Graphics 630 1536 MB
Checklist: