Advertisement

Shader Visibility on Root Signature

Started by November 25, 2017 09:07 PM
4 comments, last by _void_ 7 years, 2 months ago

Hello guys!

 

My constant buffer view is used by geometry and pixel shaders but not vertex shader.

What would a good practice in this case to setup  constant buffer view visibility on the root signature?

Is it really worth creating two separate root parameters with visibility D3D12_SHADER_VISIBILITY_GEOMETRY and D3D12_SHADER_VISIBILITY_PIXEL or maybe one root paramter with visiblity D3D12_SHADER_VISIBILITY_ALL will suffice?

Is there a recommended way to set up root signature if the resource is visible to some shader stages but no all? Should you set it up for each stage or just make visible to all?

 

Thanks!

 

On some hardware, the driver/hardware will need to do work for every shader that has visibility into a parameter. On other hardware, work only needs to be done per parameter, regardless of visibility. The happy medium is to declare each parameter with a single shader stage visibility where applicable, ALL where necessary, and then use the overall root signature visibility to scope down what ALL actually means.

Advertisement

@SoldierOfLightThank you for the input!

I do not feel I am compeletely following you on the following statememnt

1 hour ago, SoldierOfLight said:

The happy medium is to declare each parameter with a single shader stage visibility where applicable, ALL where necessary, and then use the overall root signature visibility to scope down what ALL actually means.

What do you specifically mean by "applicable" and "necessary"? Maybe you can give an example.

If your parameters only need to be visible to a single shader stage, then declare them as such. As a general rule of thumb, if they need to be visible to more than one, then declare them with ALL.

@SoldierOfLightThanks!

This topic is closed to new replies.

Advertisement