Introducing the Vulkan renderer

Today we’re announcing the upcoming Vulkan renderer support for Flax! Vulkan is a next-generation graphics and compute API that provides high-efficiency and cross-platform access to modern GPUs for PC and mobile platforms. We’re working towards enabling Flax developers to boost the graphics performance of their products.

Vulkan

What’s so great?

Now, Flax supports rendering graphics via DirectX 11, DirectX 12 and Vulkan. Adding Vulkan backend enables us to move towards cross-platform gaming and better performance. The current implementation compared to DX11 results in lower CPU usage (up to 10% less). Beating DX11 drivers is very hard but we have managed to optimize Vulkan implementation and get up to 94% of DX11 performance. However, we will definitely improve this in the future!
Probably, the most important aspect is that we can remove our deprecated and flaky OpenGL backend from the engine and don’t bother supporting it in the future. This is very important especially for mobile platforms on which in most cases Vulkan is faster compared to OpenGL ES (for recent phones – not the ancient ones).
Also, the current Vulkan implementation runs faster than DirectX 12 implementation!


Bringing Vulkan support to Flax gives us the opportunity to achieve our next 4 goals:

  • Linux support
  • Android support
  • Switch support
  • Raytracing

Having stable Vulkan graphics backend is a notable milestone that moves us closer towards adding support for more platforms (who wants Flax Editor for Linux?).

Vulkan Rendering
Vulkan implementation in Flax

Under the hood, we use volk for loading entrypoints, Vulkan Memory Allocator from AMD to improve GPU resources allocation and glslang to compile our HLSL shaders into SPIR-V.
The current implementation supports full graphics pipeline and compute shaders (only stream-output and counter buffers are missing). We use descriptors pool manager to reuse descriptor set layouts and optimized pipeline binding to reduce API calls. The pipeline state objects are cached on request and reused later which reduces memory usage. Also using ring-buffer for uniforms data reduces descriptors changes due to dynamic offset assignment that is more efficient.

How to use it?

Flax supports running Vulkan in cooked game and in Editor. To enable it simply pass -vulkan flag as one of the command line arguments when starting the engine or choose an option to enable Vulkan support in game settings. Then Game Cooker will build all shaders for Vulkan.

Selecting support for Vulkan in cooked game

Please keep in mind that Flax does not perform any shaders compilation at runtime – we cook shaders in Editor so the final game runs super smooth and fast.

Log file with Vulkan support information

The future with Vulkan

We see a huge potential of Vulkan API. It opens ways to new areas for Flax to expand including Linux, Android, and Nintendo Switch support (definitely during this year).
Also, recently NVidia added drivers support for ray-tracing technology on strong GTX cards which helps to bring raytracing support for games. This means: you can expect hardware accelerated raytracing in Flax soon…


Wojciech Figat

Lead Developer

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *