From https://chromium.googlesource.com/angle/angle/+/master/README.md
ANGLE - Almost Native Graphics Layer Engine
The goal of ANGLE is to allow users of multiple operating systems to seamlessly run WebGL and other OpenGL ES content by translating OpenGL ES API calls to one of the hardware-supported APIs available for that platform. ANGLE currently provides translation from OpenGL ES 2.0 and 3.0 to desktop OpenGL, OpenGL ES, Direct3D 9, and Direct3D 11. Support for translation from OpenGL ES to Vulkan is underway, and future plans include compute shader support (ES 3.1) and MacOS support.
Further reading:
- https://wiki.qt.io/Qt_5_on_Windows_ANGLE_and_OpenGL
- https://doc.qt.io/qt-5/configure-options.html#opengl-options-for-windows
- https://doc.qt.io/qt-5/windows-requirements.html#graphics-drivers
- Qt supports using ANGLE and has it included in their source tree.
- Sincd Qt 5.4 it can be compiled to dynamically choose to use desktop OpenGL (installed hardware driver), ANGLE, or a software OpenGL implementation (MESA Gallium llvmpipe).
- ANGLE appears to implement the complete OpenGL ES 3.0. It requires Direct3D11 which is the version that comes with Windows 7 RTM, and it also supports WARP (built-in high-speed D3D11 software implementation), so it should be a suitable alternative for Windows users with broken OpenGL drivers. (We don't officially care Vista or below.)
Aim:
- Krita can support OpenGL ES 3.0 (ANGLE can be considered to be a reference implementation)
- Windows users with broken OpenGL drivers might be able to have GPU-accelerated canvas
- Make use of QT_OPENGL_BUGLIST to ban known broken hardware/drivers from using OpenGL
Current tasks / progress w/ notes:
- Compile Qt 5.9.1 with -opengl dynamic
- I installed the DirectX June 2010 SDK and had to patch some files manually to get it to compile ANGLE properly. These might not be necessary in the future (but fxc.exe is still needed) when upstream fixed the support: https://bugreports.qt.io/browse/QTBUG-52487
- Start Krita with ANGLE without crash (set env QT_OPENGL=angle)
- Have to disable glLogicOp in libs/ui/opengl/kis_opengl_canvas2.cpp (revert D4506, which unfortunately will cause the selection and brush outline to be green again)
- Need to change shader version string to #version 300 es and add a line to fragment shader to set float precision
- Get canvas to render properly
- Area outside of canvas is painted in grey, which is correct.
Checkerboard texture format has to be changed to GL_RGBA instead of GL_BGRA which is not supported by OpenGL ES 3.0. (AFAIK this change should also work for desktop OpenGL.)- Canvas transformations works properly (pan rotate zoom)
- Brush outline (albeit in green), guides, grids, etc. paints without issues
Image data drawn onto canvas is completely black, suspect problem with texture format and binding, verified that text coords are correct and fragment shader can output colours.- The texture formats are changed to support OpenGL ES 3 (and extensions).
- (!) Check the texture pixel formats to make sure they map to D3D11 texture formats directly to avoid additional conversion in ANGLE.
- (!) Fix 10-bit display support (if it even works with ANGLE at all)
- (!) Make sure build system works properly
How to test with ANGLE:
- Checkout branch alvin/T6696-opengl-angle
Add patch set 5 of this code review to ext_qt (add qtbase to the diff paths)Add the patch at this comment on QTBUG-52487 to ext_qt (add qtbase to the diff paths)Apply P84- Set the WindowsSdkDir environment variable to the Window 10 SDK (probably C:\Program Files (x86)\Windows Kits\10)
- Do 3rdparty dependencies build
- Do Krita build.
- Run Krita with the environment variable QT_OPENGL set to angle.
Additional:
Env variables:
- QT_OPENGL
- desktop: installed OpenGL driver
- angle
- software: use ./opengl32sw.dll as driver if available
- QT_ANGLE_PLATFORM
- d3d11
- d3d9: not useful
- warp: software D3D11 renderer
- QT_LOGGING_RULES=qt.qpa.gl=true;krita.ui=true for debugging
- QSG_INFO=1 also for debugging
- QT_OPENGL_BUGLIST to specify custom buglist
My own built ANGLE (built with Qt) does not spit debug messages and I got a crash with WARP, so I copied the DLLs from Chrome for testing. They work fine.