diff options
3 files changed, 20 insertions, 3 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."); diff --git a/tests/auto/quick/qquickwebenginedefaultsurfaceformat/tst_qquickwebenginedefaultsurfaceformat.cpp b/tests/auto/quick/qquickwebenginedefaultsurfaceformat/tst_qquickwebenginedefaultsurfaceformat.cpp index 3d44efa6a..2afaf03a3 100644 --- a/tests/auto/quick/qquickwebenginedefaultsurfaceformat/tst_qquickwebenginedefaultsurfaceformat.cpp +++ b/tests/auto/quick/qquickwebenginedefaultsurfaceformat/tst_qquickwebenginedefaultsurfaceformat.cpp @@ -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; diff --git a/tests/auto/widgets/qwebenginedefaultsurfaceformat/tst_qwebenginedefaultsurfaceformat.cpp b/tests/auto/widgets/qwebenginedefaultsurfaceformat/tst_qwebenginedefaultsurfaceformat.cpp index 3757a7842..1e8cc74e2 100644 --- a/tests/auto/widgets/qwebenginedefaultsurfaceformat/tst_qwebenginedefaultsurfaceformat.cpp +++ b/tests/auto/widgets/qwebenginedefaultsurfaceformat/tst_qwebenginedefaultsurfaceformat.cpp @@ -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. |