Skip to content

Vulkan Support

Jan Krassnigg edited this page Oct 15, 2021 · 2 revisions

Introduction

Two people have taken the initiative to add Vulkan support to ez.

Robert Campbell has taken the approach to port another rendering backend from C# to ez: https://github.com/jayrulez/ezEngine/tree/newrhi

Sykzes has attempted a direct implementation of the RendererFoundation interface: https://github.com/ezEngine/ezEngine/pull/348/files

Both have dedicated a lot of time and effort and we are very grateful for the help.

Since the ez renderer was designed only with DX11 in mind, both approaches will ultimately run into problems once the full renderer should be made to work. Therefore the core ez team has decided to invest some time into experimental Vulkan support.

There is no time frame for finishing this project, but even if 'official' support may take a while, early refactorings should still be beneficial for the other initiatives.

Roadmap

The plan is as follows:

  1. Refactor RendererFoundation to incorporate the render pass architecture. ez is already designed this way, however, the render passes are implemented in RendererCore, on top of a more conventional abstraction layer. We will effectively move this architecture to the low level abstraction. This work will be done entirely using the DX11 renderer. Other projects, like Robert's custom backend may be able to benefit from this work. (DONE)

  2. Add support for compiling our HLSL shaders to SPIR-V. This project runs in parallel and is mostly separate from the refactoring work. It is in preparation for any follow up work in a Vulkan renderer. Shaders will be cross compiled from HLSL to SPIR-V using Microsoft's DXC compiler and shader reflection information is extracted using SPIR-V Reflect. (DONE) Since there is currently no way to actually use such a shader, there is no guarantee for correctness and follow up work may be needed, once any Vulkan implementation attempts to bind these shaders.

  3. The direct RendererFoundation port from Sykzes will be checked in and hopefully made to work at some point.

  4. The refactoring work will be checked in as it happens, and should not break the DX11 renderer. The Vulkan/SPIR-V work will be deactivated by default, and has to be enabled through the CMake option EZ_BUILD_EXPERIMENTAL_VULKAN. In C++ code different code paths can be chosen through the preprocessor definition BUILDSYSTEM_ENABLE_VULKAN_SUPPORT. Note that when you enable this, literally nothing will work anymore and every (graphics) application will immediately crash at startup.

Long Term

If at some point the Vulkan port becomes functional, we will abandon the DX11 renderer. We have no intention to maintain both.

Clone this wiki locally