direct3ddirectx-12direct3d12

What is the best strategy to create root signature in d3d12?


I am trying to reinvent wheel of d3d12 encapsulation. And I suddenly got an idea that bundle up the pipeline and generate one root signature for them. The problems confuse me currently are:

  1. When to use root descriptors and when descriptor tables for my resources, what are their limitations and purposes?
  2. How to handle registers collision between different descriptor tables and root descriptors?
  3. What are common strategies to implement root signature generation and is there alternatives?

If there is any useful resources related to my question, i would highly appreciate it. (Modified in 6.15)


Solution

  • updated

    1.) Descriptor tables allows out of bounds indexing and desc.table IS required for textures, so for example you can use root descriptors for buffer resources and descriptor tables for textures etc, or even use it for buffers too - not only it allows out of bounds indexing but also makes mybuffer.GetDimensions(length,stride) output your corresponding buffer length and stride, it doesn't without descriptor tables.

    2.) To separate different descriptors/tables that uses same binding registers there is register spaces in d3d12, you can use that to separate desc.tables which uses same registers or for example to separate root descriptors from desc.tables

    3.) As far as im aware of big game/rendering engines doesn't rely on root signature generation for compatibility with older/less capable hardware which has limited amount of binding slots, they seem to use either atlas or resource arrays(Texture1DArray, Texture2DArray) that is dynamically indexed, but for root signature generation i think most common approach would be to just use shader reflection and static root signature and/or using unbounded descriptor tables(descriptor arrays in shader) with dynamic indexing.
    There is one alternative you can also use if you are fine with using shader model 6.6 features, bindless descriptors - allows to mostly(even fully) avoid specifying root signature for your resources, all that you'll have to do is actually create your resources and views/descriptors, and store index of your resource in the buffer.