Pipeline state

In Direct3D 11, shaders and several state objects were created separately. This caused several small performance hitches and inefficiencies, because these shaders and state objects had to be matched at runtime. Direct3D 12 solves this problem by forcing the user to precompile the shaders and associated state into pipeline state objects.

The D3D11 state included in the pipeline state is as follows:

  • All shader bytecode
  • The root signature layout used by the shaders
  • All D3D11 state objects (rasterizer state, depth stencil state & blend state)
  • Input layout
  • All render target formats for each slot used by the shaders

This allows the driver to optimize the pipeline for the input and output properties ahead-of-time, so the runtime performance cost will be minimized to the furthest extent possible.

It should be noted that the construction of pipeline state objects can take a considerable amount of time, and should be created on separate threads when created at runtime. In addition, a binary blob can be obtained from the pipeline state object for storage on disc. This cached blob should be preferred when possible, as it cuts a lot of the heavy operations involved in the creation of a pipeline state.