diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2018-09-21 12:54:13 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2018-11-12 14:57:58 +0000 |
commit | 396ca081d7b0d9dab7de14ebaec7943c3f857a24 (patch) | |
tree | 23183b1e96d18a2e8dfee0b1f46d7b146097cbd5 /src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp | |
parent | 7ebbd9e39106b3dfbac9de8f3305a7ca8712474d (diff) |
Fix GPU compositing (and WebGL) to work with ANGLE on Windows
Given the changes that implement GPU compositing on the UI thread (and
thus only a single thread accesses all OpenGL contexts) it is now
possible to enable GPU compositing to work together with ANGLE, which
did not work before due to ANGLE being thread-unsafe.
This requires a couple of things:
- Enable GPU compositing via kInProcessGPU switch when using ANGLE
- A small fix in GLContextHelper::getEGLDisplay() to return a
correct "egldisplay "handle
- Improved logic when to pass the kDisableES3GLContext switch
depending on which OpenGL ES version is requested (2 or 3)
- Adjustments in RenderWidgetHostViewQtDelegateWidget() to set up a
correct surface format which matches the shared
context OpenGL ES major version
- A recent enough version of ANGLE (due to bugs calling
glTexImage2D with an unsupported internal texture format for
GL_DEPTH_COMPONENT, from inside
gpu::gles2::IsWebGLDrawBuffersSupported)
By default if no special QSurfaceFormat is set as the default
surface format, using ANGLE will create an OpenGL ES 2 context,
and will thus provide support only for WebGL 1.
To enable OpenGL ES 3 / WebGL 2 support, make sure to set a
default QSurfaceFormat with major version set to 3, and enable
ANGLE either via QT_OPENGL=angle or
QGuiApplication::setAttribute(Qt::AA_UseOpenGLES).
The default surface format must be set before the Q*App instance
is created.
Manual test "webgl" added.
Task-number: QTBUG-53908
Task-number: QTBUG-55604
Task-number: QTBUG-69236
Change-Id: Ic31dfdff1ca22d4689db5cf64126d7d12790aa76
Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp')
-rw-r--r-- | src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp | 38 |
1 files changed, 22 insertions, 16 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 7bbd85091..2753f5d3d 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp @@ -133,25 +133,31 @@ RenderWidgetHostViewQtDelegateWidget::RenderWidgetHostViewQtDelegateWidget(Rende "QSurfaceFormat before the QtGui application instance is created."); } #endif - - // Make sure the OpenGL profile of the QQuickWidget matches the shared context profile. - if (sharedFormat.profile() == QSurfaceFormat::CoreProfile) { - int major; - int minor; - QSurfaceFormat::OpenGLContextProfile 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(); + // 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(); + major = sharedFormat.majorVersion(); + minor = sharedFormat.minorVersion(); + profile = sharedFormat.profile(); +#endif + + // Make sure the OpenGL profile of the QQuickWidget matches the shared context profile. + // It covers the following cases: + // 1) Desktop OpenGL Core Profile. + // 2) Windows ANGLE OpenGL ES profile. + if (sharedFormat.profile() == QSurfaceFormat::CoreProfile +#ifdef Q_OS_WIN + || globalSharedContext->isOpenGLES() #endif + ) { format.setMajorVersion(major); format.setMinorVersion(minor); format.setProfile(profile); |