Qt WebEngine 6.6甚至6.5中的新图形集成

QtWebEngine在6.5.1版本中开始使用Metal和D3D11作为默认的QSG后端,提高了Windows和macOS的稳定性和性能。这一变化解决了之前因使用OpenGL后端导致的问题。在6.6版本中,将进一步移除旧的原生OpenGL后端,引入GPU内存缓冲区以增强兼容性和性能。此外,6.5.0版本已支持Linux上的硬件视频加速。
部署运行你感兴趣的模型镜像

New graphics integration in Qt WebEngine 6.6 and even 6.5

Qt WebEngine 6.6甚至6.5中的新图形集成

May 08, 2023 by Allan Sandfeld Jensen | Comments

​2023年5月8日 Allan Sandfeld Jensen | 评论

With the 6.5.1 release, there will be one new change our users might notice. Qt WebEngine has previously forced the Qt Quick SceneGraph to use the OpenGL backend on Windows and macOS, even though the Qt defaults were using D3D11 and Metal respectively. With Qt 6.5.1 Qt WebEngine will now run with the Metal and D3D11 default QSG backends.

随着6.5.1的发布,我们的用户可能会注意到一个新的变化。Qt WebEngine此前曾强制Qt Quick SceneGraph在Windows和macOS上使用OpenGL后端,尽管Qt默认值分别使用D3D11和Metal。有了Qt 6.5.1,Qt WebEngine现在将使用Metal和D3D11默认的QSG后端运行。

This has been a long time coming. Chrome has always preferred using ANGLE on Windows. Where Qt did offer ANGLE in Qt5 but defaulted to WGL (Windows OpenGL), since Qt6 the ANGLE backend has been removed from Qt Gui, and WebEngine required Chromium to run in WGL mode. This has caused many issues, due to buggy Windows OpenGL drivers, and due to not using the same backend as Chrome itself.

这已经持续了很长时间。Chrome一直倾向于在Windows上使用ANGLE。Qt在Qt5中确实提供了ANGLE,但默认为WGL(Windows OpenGL),由于Qt6,ANGLE后端已从Qt Gui中删除,WebEngine需要Chromium在WGL模式下运行。这导致了许多问题,原因是Windows OpenGL驱动程序有缺陷,以及没有使用与Chrome本身相同的后端。

In the last 6 months Chrome has switched to using ANGLE on all their desktop platforms, and also removed the integration code to native OpenGL on Linux/X11 (GLX) and macOS (CGL). On top of this Chrome has plans to move rendering from ANGLE (GL implementation) to Dawn (WebGPU implementation).

在过去的6个月里,Chrome在所有桌面平台上都改用ANGLE,并在Linux/X11(GLX)和macOS(CGL)上删除了与本地OpenGL的集成代码。除此之外,Chrome还计划将渲染从ANGLE(GL实现)转移到Dawn(WebGPU实现)。

Given the diverging differences in backends we can no longer expect Chromium and Qt to run on similar graphics backends, so we will need to bridge whatever Chromium is doing with whatever Qt is doing. The solution will be to render to native GPU memory buffers. On macOS using IOSurface, and on Windows using DXGI. We statically link Qt WebEngine Chromium with ANGLE. Let Chromium render however it wants to native backed buffers, and then pass these GPU memory buffers to the Qt Quick Scene graph in the native Qt RHI graphics modes (currently supporting Metal and D3D11).

考虑到后端的差异,我们不能再指望Chromium和Qt在类似的图形后端上运行,所以我们需要将Chromium正在做的任何事情与Qt正在做的事情桥接起来。解决方案将是渲染到本地GPU内存缓冲区。在使用IOSurface的macOS上,以及在使用DXGI的Windows上。我们将Qt WebEngine Chromium与ANGLE静态链接。让Chromium以其想要的方式渲染到本机支持的缓冲区,然后将这些GPU内存缓冲区传递到本机Qt RHI图形模式下的Qt快速场景图(目前支持Metal和D3D11)。

This should increase stability and performance for Windows and macOS users in 6.5.1, but if it unexpectedly causes any problems for anyone in 6.5.1, the old behaviour can be restored by setting QSG_RHI_BACKEND=opengl, or by calling QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL).

这应该会提高6.5.1中Windows和macOS用户的稳定性和性能,但如果它意外地给6.5.1中的任何人带来任何问题,可以通过设置QSG_RHI_BACKEND=opengl或调用QQuickWindow::setGraphicsApi(QSGRendererInterface::opengl)来恢复旧行为。

For Qt 6.6 this will go further and we will remove the old native OpenGL backends from our fork of Chromium. Chromium itself removed the code long ago, and it is getting increasingly difficult to maintain this old abandoned code. Instead we will import the native GPU memory buffers into OpenGL just like we do for Metal and D3D11. There are a few concerns however, such as the poor quality of WGL_NV_DX_interop2
implementations in Windows OpenGL drivers, and missing functionality in NVidia proprietary drivers on Linux to generate GBM buffers (GBM being the "native" graphics buffers of Linux). This means work is still ongoing for the transition in 6.6.

对于Qt 6.6,这将更进一步,我们将从Chromium的分叉中删除旧的原生OpenGL后端。Chromium本身很早以前就删除了代码,现在维护这个旧的废弃代码变得越来越困难。相反,我们将把原生GPU内存缓冲区导入OpenGL,就像我们对Metal和D3D11所做的那样。然而,也有一些问题,例如Windows OpenGL驱动程序中的WGL_NV_DX_interop2实现质量差,以及Linux上NVidia专有驱动程序中缺少生成GBM缓冲区的功能(GBM是Linux的“本机”图形缓冲区)。这意味着6.6中的过渡工作仍在进行中。

One other side effect of this work, was already shipped in 6.5.0. With the support for native GPU memory buffers, we can now also handle hardware video acceleration on Linux. Luckily even the NVidia drivers support importing GBM buffers for this purpose, even if the rest of the GBM extension is missing.

这项工作的另一个副作用已经在6.5.0中发布。有了对原生GPU内存缓冲区的支持,我们现在也可以在Linux上处理硬件视频加速。幸运的是,即使英伟达驱动程序也支持为此目的导入GBM缓冲区,即使缺少GBM扩展的其余部分。

您可能感兴趣的与本文相关的镜像

Wan2.2-I2V-A14B

Wan2.2-I2V-A14B

图生视频
Wan2.2

Wan2.2是由通义万相开源高效文本到视频生成模型,是有​50亿参数的轻量级视频生成模型,专为快速内容创作优化。支持480P视频生成,具备优秀的时序连贯性和运动推理能力

评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值