Fix ANGLE/OpenGL swap buffer issues under Windows#3367
Fix ANGLE/OpenGL swap buffer issues under Windows#3367JoergAtGithub wants to merge 8 commits intomixxxdj:2.3from
Conversation
|
Yay! I'm glad you found a solution that doesn't require any hacks overriding the ANGLE version included in Qt. |
|
We still need to copy the ANGLE DLLs into the installer right? Can you add |
daschuer
left a comment
There was a problem hiding this comment.
Thank you for do all the hard debugging and discover this.
I will test this on Linux tomorrow.
| } | ||
| QGLWidget* glw = qobject_cast<QGLWidget*>(pWaveformWidget->getWidget()); | ||
| if (glw != nullptr) { | ||
| glw->makeCurrent(); |
There was a problem hiding this comment.
Does it still work when guarding it with:
if (QGLContext::currentContext() != context()) {
There was a problem hiding this comment.
What should be context() in this statement? I didn't get the context here;-)
There was a problem hiding this comment.
Combine it with the if condition above: if (glw != nullptr && glw->context() != QGLContext::curentContext()) {
There was a problem hiding this comment.
nevermind, that isn't logically equivalent
There was a problem hiding this comment.
@daschuer does glw->makeCurrent() have any performance penalty if the context is already current? Is the check for glw->context() != QGLContext::currentContext() needed?
There was a problem hiding this comment.
The problem seems to be, that the openGL context is sometimes not set to the correct thread: https://doc.qt.io/qt-5/qopenglcontext.html#makeCurrent
In this cases swapBuffers fails, but swapBuffers has to be executed always.
There was a problem hiding this comment.
@daschuer does glw->makeCurrent() have any performance penalty if the context is already current? Is the check for glw->context() != QGLContext::currentContext() needed?
makeCurrent() is expensive. We have the check everywhere else for some reasons.
Maybe this is done internally anyway. in this case we can omit the check.
I need to debug into the code to be sure.
The other puzzling question is why it works with real hardware. Maybe we are doing something wrong that steals the context from the thread in the Angle case.
There was a problem hiding this comment.
Maybe this is done internally anyway.
I checked. It is not. We should do the check before calling makeCurrent.
https://code.woboq.org/qt5/qtbase/src/opengl/qgl.cpp.html#_ZN10QGLContext11makeCurrentEv
|
Please merge or rebase onto 2.3 to include #3368. I merged these two in my own branch to try to get GitHub Actions to build an artifact to test. However, the new |
|
Rebase and stash the commits. |
|
I searched CMakeLists.txt for Should we be using |
I honestly have no idea. Are they always present on windows (i.e. system libraries)? |
|
No, libEGL.dll and libGLESv2.dll come from ANGLE which is included in Qt. They are hacks around the OS not properly supporting OpenGL. |
|
If we link them dynamically without shipping them, won't it cause issues because the windows loader will fail to locate the DLLs? I have no idea how all that stuff works on windows. If you think it's an improvement, try it. |
|
cpack failed again: It seems Qt5_DIR is not initialized at the point where the I think it is worth a try uncommenting |
I am thinking cpack might automatically include them in the MSI installer if they are linked by cmake. I could be wrong about that though. |
|
🤷 |
I tested this and it does not work. Linking fails. |
Other approach to add ANGLE DLLs to cmake
|
I fixed the CMakeLists.txt and cleaned up the Git history in #3370. |
|
Thank you @JoergAtGithub for working on this! |

This fixes the bugs https://bugs.launchpad.net/mixxx/+bug/1895427 and https://bugs.launchpad.net/mixxx/+bug/1872172 under the OpenGL emulation ANGLE.
I tested this fix with ANGLE the angle library, that comes with 2.3-j00019-x64-release-fastbuild-static-55e94982-minimal as part of the Qt 5.14.2.
It also works if I set QT_OPENGL to desktop to use the native OpenGL driver of my Intel HD Graphics 3000 GPU.
I can't test the behaviour on other platforms.
Furthermore it fixes issue https://bugs.launchpad.net/mixxx/+bug/1905123 by adding the missing ANGLE DLLs to the windows installer.