diff options
Diffstat (limited to 'src/core/gl_surface_qt.cpp')
-rw-r--r-- | src/core/gl_surface_qt.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/core/gl_surface_qt.cpp b/src/core/gl_surface_qt.cpp index 8bfbd865c..0d143ee18 100644 --- a/src/core/gl_surface_qt.cpp +++ b/src/core/gl_surface_qt.cpp @@ -72,6 +72,14 @@ #include "ozone/gl_surface_glx_qt.h" #include "ui/gl/gl_glx_api_implementation.h" #include <dlfcn.h> + +#ifndef QT_NO_OPENGL +#include <QOpenGLContext> +QT_BEGIN_NAMESPACE +Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context(); +QT_END_NAMESPACE +#endif + #endif #include "ozone/gl_surface_egl_qt.h" @@ -195,10 +203,20 @@ bool InitializeStaticGLBindings(GLImplementation implementation) { reinterpret_cast<GLGetProcAddressProc>( base::GetFunctionPointerFromNativeLibrary(library, "glXGetProcAddress")); + +#ifndef QT_NO_OPENGL if (!get_proc_address) { - LOG(ERROR) << "glxGetProcAddress not found."; - base::UnloadNativeLibrary(library); - return false; + // glx handle not loaded , fallback to qpa + if (QOpenGLContext *context = qt_gl_global_share_context()) { + get_proc_address = reinterpret_cast<gl::GLGetProcAddressProc>( + context->getProcAddress("glXGetProcAddress")); + } + } +#endif + if (!get_proc_address) { + LOG(ERROR) << "glxGetProcAddress not found."; + base::UnloadNativeLibrary(library); + return false; } SetGLGetProcAddressProc(get_proc_address); |