Qt5: can WebGL work with ANGLE on Windows via QtWebEngine?
-
We are still struggling with viewing some WebGL pages on Windows using Intel graphics hardware. We've tried many combinations of build-time configure flags and runtime settings in 5.9.1 and 5.10.0 releases, but none of them work completely for our particular use case.
We had to patch
web_engine_context.cpp
in a custom Qt build and pass the-ignore-gpu-blacklist
flag to our application for WebGL to work at all (post). And even then, some content does not appear correctly - there are many examples in which geometry appears completely black / unlit (post).Our understanding is that ANGLE is meant to normalize OpenGL operation across most Windows hardware by translating to Direct3D calls, thus removing the dependency on system-specific and GPU-specific OpenGL libraries. Chrome browser uses ANGLE by default, and it works fine with all WebGL content on all hardware we've tried. So we expected that we could make QtWebEngine work more consistently and correctly if we forced Qt to use ANGLE rather than Desktop GL.
But when we try to use ANGLE via the Qt::AA_UseOpenGLES setting, WebGL does not work at all, no matter what hardware we're running on. The
chrome://gpu
settings page reports that in this case, QtWebEngine is actually passing-disable-gpu
and is not using an ANGLE renderer. However it does appear that the proper dlls are being loaded and that GLES is actually being initialized at program startup.In Chrome browser, for instance, we see this line in
chrome://gpu
:GL_RENDERER: ANGLE (NVIDIA Quadro M2000M Direct3D11 vs_5_0 ps_5_0)
But via QtWebEngine,
GL_RENDERER
is blank, all hardware acceleration is disabled, and all WebGL is disabled.Looking at the logic in
web_engine_context.cpp
, it seems that if ANGLE is enabled, then theglType
variable is not set; and ifglType
is not set, then thekDisableGPU
switch is enabled. Is this intended behavior, or a known bug?This has been a very frustrating issue. What are we missing? Should we expect WebGL to work at all with ANGLE? What is the preferred reliable way to get WebGL content to work on Windows, particularly on Intel GPUs?
-
@drmatt said in Qt5: can WebGL work with ANGLE on Windows via QtWebEngine?:
chrome://gpu
Hmm, it reports NVIDIA Quadro M2000M , so i wonder if this on a optimus laptop ?
-
@drmatt
Hi
Well, i cant tell if directly related to you issue but i have had many issue with those
optimus solutions .
Also as you can see , it works on chrome as it uses the nvidia and not the intel.I think you intel HD is new enough for webGL to work
https://www.khronos.org/webgl/wiki/BlacklistsAndWhitelists
but it might have issue anyway.I would ask on the
http://lists.qt-project.org/mailman/listinfo
since we are user here.Since you had to remove it from ignore-gpu-blacklist, it might be a lost cause to make it work but then
you at least know for sure. -
Thank you for the response and suggestions. It may indeed be the case that desktop-based OpenGL is a lost cause for some Intel HD graphics hardware (at least the generations that we're using). We found that even in the latest Chrome browser, on the Surface Pro 3 (which uses Intel hardware exclusively), if we pass
--use-gl=desktop
, we see the same black geometry issues as we see in QtWebEngine.However, this is why we thought that ANGLE exists. When running Chrome with ANGLE, which is the default, WebGL works fine on all hardware we've tested. So we thought that QtWebEngine + ANGLE should also work fine. But we can't get WebGL to work at all with the
Qt::AA_UseOpenGLES
setting, and we're not sure if this is expected behavior or if we're doing something wrong. -
Update: response from the developer mailing list is that WebGL cannot work with ANGLE.
ANGLE does not support multi-threaded access to GL contexts, and that is a requirement for the current Qt Quick Scene Graph implementation used by WebEngine.
So unfortunately we are stuck with using desktop GL, whose performance is subject to the quality of the GPU drivers (which in our case are deficient).
-
On Windows there seems to be at least 6 options for Chromium rendering:
- QT_OPENGL=desktop (using Windows drivers)
- QT_OPENGL=desktop (using MESA)
- QT_OPENGL=angle && QT_ANGLE_PLATFORM = d3d11 / d3d9
- QT_OPENGL=angle && QT_ANGLE_PLATFORM = warp
- QT_OPENGL=software (different from option 2?)
- QMLSCENE_DEVICE=softwarecontext
Have you tried the option #6?
I don't know if WebGL work in this context. -
Nowadays the software renderer for WebGL works fine. I wonder if there is some easy way to detect if the video adapter is affected (probably intel && being "old") and if that's the case, to switch to software renderer, at run-time - maybe before initializing QApplication? in order to pass --enable-webgl-software-rendering parameter programmatically.