diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2017-05-17 16:56:30 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2017-07-11 09:35:32 +0000 |
commit | 9883dca4714c82079d390da18d1e3ff36f29b5a7 (patch) | |
tree | 2118481825e551a3e0bc301ad5982cac636259be /src/core | |
parent | 630f7b24f67646b05a2222761b192316123d8931 (diff) |
[macOS] Use the OpenGL CoreProfile when the global shared context does
Previously when a default QSurfaceFormat was set with an OpenGL Core
profile, all the contexts created on the Qt side would obey the profile,
but Chromium would still use the Compatibility profile for its contexts
leading to warnings when trying to create shared contexts.
The fix is to check which OpenGL profile is used in the Qt global
shared context, and pass that information along to Chromium.
Note that this works only on macOS for now, and the default non-Core
profile is used on other platforms, even though Core was requested.
Passing CoreProfile to Chromium on Windows and Linux currently leads
to crashes.
Task-number: QTBUG-60605
Change-Id: I27a77091923624d19ccc2019953a5b07f9282916
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/web_engine_context.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 2748d2a0f..56dbb84b7 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -389,8 +389,22 @@ WebEngineContext::WebEngineContext() } } } else { - if (!qt_gl_global_share_context()->isOpenGLES()) + if (!qt_gl_global_share_context()->isOpenGLES()) { + // Default to Desktop non-Core profile OpenGL. glType = gl::kGLImplementationDesktopName; + + // Check if Core profile was requested and is supported. + QSurfaceFormat globalSharedFormat = qt_gl_global_share_context()->format(); + if (globalSharedFormat.profile() == QSurfaceFormat::CoreProfile) { +#ifdef Q_OS_MACOS + glType = gl::kGLImplementationCoreProfileName; +#else + qWarning("An OpenGL Core Profile was requested, but it is not supported " + "on the current platform. Falling back to a non-Core profile. " + "Note that this might cause rendering issues."); +#endif + } + } } } else { qWarning("WebEngineContext used before QtWebEngine::initialize() or OpenGL context creation failed."); |