Skip to content
Permalink
Browse files

[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>
  • Loading branch information...
alcroito committed May 17, 2017
1 parent 630f7b2 commit 9883dca4714c82079d390da18d1e3ff36f29b5a7
@@ -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.");
@@ -110,6 +110,9 @@ QUrl tst_QQuickWebEngineDefaultSurfaceFormat::urlFromTestPath(const char *localF

void tst_QQuickWebEngineDefaultSurfaceFormat::customDefaultSurfaceFormat()
{
#if !defined(Q_OS_MACOSX)
QSKIP("OpenGL Core Profile is currently only supported on macOS.");
#endif
// Setting a new default QSurfaceFormat with a core OpenGL profile, before
// app instantiation should succeed, without abort() being called.
int argc = 1;
@@ -51,8 +51,8 @@ private Q_SLOTS:

void tst_QWebEngineDefaultSurfaceFormat::customDefaultSurfaceFormat()
{
#if defined(Q_OS_WIN)
QSKIP("Crashes on Windows");
#if !defined(Q_OS_MACOSX)
QSKIP("OpenGL Core Profile is currently only supported on macOS.");
#endif
// Setting a new default QSurfaceFormat with a core OpenGL profile before
// app instantiation should succeed, without abort() being called.

0 comments on commit 9883dca

Please sign in to comment.
You can’t perform that action at this time.