Unpopulated root signatures.

Started by
7 comments, last by MJP 6 years, 6 months ago

Hi,

Quote

There is an additional restriction for Tier 1 hardware that applies to all heaps, and to Tier 2 hardware that applies to CBV and UAV heaps, that all descriptor heap entries covered by descriptor tables in the root signature must be populated with descriptors by the time the shader executes, even if the shader (perhaps due to branching) does not need the descriptor. There is no such restriction for Tier 3 hardware. One mitigation for this restriction is the diligent use of Null descriptors.

(from: https://msdn.microsoft.com/en-us/library/windows/desktop/dn899109(v=vs.85).aspx#Null_descriptors

Does this mean that, I need to declare root signatures with all the slots even if I don't use them, or does it mean that every entry in the root signature must be populated? 

Sorry if I it is too obvious but I've read things related to this from different sources and I'm a bit confused :S.

Thanks.

Advertisement

The root signature needs to declare all data your shaders expect. If your shaders don't expect any data, you can simply use a blank root signature. The root signature is simply like a parameter list (function signature) for your shader pipeline:


RenderTarget ExecutePipeline(RootSignature sig); // obviously this is not a real representation

 

1 minute ago, iedoc said:

The root signature needs to define all data your shaders expect. If your shaders don't expect any data, you can simply use a blank root signature. The root signature is simply like a parameter list (function signature) for your shader pipeline:



void ExecutePipeline(RootSignature sig);

 

Yeah I get that, but what about that restriction? It forces you to make a root signature with lets say 14 CBV? Or it just forces you to make sure each declared CBV has a view?

It's just saying, if your shaders expect 14 cbv's, you're root signature needs to represent that.

Alright, my confusion was, that I though that it will force to have 14CBV declared in the root signature and fill the unused with null views. 

Quote

all descriptor heap entries covered by descriptor tables in the root signature must be populated with descriptors by the time the shader executes

this is saying that all the descriptors that a descriptor table points to (the table which the root signature is pointing to), MUST exist before your shader runs

Nope, you don't need to fill out anything that your not using

Alright thanks for clarifying it :)  

For Tier 2 your entire shader-visible UAV and CBV descriptor tables need to have valid descriptors in them. So if your root signature specifies a descriptor table with 8 UAV's and your shader only uses 4, then there still needs to be 8 valid UAV descriptors in the table that you specify with SetGraphicsRootDescriptorTable. NULL descriptors count as "valid" in this case, so you can fill up the rest of your table with NULL descriptors if you want. 

The validation layer will complain at you if you mess this up, but unfortunately it will only do this if you run on Tier 2 hardware.  There's not a whole lot of DX12-capable Tier 2 hardware out there ever since Nvidia upgraded their Maxwell and Pascal GPU's to Tier 3.

This topic is closed to new replies.

Advertisement