Diligent Engine 2.0: Powered by Direct3D12

Next generation graphics APIs like Direct3D12 and Vulkan significantly reduce CPU overhead by providing low-level hardware abstraction. Diligent Engine has been updated to take advantages of the new APIs. Alpha-release of version 2.0 supports Direct3D12 and is now available on GitHub.

Several modifications to the engine were implemented to better match Direct3D12. First, all coarse-grain state objects such as Depth Stencil State, Blend State and Rasterizer State as well as shader and other states were combined into single Pipeline State object. The following example illustrates creation of a Pipeline Sate object in Diligent Engine 2.0:


Once PSO is created, it can be bound to the device context with SetPipelineState()  method:

Second big change deals with the resource binding model. In Diligent Engine 1.0, resources were bound directly to shaders, which is the old-API style. To better fit next-generation APIs, Diligent Engine 2.0 implements a new binding model. The model introduces Shader Resource Binding object and classifies shader variables into one of three categories:

  • Static variables are constant across all shader instances. They must be set once directly through IShader::BindResources()  or through the shader variable interface queried from the shader.
  • Mutable variables are constant across shader resource bindings instance. They must be set once through IShaderResourceBinding::BindResources()  or through the shader variable interface queried from the resource binding. Mutable variables cannot be set through IShader  interface.
  • Dynamic variables can be set multiple times for every instance of shader resource binding. They cannot be set through IShader interface.

Shader Resource Binding objects are created by the Pipeline State:

To set resources within a shader resource binding, IShaderResourceBinding::BindResources() method can be used in the same way it was used in Diligent Engine 1.0. Alternatively, specific variable can be queried and initialized:

In Diligent Engine 2.0, resources are bound explicitly to the graphics pipeline by the  CommitShaderResources()  method of the device context. The method takes shader resource binding as an argument:

Diligent Engine 2.0 also implements OpenGL and Direct3D11 back-ends. Alpha release is only available on Windows platform. Direct3D11 back-end is very thoroughly optimized and has very low overhead compared to native implementation. Direct3D12 implementation, to the contrary, is preliminary and not yet optimized.

Leave a Comment

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