Deploying Qt5 on Windows without Hardware Accelera

2019-03-08 19:45发布

问题:

Qt5 can use the OpenGL driver or the DirectX Driver by using ANGLE. As we cannot depend on an installed OpenGL driver, we need to use the ANGLE backend. Unfortunately, this doesn't solve all deployment problems especially on Windows virtual machines without hardware acceleration. On these systems, we're getting an error message saying that the creation of an OpenGL context failed.

Screenshot: Failed to create OpenGL context for format QSurfaceFormat

We're deploying all required libraries (libEGL.dll libGLESv2.dll libeay32.dll msvcp110.dll msvcr110.dll d3dcompiler_46.dll) but we're still getting this error message.

How do you deploy a QML application that needs to run on end user machines without OpenGL driver and on (virtual) machines without Direct3D Acceleration?

There is a page on the Qt wiki mentioning this problem, but that's not very helpful for solving it.

Update for Qt 5.4.0:

My findings so far are:

  • Setting QT_ANGLE_PLATFORM=warp -> creates a windows without content.
  • Setting QT_ANGLE_PLATFORM=d3d9 -> same error dialog, as expected.
  • Setting QT_ANGLE_PLATFORM=d3d11 -> same error dialog, as expected.
  • Setting QT_OPENGL=desktop -> same as QT_ANGLE_PLATFORM=warp.
  • Setting QT_OPENGL=angle -> same error dialog, as expected.
  • Setting QT_OPENGL=software + opengl32sw.dll (mesa for windows) -> unpredictable: May run, may crash, may show the error dialog.

Update for Qt Quick 2D Renderer

Although, Mesa seems to be a partial solution, the configration seems to be very crash often in Qt 5.4.0 .

Another fallback could be the Qt Quick 2D Renderer, but unfortunately this crashes too.

  • Copying softwarecontext.dll into /scenegraph + Setting QMLSCENE_DEVICE=softwarecontext -> crash

Update after some user experience:

Angle
  • Has some render bugs on some systems
  • Does not work reliable on all systems
Angle with Warp
  • Not reliable
Desktop OpenGL
  • The default implements OpenGL 1.1, which is too old.
  • Not reliable, even if the OpenGL version is ok.
  • Has render bugs, if used by Qt
QtQuick2dRenderer
  • Has some major render issues
  • Crashes, Freezes
  • Works on systems without HW acceleration
Mesa OpenGL Backend
  • Seems to be quite reliable at the moment
  • quite slow in general, very slow on some systems.
  • Heavy Deployment weight

Conclusion: there is still no real solution for these systems

Update for Qt 5.5

Anno 2015: Broken graphics drives are still broken.

My conclusion for the moment is:

  1. Use QtQuick2dRenderer if possible.
  2. Use Mesa backend otherwise.
  3. Skip Angle, skip Desktop OpenGL, skip Warp.

回答1:

QT 5 has huge compatibility issue with opengl on some hardware configurations Combination of Intel HD3000 driver and Nvidia/ATI card won't work on Windows 10. https://bugreports.qt.io/browse/QTBUG-42240

Intel drops support for this card but their drivers has bug that leads to crash.

You cannot rely on hardware opengl if you want to support customers with HD3000.



回答2:

Under Windows, opengl32.dll is the default OpenGL driver. It implements OpenGL 1.1 (really old version). ANGLE has a baseline of OpenGL ES 2.0 and needs DirectX 9/11 installed to map the calls into.

So if you got a video card that doesn't have an OpenGL driver installed, an OpenGL driver less than 2.0, and/or DirectX 9/11 not installed, your app is not going to work.

In regards to virtualization and 3D acceleration, these maybe worth a read:

  • Why does Qt Creator 3.0.0 Welcome Mode not work in VM?
  • https://bugreports.qt.io/browse/QTBUG-34964

Also, if you run a multi monitor Windows environment under VirtualBox, 3d acceleration will be disabled.