State management and shaders
In Direct3D 11, as noted before, state is managed through a set of state objects. These state objects are bundles of properties in order to allow the user to set a number of properties in bulk and in order to allow the driver to more easily optimize for a certain set of properties at once.
However, two problems pop up under the hood in Direct3D 11:
- These state objects do not necessarily map to objects in the driver, sometimes causing the driver to have to have to recompile more state than ideally would be the case
- Shaders could be swapped at will. Since the state has implications on how the shader will function, the shader combination would always need to be matched against the state of the pipeline
Direct3D 12 and Vulkan combine all shaders and associated state in a pipeline object. This precompiles the combinations used in the API. This reduces the amount of interchangable state, reducing the amount of surprises that can be encountered when swapping state and/or shaders.
- Build 2014: Direct3D 12 API Preview [2:48 − 12:28]