-
Notifications
You must be signed in to change notification settings - Fork 127
gl-spectrum: Add modern GL renderer and GtkGLArea support #183
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
base: master
Are you sure you want to change the base?
gl-spectrum: Add modern GL renderer and GtkGLArea support #183
Conversation
Thanks for working on this. 👍 I'm looking forward to try it out when finding some free time.
The main reason for using XWayland by default is that the Winamp interface is unusable on Wayland, see #1560 for more details. Supporting the gl-spectrum plugin on Wayland is of course still beneficial. Questions from a first quick look:
|
Can't we use XWayland only when using the Winamp interface then?
The modern renderer and the GL context creation through GtkGLArea are 2 separate things. If you meant "always use context creation through GtkGLArea for GTK3", I can do it and it would simplify the code without any drawbacks. If you actually meant the modern renderer, I can also do it, but it won't make sense, it would increase the minimal OpenGL requirements without simplifying anything. Modern renderer's minimal requirements are OpenGL 2.1 with ARB_vertex_array_object extension (which became part of the standard since OpenGL 3.0) or OpenGL ES 3.0. We can go even further and always use the modern renderer even with gtk2, if that's what you want, in that case we could remove the legacy rendering and simplify the code. The modern renderer doesn't care how the context was created.
I can do it if that's what you want. In OpenGL core context matrix manipulation functions were removed and people need to implement the matrix math themselves or use something like glm. glm is a header-only dependency hence it's only needed in build-time. |
I found a performance regression with GtkGLArea after docking the plugin, and the performance stays poor even after undocking it back until you restart the app. GTK3 seems to be copying the rendered image back and forth instead of directly displaying it on the screen after docking the plugin. |
Closes audacious-media-player/audacious#1546
AFAIU gl-spectrum plugin using GLX is one of the blockers for transitioning to using wayland by default. Well, not anymore, because I implemented GL context creation through GtkGLArea widget. Unfortunately, there are no good ways to force GtkGLArea to create a legacy GL context, it only falls back to legacy context if creating a core GL context failed, and this plugin used only legacy GL functions for rendering. So I implemented a new renderer which uses modern GL functions. The modern renderer is not uploading the whole scene to GPU on every frame like the legacy one does, but uploads it only once and then uploads only the height map on every frame, which is used calculate the actual geometry in a vertex shader, which should make it faster. The context version is being checked in runtime and the modern renderer is used if requirements are met, if not it's just using the old one. The modern renderer is also used by default in the case of context creation through GLX and Win32. If everything works fine, GLX and Win32 GL context creation code can be safely removed to reduce unnecessary complexity, and it won't change the minimal required OpenGL version as we can always fall back to the legacy rendering.
I also want to note that with the modern renderer cool effects can be added in the future. For now it's just replicating the old one.
Please test in on Windows and macOS before merging, as I can't verify if it's working there (it should).