diff options
author | Alexandru Croitor <alexandru.croitor@theqtcompany.com> | 2016-02-22 16:08:29 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@theqtcompany.com> | 2016-03-31 08:14:38 +0000 |
commit | bc00d396585e75dcaaed5e954519723b5046e070 (patch) | |
tree | 40235def15c4da529b9e0dcc3e5aab1cb4cacd2a /src/webengine/render_widget_host_view_qt_delegate_quick.cpp | |
parent | 6de2c94b01fa249c3d051a472ce4073eedebe84e (diff) |
OSX: Fix QSurfaceFormat check to allow < 3.2 OpenGL profiles.
Currently if a < 3.2 OpenGL Compatibility profile is requested on OSX,
a webengine application would crash saying that the global profile
does not match the default profile. That happens because in the Cocoa
QPA any requested OpenGL Compatibility profile or Core profile with
version smaller than 3.2 gets reset to QSurfaceFormat::NoProfile and
version 2.1.
Fix consists in making sure that the QSurfaceFormat check only
considers Core profile with versions >= 3.2. All other combinations
would result in NoProfile 2.1 and thus not cause any issues for
webengine.
Change-Id: I7c9866d761c052e52389022abe8e213d062db41f
Task-number: QTBUG-51058
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Diffstat (limited to 'src/webengine/render_widget_host_view_qt_delegate_quick.cpp')
-rw-r--r-- | src/webengine/render_widget_host_view_qt_delegate_quick.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp index b667bbc5c..3ba3d117e 100644 --- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp +++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp @@ -63,14 +63,19 @@ RenderWidgetHostViewQtDelegateQuick::RenderWidgetHostViewQtDelegateQuick(RenderW setActiveFocusOnTab(true); #ifdef Q_OS_OSX - // Check that the default QSurfaceFormat OpenGL profile matches the global OpenGL shared - // context profile, otherwise this could lead to a nasty crash. + // Check that the default QSurfaceFormat OpenGL profile is compatible with the global OpenGL + // shared context profile, otherwise this could lead to a nasty crash. QOpenGLContext *globalSharedContext = QOpenGLContext::globalShareContext(); if (globalSharedContext) { QSurfaceFormat sharedFormat = globalSharedContext->format(); QSurfaceFormat defaultFormat = QSurfaceFormat::defaultFormat(); - if (defaultFormat.profile() != sharedFormat.profile()) { - qFatal("QWebEngine: Default QSurfaceFormat OpenGL profile does not match global shared context OpenGL profile. Please make sure you set a new QSurfaceFormat before the QtGui application instance is created."); + + if (defaultFormat.profile() != sharedFormat.profile() + && defaultFormat.profile() == QSurfaceFormat::CoreProfile + && defaultFormat.version() >= qMakePair(3, 2)) { + qFatal("QWebEngine: Default QSurfaceFormat OpenGL profile is not compatible with the " + "global shared context OpenGL profile. Please make sure you set a compatible " + "QSurfaceFormat before the QtGui application instance is created."); } } #endif |