Qt 是不是使用 opengl=angle 修复支持不支持 opengl 2.0 的 Windows 客户端?

Posted

技术标签:

【中文标题】Qt 是不是使用 opengl=angle 修复支持不支持 opengl 2.0 的 Windows 客户端?【英文标题】:Does Qt build with opengl=angle fix support for Windows clients not having opengl 2.0 support?Qt 是否使用 opengl=angle 修复支持不支持 opengl 2.0 的 Windows 客户端? 【发布时间】:2017-05-10 15:41:19 【问题描述】:

我们使用 QtWebEngine 从 Python 绑定构建客户端。不幸的是,这个客户端在一些不支持原生 OpenGL 2.0 的 Windows 系统上崩溃(参见下面的调试)。 如果我设法在 windows 上使用 opengl=angle 编译 qt 是否可行,或者这是一条死路?

我已经花了一整天的时间尝试使用 msys2/mingw64 在 Windows 上从源代码编译 qt,但没有成功就从一个陷阱掉入另一个陷阱,并希望确保这项工作有成功的机会......

谢谢!

P.S.:我也发在Qt forum

qt.qpa.gl: Basic wglCreateContext gives version 1.1
qt.qpa.gl: OpenGL version too low
qt.qpa.gl: OpenGL 2.0 entry points not found
qt.qpa.gl: GPU features: QSet("disable_d3d11", "disable_d3d9", "disable_desktopgl")
qt.qpa.gl: Disabling Desktop GL:  GpuDescription(vendorId=0x0, deviceId=0x0, subSysId=0x0, revision=0, driver: "vm3dum64.dll", version=7.14.1.1233, "R
DPDD Chained DD")
qt.qpa.gl: Disabling D3D11:  GpuDescription(vendorId=0x0, deviceId=0x0, subSysId=0x0, revision=0, driver: "vm3dum64.dll", version=7.14.1.1233, "RDPDD
Chained DD")
qt.qpa.gl: Disabling D3D9:  GpuDescription(vendorId=0x0, deviceId=0x0, subSysId=0x0, revision=0, driver: "vm3dum64.dll", version=7.14.1.1233, "RDPDD C
hained DD")
qt.qpa.gl: QWindowsOpenGLTester::supportedRenderers GpuDescription(vendorId=0x0, deviceId=0x0, subSysId=0x0, revision=0, driver: "vm3dum64.dll", versi
on=7.14.1.1233, "RDPDD Chained DD") renderer:  QFlags(0x8|0x20)
qt.qpa.gl: Qt: Using EGL from libEGL
qt.qpa.gl: Qt: Using OpenGL ES 2.0 from libGLESv2
qt.qpa.gl: QWindowsEGLStaticContext::create Created EGL display 0x3d409b0 v 1 . 4
qt.qpa.gl: QWindowsIntegration::createPlatformOpenGLContext QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSiz
e 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples 0, swapBehavior QSurfaceFormat::SwapBe
havior(DefaultSwapBehavior), swapInterval 1, profile  QSurfaceFormat::OpenGLContextProfile(NoProfile))
qt.qpa.gl: QWindowsIntegration::createPlatformOpenGLContext QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSiz
e -1, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize -1, samples -1, swapBehavior QSurfaceFormat::Swap
Behavior(DefaultSwapBehavior), swapInterval 1, profile  QSurfaceFormat::OpenGLContextProfile(NoProfile))
qt.qpa.gl: QWindowsIntegration::createPlatformOpenGLContext QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSiz
e 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples 0, swapBehavior QSurfaceFormat::SwapBe
havior(DefaultSwapBehavior), swapInterval 1, profile  QSurfaceFormat::OpenGLContextProfile(NoProfile))
qt.qpa.gl: QWindowsIntegration::createPlatformOpenGLContext QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSiz
e 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples 0, swapBehavior QSurfaceFormat::SwapBe
havior(DefaultSwapBehavior), swapInterval 1, profile  QSurfaceFormat::OpenGLContextProfile(NoProfile))
qt.qpa.gl: QWindowsIntegration::createPlatformOpenGLContext QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSiz
e 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples 0, swapBehavior QSurfaceFormat::SwapBe
havior(DefaultSwapBehavior), swapInterval 1, profile  QSurfaceFormat::OpenGLContextProfile(NoProfile))
QOpenGLShader::link: Failed to create D3D shaders.

Could not link shader program:
 "Failed to create D3D shaders.\n"
QOpenGLShader::link: Failed to create D3D shaders.
Failed to create D3D shaders.

【问题讨论】:

【参考方案1】:

不,我认为从支持 ANGLE 的源代码编译 Qt 对您的情况没有帮助。在调试输出中,可以看到 Qt 已经回退到 ANGLE (libGLESv2):

Qt: Using OpenGL ES 2.0 from libGLESv2

这个link 确认它,假设您正在运行 Qt 5.5 或更高版本的预构建二进制包:

当使用 -opengl 动态配置时,Qt 和应用程序都不会 使用 qmake 构建将链接到 opengl32(标准桌面 OpenGL) 或 libGLESv2 (ANGLE) 库。相反,适当的库是 在运行时选择。默认情况下,Qt 会判断系统的 opengl32.dll 提供 OpenGL 2 功能。如果这些存在, 使用opengl32.dll,否则使用ANGLE库。

崩溃的原因似乎是模拟 OpenGL 代码 (ANGLE/Direct3D) 中发生的着色器链接失败。

QOpenGLShader::link: Failed to create D3D shaders.

为什么会发生这种情况是另一回事。首先,我会将 DirectX 更新到最新版本。

【讨论】:

非常感谢您的反馈。它让我朝着正确的方向前进:安装“DirectX End-User Runtimes(2010 年 6 月)”解决了所有问题!【参考方案2】:

talamaki 的评论让我朝着正确的方向前进:

PyQt5 已经支持 QT 5.8.x mimik,方法是首先检查本机 OpenGL 支持,然后回退到 Windows 上的 ANGLE 仿真。 不幸的是,错误堆栈没有提示故障系统缺少什么。经过长时间的研究,我找到了所有无法正常工作的 Windows 系统的解决方案:(重新)安装DirectX End-User Runtimes (June 2010)。看来,Windows 7 缺少一些与 ANGLE 一起使用的 DLL,正如 QT 所期望的那样......

【讨论】:

以上是关于Qt 是不是使用 opengl=angle 修复支持不支持 opengl 2.0 的 Windows 客户端?的主要内容,如果未能解决你的问题,请参考以下文章

在 Win 7 上使用带 ANGLE 的 Qt 时出现空白窗口

如何使用 opengl dekstop 选项配置 Qt?

Qt 开发和 OpenGL 的必要性与 QML 页面

Qt-opengl-debug-SIGSEGV-如何修复?

是否可以通过 D3DImage 和 ANGLE 将 OpenGL ES 代码与 WPF 应用程序一起使用?

OpenGL glRotatef