Contents
How is the root signature specified in HLSL?
The HLSL root signature language closely corresponds to the C++ root signature APIs and has equivalent expressive power. The root signature is specified as a sequence of clauses, separated by comma. The order of clauses is important, as the order of parsing determines the slot position in the root signature.
How to create a root signature for a shader?
If a shader has been authored with a root signature in it (when that capability is added), then the compiled shader will contain a serialized root signature in it already. If an application procedurally generates a D3D12_ROOT_SIGNATURE_DESC data structure, it must make the serialized form using D3D12SerializeRootSignature.
When to use D3D12 root descriptor in shader?
The D3D12_ROOT_DESCRIPTOR structure declares descriptors (that appear in shaders) inline in the root signature. This struct is used when the root signature slot type is set to D3D12_ROOT_PARAMETER_TYPE_CBV, D3D12_ROOT_PARAMETER_TYPE_SRV or D3D12_ROOT_PARAMETER_TYPE_UAV.
Do you put descriptors in the root signature?
Applications can put descriptors directly in the root signature to avoid having to go through a descriptor heap. These descriptors take a lot of space in the root signature (see the root signature limits section), so applications have to use them sparingly.
Can a shader be passed in without a root signature?
If a root signature is not passed in, all shaders passed in must have a root signature and they must match – this will be given to the driver. Setting a PSO on a command list or bundle does not change the root signature.
What are root signatures for graphics and compute?
A root signature is configured by the app and links command lists to the resources the shaders require. The graphics command list has both a graphics and compute root signature. A compute command list will simply have one compute root signature. These root signatures are independent of each other.
When to use serialized form for root signature?
The serialized form is what is passed into the API when creating a root signature. If a shader has been authored with a root signature in it (when that capability is added), then the compiled shader will contain a serialized root signature in it already.