summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2017-09-13 15:29:02 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-09-17 00:39:46 +0000
commit56474df111738070f6c55d3712ec07565239bad8 (patch)
tree061d322c1e00df1f96b9a749c31ae87ff107657e
parent6d7df67a75ce1a71c1a248d56dfbfab1d9225980 (diff)
[macOS] Fix creation of shared OpenGL 3.2 Core contexts
Due to a current issue described in QTBUG-63180, requesting a 3.2 Core context on macOS will advertise that a 4.1 context was created, even though that is not the case. Because RenderWidgetHostViewQtDelegateWidget will read the OpenGL major version from the global shared context and then apply that to its own context, this will cause a failure to create a shared context (one is 3.2, and the other is 4.1). The current workaround is to create the context with the default format version, instead of the global shared one. This way all the requested versions will be consitent. Task-number: QTBUG-60605 Change-Id: I470c43ca9d15cb3887a0ed968b57c62518a33a72 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
index 55b6001d1..4de425c5b 100644
--- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
+++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
@@ -136,9 +136,25 @@ RenderWidgetHostViewQtDelegateWidget::RenderWidgetHostViewQtDelegateWidget(Rende
// Make sure the OpenGL profile of the QQuickWidget matches the shared context profile.
if (sharedFormat.profile() == QSurfaceFormat::CoreProfile) {
- format.setMajorVersion(sharedFormat.majorVersion());
- format.setMinorVersion(sharedFormat.minorVersion());
- format.setProfile(sharedFormat.profile());
+ int major;
+ int minor;
+ QSurfaceFormat::OpenGLContextProfile profile;
+
+#ifdef Q_OS_MACOS
+ // Due to QTBUG-63180, requesting the sharedFormat.majorVersion() on macOS will lead to
+ // a failed creation of QQuickWidget shared context. Thus make sure to request the
+ // major version specified in the defaultFormat instead.
+ major = defaultFormat.majorVersion();
+ minor = defaultFormat.minorVersion();
+ profile = defaultFormat.profile();
+#else
+ major = sharedFormat.majorVersion();
+ minor = sharedFormat.minorVersion();
+ profile = sharedFormat.profile();
+#endif
+ format.setMajorVersion(major);
+ format.setMinorVersion(minor);
+ format.setProfile(profile);
}
}