I am a little confused about the existence of the ID3D12GraphicsCommandList::SetGraphicsRootSignature
method. From what I understand of this MSDN page, it seems that the only valid usage of it is to always call it after SetPipelineState
, giving it the same root signature as was provided when creating the pipeline state object. If that's so, what benefit is there to it not being implicit? Are there other ways to use this method?
It is CPU optimisation, internally it is possible to prepare part of a mapping from the root signature slots to the actual binding. If you share a root signature between different pipeline state objects, then this work can be done once per root signature instead of once per pipeline state object.
You are likely to call SetGraphicsRootSignature
less often then SetGraphicPipelineState
. This is why.
The "root signature" in DirectX 12 provides the common layout information for sharing data between the CPU data structures and the GPU shader language execution. DirectX 12 makes the programmer decide how many root signatures they want to use, when to use them, and which pipeline state objects need which root signature. In Direct3D 11, there's essentially one "root signature" active at all times which is quite large.
Root signatures can be changed fairly often without a major penalty, but the assumption is that you will have a few root signatures and many PSOs rather than a 1:1 correspondence.
For simplicity in DirectX Tool Kit for DirectX 12, we set the root signature every time we set the PSO in the
IEffect::Apply
method, even though we only use a few different root signatures.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With