summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/web_engine_context.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index 9a96f695e..a3b12b742 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -105,7 +105,9 @@ void destroyContext()
bool usingANGLE()
{
#if defined(Q_OS_WIN)
- return qt_gl_global_share_context()->isOpenGLES();
+ if (qt_gl_global_share_context())
+ return qt_gl_global_share_context()->isOpenGLES();
+ return QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES;
#else
return false;
#endif
@@ -263,10 +265,23 @@ WebEngineContext::WebEngineContext()
parsedCommandLine->AppendSwitch(switches::kDisableGpu);
} else {
const char *glType = 0;
- if (qt_gl_global_share_context()->isOpenGLES()) {
- glType = gfx::kGLImplementationEGLName;
+ if (qt_gl_global_share_context()) {
+ if (qt_gl_global_share_context()->isOpenGLES()) {
+ glType = gfx::kGLImplementationEGLName;
+ } else {
+ glType = gfx::kGLImplementationDesktopName;
+ }
} else {
- glType = gfx::kGLImplementationDesktopName;
+ qWarning("WebEngineContext used before QtWebEngine::initialize()");
+ // We have to assume the default OpenGL module type will be used.
+ switch (QOpenGLContext::openGLModuleType()) {
+ case QOpenGLContext::LibGL:
+ glType = gfx::kGLImplementationDesktopName;
+ break;
+ case QOpenGLContext::LibGLES:
+ glType = gfx::kGLImplementationEGLName;
+ break;
+ }
}
parsedCommandLine->AppendSwitchASCII(switches::kUseGL, glType);