llvm-c166/llvm/docs/DirectX/RootSignatures.md
Reid Kleckner d0b078ef5b
[docs] Finish MyST migration for PDB, DirectX, and GlobalISel docs (#217159)
Tracking issue: #201242
See the [migration guide] for more information. 

[migration guide]:
https://llvm.org/docs/SphinxQuickstartTemplate.html#markdown-migration-guidelines
This is a stacked PR based on #217157 , which will be a standalone
commit that
renames *.rst -> *.md before this PR lands for history preservation
purposes.

This was prepared with rst2myst plus LLM-assisted cleanup. 

I rendered the HTML and ran a pixel differ over it, and all the diffs
look intended, but I have *not* gone over the markup in detail. I
encourage reviewers to try to spot check content they care about, or
look at complex constructs and prioritize reviewing those, rather than
fixating on markup nits.

-----

Before/after validation links:
| Source file | Before HTML | After HTML |
| --- | --- | --- |
| `llvm/docs/DirectX/DXContainer.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/DirectX/DXContainer.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/DirectX/DXContainer.html)
|
| `llvm/docs/DirectX/DXILArchitecture.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/DirectX/DXILArchitecture.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/DirectX/DXILArchitecture.html)
|
| `llvm/docs/DirectX/DXILOpTableGenDesign.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/DirectX/DXILOpTableGenDesign.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/DirectX/DXILOpTableGenDesign.html)
|
| `llvm/docs/DirectX/DXILResources.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/DirectX/DXILResources.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/DirectX/DXILResources.html)
|
| `llvm/docs/DirectX/RootSignatures.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/DirectX/RootSignatures.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/DirectX/RootSignatures.html)
|
| `llvm/docs/GlobalISel/GMIR.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/GlobalISel/GMIR.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/GlobalISel/GMIR.html)
|
| `llvm/docs/GlobalISel/GenericOpcode.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/GlobalISel/GenericOpcode.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/GlobalISel/GenericOpcode.html)
|
| `llvm/docs/GlobalISel/IRTranslator.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/GlobalISel/IRTranslator.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/GlobalISel/IRTranslator.html)
|
| `llvm/docs/GlobalISel/InstructionSelect.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/GlobalISel/InstructionSelect.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/GlobalISel/InstructionSelect.html)
|
| `llvm/docs/GlobalISel/KnownBits.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/GlobalISel/KnownBits.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/GlobalISel/KnownBits.html)
|
| `llvm/docs/GlobalISel/Legalizer.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/GlobalISel/Legalizer.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/GlobalISel/Legalizer.html)
|
| `llvm/docs/GlobalISel/MIRPatterns.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/GlobalISel/MIRPatterns.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/GlobalISel/MIRPatterns.html)
|
| `llvm/docs/GlobalISel/Pipeline.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/GlobalISel/Pipeline.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/GlobalISel/Pipeline.html)
|
| `llvm/docs/GlobalISel/Porting.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/GlobalISel/Porting.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/GlobalISel/Porting.html)
|
| `llvm/docs/GlobalISel/RegBankSelect.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/GlobalISel/RegBankSelect.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/GlobalISel/RegBankSelect.html)
|
| `llvm/docs/GlobalISel/Resources.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/GlobalISel/Resources.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/GlobalISel/Resources.html)
|
| `llvm/docs/GlobalISel/index.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/GlobalISel/index.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/GlobalISel/index.html)
|
| `llvm/docs/PDB/CodeViewSymbols.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/PDB/CodeViewSymbols.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/PDB/CodeViewSymbols.html)
|
| `llvm/docs/PDB/CodeViewTypes.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/PDB/CodeViewTypes.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/PDB/CodeViewTypes.html)
|
| `llvm/docs/PDB/DbiStream.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/PDB/DbiStream.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/PDB/DbiStream.html)
|
| `llvm/docs/PDB/GlobalStream.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/PDB/GlobalStream.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/PDB/GlobalStream.html)
|
| `llvm/docs/PDB/HashTable.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/PDB/HashTable.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/PDB/HashTable.html)
|
| `llvm/docs/PDB/ModiStream.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/PDB/ModiStream.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/PDB/ModiStream.html)
|
| `llvm/docs/PDB/MsfFile.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/PDB/MsfFile.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/PDB/MsfFile.html)
|
| `llvm/docs/PDB/PdbStream.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/PDB/PdbStream.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/PDB/PdbStream.html)
|
| `llvm/docs/PDB/PublicStream.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/PDB/PublicStream.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/PDB/PublicStream.html)
|
| `llvm/docs/PDB/TpiStream.md` |
[before](https://llvmdocs.staging.reidkleckner.dev/before/llvm/docs/PDB/TpiStream.html)
|
[after](https://llvmdocs.staging.reidkleckner.dev/after/llvm/docs/PDB/TpiStream.html)
|
2026-08-24 17:23:07 -07:00

7.4 KiB

Root Signatures

:hidden: true

Overview

A root signature is used to describe what resources a shader needs access to and how they're organized and bound in the pipeline. The DirectX Container (DXContainer) contains a root signature part (RTS0), which stores this information in a binary format. To assist with the construction of, and interaction with, a root signature is represented as metadata (dx.rootsignatures ) in the LLVM IR. The metadata can then be converted to its binary form, as defined in llvm/include/llvm/llvm/Frontend/HLSL/RootSignatureMetadata.h. This document serves as a reference for the metadata representation of a root signature for users to interface with.

Metadata Representation

Consider the reference root signature, then the following sections describe the metadata representation of this root signature and the corresponding operands.

RootFlags(ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT),
RootConstants(b0, space = 1, num32Constants = 3),
CBV(b1, flags = 0),
StaticSampler(
  filter = FILTER_MIN_MAG_POINT_MIP_LINEAR,
  addressU = TEXTURE_ADDRESS_BORDER,
),
DescriptorTable(
  visibility = VISIBILITY_ALL,
  SRV(t0, flags = DATA_STATIC_WHILE_SET_AT_EXECUTE),
  UAV(
    numDescriptors = 5, u1, space = 10, offset = 5,
    flags = DATA_VOLATILE
  )
)

:::{note} A root signature does not necessarily have a unique metadata representation. Futher, a malformed root signature can be represented in the metadata format, (eg. mixing Sampler and non-Sampler descriptor ranges), and so it is the user's responsibility to verify that it is a well-formed root signature. :::

Named Root Signature Table

!dx.rootsignatures = !{!0}

A named metadata node, dx.rootsignatures` is used to identify the root signature table. The table itself is a list of references to function/root signature pairs.

Function/Root Signature Pair

!1 = !{ptr @main, !2, i32 2 }

The function/root signature associates a function (the first operand) with a reference to a root signature (the second operand). The root signature version (the third operand) used for validation logic and binary format follows.

Root Signature

!2 = !{ !3, !4, !5, !6, !7 }

The root signature itself simply consists of a list of references to its root signature elements.

Root Signature Element

A root signature element is identified by the first operand, which is a string. The following root signature elements are defined:

Identifier String Root Signature Element
"RootFlags" Root Flags
"RootConstants" Root Constants
"RootCBV" Root Descriptor
"RootSRV" Root Descriptor
"RootUAV" Root Descriptor
"StaticSampler" Static Sampler
"DescriptorTable" Descriptor Table

Below is listed the representation for each type of root signature element.

Root Flags

!3 = { !"RootFlags", i32 1 }
Description Type
Root Signature Flags i32

Root Constants

!4 = { !"RootConstants", i32 0, i32 1, i32 2, i32 3 }
Description Type
Shader Visibility i32
Shader Register i32
Register Space i32
Number 32-bit Values i32

Root Descriptor

As noted in the table above, the first operand will denote the type of root descriptor.

!5 = { !"RootCBV", i32 0, i32 1, i32 0, i32 0 }
Description Type
Shader Visibility i32
Shader Register i32
Register Space i32
Root Descriptor Flags i32

Static Sampler

!6 = !{ !"StaticSampler", i32 1, i32 4, ... }; remaining operands omitted for space
Description Type
Filter i32
AddressU i32
AddressV i32
AddressW i32
MipLODBias float
MaxAnisotropy i32
ComparisonFunc i32
BorderColor i32
MinLOD float
MaxLOD float
ShaderRegister i32
RegisterSpace i32
Shader Visibility i32

Descriptor Table

A descriptor table consists of a visibility and the remaining operands are a list of references to its descriptor ranges.

:::{note} The term Descriptor Table Clause is synonymous with Descriptor Range when referencing the implementation details. :::

!7 = { !"DescriptorTable", i32 0, !8, !9 }
Description Type
Shader Visibility i32
Descriptor Range Elements Descriptor Range

Descriptor Range

Similar to a root descriptor, the first operand will denote the type of descriptor range. It is one of the following types:

  • "CBV"
  • "SRV"
  • "UAV"
  • "Sampler"
!8 = !{ !"SRV", i32 1, i32 0, i32 0, i32 -1, i32 4 }
!9 = !{ !"UAV", i32 5, i32 1, i32 10, i32 5, i32 2 }
Description Type
Number of Descriptors in Range i32
Shader Register i32
Register Space i32
Offset i32
Descriptor Range Flags i32