diff --git a/llvm/docs/DirectX/DXContainer.rst b/llvm/docs/DirectX/DXContainer.rst index 0e7026b03a606..64c1310707db4 100644 --- a/llvm/docs/DirectX/DXContainer.rst +++ b/llvm/docs/DirectX/DXContainer.rst @@ -496,4 +496,51 @@ signature and passed to the shader without requiring a constant buffer resource: #. **RegisterSpace**: The register space used for the binding. #. **Num32BitValues**: The number of 32-bit values included in this constant buffer. -Root constants provide a fast way to pass small amounts of data directly to the shader without the overhead of creating and binding a constant buffer resource. +Root constants provide a fast way to pass small amounts of data directly to the shader without the +overhead of creating and binding a constant buffer resource. + +Root Descriptor +~~~~~~~~~~~~~~~ + +Root descriptors provide a mechanism for binding individual resources to shader stages in the Direct3D 12 +rendering pipeline. They allow applications to specify how shader stages access specific GPU resources. + +.. code-block:: cpp + + enum RootDescriptorFlags { + None = 0, + DataVolatile = 0x2, + DataStaticWhileSetAtExecute = 0x4, + DataStatic = 0x8, + } + + // Version 1.0 Root Descriptor + struct RootDescriptor_V1_0 { + uint32_t ShaderRegister; + uint32_t RegisterSpace; + }; + + // Version 1.1 Root Descriptor + struct RootDescriptor_V1_1 { + uint32_t ShaderRegister; + uint32_t RegisterSpace; + // Bitfield of flags from the Flags enum + uint32_t Flags; + }; + +Version 1.1 of Root Descriptors has introduced some flags that can hint the drivers into +performing further code optimizations. For details, check +`Direct X documentation `_. + +Version 1.0 Root Descriptor +''''''''''''''''''''''''''' +The Version 1.0 RootDescriptor_V1_0 provides basic resource binding: + +#. **ShaderRegister**: The shader register where the descriptor is bound. +#. **RegisterSpace**: The register space used for the binding. + +Version 1.1 Root Descriptor +''''''''''''''''''''''''''' +The Version 1.1 RootDescriptor_V1_1 extends the base structure with the following additional fields: + +#. **Flags**: Provides additional metadata about the descriptor's usage pattern.