🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

DirectX 12 descriptor heap tiers 1-2: unused descriptors?

Started by
1 comment, last by MJP 3 years, 12 months ago

Suppose your shader only uses some subset of the binding slots specified by the root signature (as known at shader compile time). When you bind specific resources with SetGraphicsRootDescriptorTable(), some of the descriptors in the descriptor heap are therefore unused. What exactly must those unused descriptors be for correct behavior across all tier 1-2 hardware?

Must unused descriptors be null, or may they refer to actual resources (possibly used ones bound at the same time)? Are there additional undocumented "some hardware" crashes, beyond texture dimension mismatches?

To highlight the ambiguity, this is everything I could dig up:

http://on-demand.gputechconf.com/gtc/2016/presentation/s6815-oleg-kuznetsov-advanced-rendering-with-directx.pdf

  • Fill all the bindings and descriptor heap entries with sensible data before the CL execution
  • Even if the used shaders do not reference all descriptors
  • Use nullCBVs and nullUAVs with descriptor tables

https://microsoft.github.io/DirectX-Specs/d3d/ResourceBinding.html

For Tier 1 hardware CBV, UAV, SRV and Samplers and Tier 2 hardware CBV and UAV descriptors, the application must put the full number of descriptors defined in the root signature for the corresponding descriptor table being set into the pointed to location in the descriptor heap by the time the command list executes. This is even if the shaders executing may not reference all of the descriptors. In all other cases, the application is only responsible for initializing the descriptor heap with valid descriptors in areas that will actually be referenced during shader execution (by the time shaders actually execute).

https://docs.microsoft.com/en-us/windows/win32/direct3d12/hardware-support

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.

some hardware will crash if shader expects, say, Texture2D but the descriptor heap has another type like Texture1D (even if a NULL descriptor)

Advertisement

They can be either null descriptors, or a descriptor that corresponds to an actual resource. The debug layer will complain if you don't do it correctly.

This topic is closed to new replies.

Advertisement