Jump to content
  • Advertisement
Sign in to follow this  
grizu

DX12 Shader parameters & dynamic root signature

This topic is 725 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm building a small framework with DirectX 12. 
Current topic is the handling of shader parameters and the DX 12 root signature.
 
When loading a shader, I reflect all its bind points, and register them with a central ParamManager by name.
The application provides the data from various points (global frame data, material data, mvp, etc.).
Before draw, the ParamManager should be able to resolve all bindings.
 
It isn't finished yet, but looks like it could work quite well. Main inspiration for this is the Hieroglyph3 engine (http://hieroglyph3.codeplex.com/).
 
Now, how should I handle the DX 12 root signature?
 
I think about doing this:
 
- for each binding in the shader, specify its update frequency: per frame, per material, per object.
It would be great if this could be done with custom annotations. I.e:
 

[UsageStatic] ConstantBuffer<PerFrameData> : register(b0) 

Idea taken from: http://diligentgraphics.com/2016/03/23/resource-binding-model-in-diligent-engine-2-0/
 
- I would then, after initial load of all shaders, loop through all needed parameters, group them by frequency, and dynamically build a root signature. There could maybe be one root signature per pass. Maybe shaders could also specify an annotation like [HintUseOwnRootSignature] for special cases.
 
 
1. Is this a meaningful approach or just nonsense? :) Should I just hardcode some root signature and make sure the shaders match? Bind CBs to slots by convection maybe? How do you handle the root signature? I also like the idea of specifying the signature in HLSL.
 
2. Would this custom annotation-thing work? I'm not sure how to specify metadata (all shaders are pure hlsl) in a simple way. I've seen this done with Lua, XML, Json, ...
 
 
I think this dynamic-signature-approach could also work, if at some point I decide to only use dynamic indexing. It's still just grouped parameters.
 

Thanks for reading and your help  :)

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!