Tutorial 25 – Path Tracing / Render State Packager

Check out a new tutorial that demonstrates how to use a render state packager tool to create pipeline states off-line, pack them into an archive and load at run time.

Diligent Engine allows compiling shaders from source code at run-time and using them to create pipeline states. While simple and convenient, this approach has downsides:

  • Compiling shaders at run-time is expensive. An application that uses a lot of shaders may see significant load times.
  • Compiling shaders at run-time requires bundling the compiler with the engine. For Vulkan, this includes glslang, SPIRV-Tools
    and other components, which significantly increase the binary size.
  • After shaders are compiled, Diligent further needs to patch them to make them compatible with the pipeline resource layout or
    resource signatures.

Pipeline state processing can be completely performed off-line using the Render state packager tool. The tool uses the Diligent Render State Notation, a JSON-based render state description language. One archive produced by the packager can contain multiple pipeline states as well as shaders and pipeline resource signatures that can be loaded and immediately used at run-time without any overhead. Each object can also contain data for different backends (e.g. DX12 and Vulkan), thus one archive can be used on different platforms.

Archivig pipelines off-line provides a number of benefits:

  • Run-time loading overhead is reduced to minimum as no shader compilation or byte code patching is performed.
  • Shader compilation tool chain can be removed from the binary to reduce its size.
  • Render states are separated from the executable code that improves the code structure.
    Shaders and pipeline states can be updated without the need to rebuild the application.
  • Shader compilation errors and pipeline state issues are detected at build time.

In this tutorial, we will use the render state packager to create an archive that contains all pipeline states required to perform basic path tracing.

Leave a Comment

Your email address will not be published.