diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-07-29 14:09:05 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-08-02 12:00:57 +0200 |
commit | 1a49f193afe1ba54339182a49d891917159f6719 (patch) | |
tree | 986cf277193c625c2f61015c7f29c6b403a5eb02 /src/core/web_engine_context.cpp | |
parent | 47d6b5ce11d1014548ba69df5d7b698381a8343e (diff) | |
parent | fa138d4a76e9e820f01a75771c30dbced8c4e6f3 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
src/3rdparty
src/core/resources/resources.gyp
src/webengine/doc/src/qtwebengine-overview.qdoc
src/webenginewidgets/api/qwebenginepage.cpp
src/webenginewidgets/api/qwebenginescriptcollection.cpp
src/webenginewidgets/api/qwebenginescriptcollection_p.h
tests/auto/widgets/qwebenginepage/BLACKLIST
And readded newly in 5.6 enabled tests to the BLACKLIST.
Change-Id: I4ab1fc54ebfaaf940df81b0d8d6bdd15cae8b7c4
Diffstat (limited to 'src/core/web_engine_context.cpp')
-rw-r--r-- | src/core/web_engine_context.cpp | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 6da80e94d..98fba0897 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -86,8 +86,10 @@ #include "web_engine_library_info.h" #include <QFileInfo> #include <QGuiApplication> +#include <QOffscreenSurface> #include <QOpenGLContext> #include <QStringList> +#include <QSurfaceFormat> #include <QVector> #include <qpa/qplatformnativeinterface.h> @@ -294,15 +296,40 @@ WebEngineContext::WebEngineContext() GLContextHelper::initialize(); - if (usingANGLE() || usingSoftwareDynamicGL() || usingQtQuick2DRenderer()) { - parsedCommandLine->AppendSwitch(switches::kDisableGpu); - } else { - const char *glType = 0; + const char *glType = 0; + if (!usingANGLE() && !usingSoftwareDynamicGL() && !usingQtQuick2DRenderer()) { if (qt_gl_global_share_context()) { - if (qt_gl_global_share_context()->isOpenGLES()) { - glType = gfx::kGLImplementationEGLName; + if (!strcmp(qt_gl_global_share_context()->nativeHandle().typeName(), "QEGLNativeContext")) { + if (qt_gl_global_share_context()->isOpenGLES()) { + glType = gfx::kGLImplementationEGLName; + } else { + QOpenGLContext context; + QSurfaceFormat format; + + format.setRenderableType(QSurfaceFormat::OpenGLES); + format.setVersion(2, 0); + + context.setFormat(format); + context.setShareContext(qt_gl_global_share_context()); + if (context.create()) { + QOffscreenSurface surface; + + surface.setFormat(format); + surface.create(); + + if (context.makeCurrent(&surface)) { + if (context.hasExtension("GL_ARB_ES2_compatibility")) + glType = gfx::kGLImplementationEGLName; + + context.doneCurrent(); + } + + surface.destroy(); + } + } } else { - glType = gfx::kGLImplementationDesktopName; + if (!qt_gl_global_share_context()->isOpenGLES()) + glType = gfx::kGLImplementationDesktopName; } } else { qWarning("WebEngineContext used before QtWebEngine::initialize()"); @@ -316,9 +343,12 @@ WebEngineContext::WebEngineContext() break; } } + } + if (glType) parsedCommandLine->AppendSwitchASCII(switches::kUseGL, glType); - } + else + parsedCommandLine->AppendSwitch(switches::kDisableGpu); content::UtilityProcessHostImpl::RegisterUtilityMainThreadFactory(content::CreateInProcessUtilityThread); content::RenderProcessHostImpl::RegisterRendererMainThreadFactory(content::CreateInProcessRendererThread); |