New rendering engines for OpenGL and Vulkan have been added to GTK

The developers of the GTK library have announced the availability of two new rendering engines - β€œngl” and β€œvulkan”, using the OpenGL (GL 3.3+ and GLES 3.0+) and Vulkan graphics APIs. New engines are included in the experimental release of GTK 4.13.6. In the experimental GTK branch, the ngl engine is now used by default, but if significant problems are identified in the next stable branch 4.14, the old "gl" rendering engine will be returned.

New engines are positioned as unified and assembled from a single code base. The essence of the unification is that the Vulkan API is used as the basis, on top of which a separate abstraction level has been created for OpenGL, taking into account the differences between OpenGL and Vulkan. This approach made it possible to use a common infrastructure in both engines for processing the scene graph, transformations, caching textures and glyphs. Unification also significantly simplified the maintenance of the code base of both engines and keeping them up to date and synchronized.

Unlike the old gl engine, which used a separate simple shader for each type of render node and periodically re-sorted the data during offscreen rendering, the new engines instead of offscreen rendering use a complex shader (ubershader) that interprets the data from the buffer. In its current form, the new implementation still lags behind the old one in terms of the level of optimizations, since the main focus at the current stage is on correct operation and ease of maintenance.

New features that are missing in the old gl engine:

  • Contour smoothing - allows you to preserve fine details and achieve smoother contours.
    New rendering engines for OpenGL and Vulkan have been added to GTK
  • Formation of arbitrary gradients, which can use any number of colors and anti-aliasing (in the gl engine, only linear, radial and conical gradients with 6 stop colors were supported).
    New rendering engines for OpenGL and Vulkan have been added to GTK
  • Fractional scale, which allows you to set non-integer scale values, for example, when using a scale of 125% for a window of 1200x800, a buffer of 1500x1000 will be allocated, and not 2400x1600 as in the old engine.
  • Support for DMA-BUF technology for using multiple GPUs and offloading individual operations to another GPU.
  • Many rendering nodes that had problems in the old implementation are processed correctly.

The limitations of the new engines include the lack of support for positioning by non-integer values ​​(fractional position) and glshader nodes, which were heavily tied to the features of the old engine, and which were no longer necessary after adding support for nodes with masks (mask) and textures with transparency. It is also mentioned that there is a possibility of possible problems with graphics drivers arising due to changes in the method of working with drivers.

In the future, based on the new unified model, the creation of rendering engines using Metal in macOS and DirectX in Windows is not excluded, but the creation of such engines is complicated by the use of other languages ​​for shaders (the β€œngl” and β€œvulkan” engines use the GLSL language, so for Metal and Direct will have to either duplicate shaders or use a layer based on the SPIRV-Cross toolkit).

Future plans include providing HDR support and tools for correct color management, support for Path rendering on the GPU side, the ability to render glyphs, off-stream rendering, and performance optimizations for older and low-power devices. In its current form, the performance of the "vulkan" engine is close to the performance of the old "gl" engine. The "ngl" engine is inferior in performance to the old "gl" engine, but the available performance is sufficient for rendering at 60 or 144 FPS. It is expected that the situation will change after optimization.

Source: opennet.ru

Add a comment