LLVM 22.0.0git
llvm::hlsl::rootsig Namespace Reference

Classes

struct  DescriptorTable
struct  DescriptorTableClause
class  GenericRSMetadataError
class  InvalidRSMetadataFormat
class  InvalidRSMetadataValue
class  MetadataBuilder
class  MetadataParser
class  OffsetAppendAfterOverflow
class  OffsetOverflowError
struct  Register
struct  RootConstants
struct  RootDescriptor
class  RootSignatureValidationError
class  ShaderRegisterOverflowError
struct  StaticSampler
class  TableSamplerMixinError

Typedefs

using RootElement
 Models RootElement : RootFlags | RootConstants | RootParam | DescriptorTable | DescriptorTableClause | StaticSampler.

Enumerations

enum class  RegisterType { BReg , TReg , UReg , SReg }
enum class  RootSignatureElementKind {
  Error = 0 , RootFlags = 1 , RootConstants = 2 , SRV = 3 ,
  UAV = 4 , CBV = 5 , DescriptorTable = 6 , StaticSamplers = 7
}

Functions

LLVM_ABI raw_ostreamoperator<< (raw_ostream &OS, const dxbc::RootFlags &Flags)
 The following contains the serialization interface for root elements.
LLVM_ABI raw_ostreamoperator<< (raw_ostream &OS, const RootConstants &Constants)
LLVM_ABI raw_ostreamoperator<< (raw_ostream &OS, const DescriptorTableClause &Clause)
LLVM_ABI raw_ostreamoperator<< (raw_ostream &OS, const DescriptorTable &Table)
LLVM_ABI raw_ostreamoperator<< (raw_ostream &OS, const RootDescriptor &Descriptor)
LLVM_ABI raw_ostreamoperator<< (raw_ostream &OS, const StaticSampler &StaticSampler)
LLVM_ABI raw_ostreamoperator<< (raw_ostream &OS, const RootElement &Element)
LLVM_ABI void dumpRootElements (raw_ostream &OS, ArrayRef< RootElement > Elements)
LLVM_ABI bool verifyRootFlag (uint32_t Flags)
LLVM_ABI bool verifyVersion (uint32_t Version)
LLVM_ABI bool verifyRegisterValue (uint32_t RegisterValue)
LLVM_ABI bool verifyRegisterSpace (uint32_t RegisterSpace)
LLVM_ABI bool verifyRootDescriptorFlag (uint32_t Version, uint32_t FlagsVal)
LLVM_ABI bool verifyRangeType (uint32_t Type)
LLVM_ABI bool verifyDescriptorRangeFlag (uint32_t Version, dxil::ResourceClass Type, dxbc::DescriptorRangeFlags FlagsVal)
LLVM_ABI bool verifyStaticSamplerFlags (uint32_t Version, uint32_t FlagsNumber)
LLVM_ABI bool verifyNumDescriptors (uint32_t NumDescriptors)
LLVM_ABI bool verifyMipLODBias (float MipLODBias)
LLVM_ABI bool verifyMaxAnisotropy (uint32_t MaxAnisotropy)
LLVM_ABI bool verifyLOD (float LOD)
LLVM_ABI bool verifyNoOverflowedOffset (uint64_t Offset)
LLVM_ABI uint64_t computeRangeBound (uint64_t Offset, uint32_t Size)
template<typename T>
static raw_ostreamprintFlags (raw_ostream &OS, const T Value, ArrayRef< EnumEntry< T > > Flags)
static raw_ostreamoperator<< (raw_ostream &OS, const Register &Reg)
static raw_ostreamoperator<< (raw_ostream &OS, const llvm::dxbc::ShaderVisibility &Visibility)
static raw_ostreamoperator<< (raw_ostream &OS, const llvm::dxbc::SamplerFilter &Filter)
static raw_ostreamoperator<< (raw_ostream &OS, const dxbc::TextureAddressMode &Address)
static raw_ostreamoperator<< (raw_ostream &OS, const dxbc::ComparisonFunc &CompFunc)
static raw_ostreamoperator<< (raw_ostream &OS, const dxbc::StaticBorderColor &BorderColor)
static raw_ostreamoperator<< (raw_ostream &OS, const dxil::ResourceClass &Type)
static raw_ostreamoperator<< (raw_ostream &OS, const dxbc::RootDescriptorFlags &Flags)
static raw_ostreamoperator<< (raw_ostream &OS, const llvm::dxbc::DescriptorRangeFlags &Flags)
static std::optional< uint32_textractMdIntValue (MDNode *Node, unsigned int OpId)
static std::optional< float > extractMdFloatValue (MDNode *Node, unsigned int OpId)
static std::optional< StringRefextractMdStringValue (MDNode *Node, unsigned int OpId)
template<typename T, typename = std::enable_if_t< std::is_enum_v<T> && std::is_same_v<std::underlying_type_t<T>, uint32_t>>>
static Expected< TextractEnumValue (MDNode *Node, unsigned int OpId, StringRef ErrText, llvm::function_ref< bool(uint32_t)> VerifyFn)
static Error validateDescriptorTableSamplerMixin (const mcdxbc::DescriptorTable &Table, uint32_t Location)
static Error validateDescriptorTableRegisterOverflow (const mcdxbc::DescriptorTable &Table, uint32_t Location)

Variables

static const uint32_t NumDescriptorsUnbounded = 0xffffffff
static const uint32_t DescriptorTableOffsetAppend = 0xffffffff
static const EnumEntry< RegisterTypeRegisterNames []
template<typename T>
char RootSignatureValidationError< T >::ID

Typedef Documentation

◆ RootElement

Initial value:

Models RootElement : RootFlags | RootConstants | RootParam | DescriptorTable | DescriptorTableClause | StaticSampler.

A Root Signature is modeled in-memory by an array of RootElements. These aim to map closely to their DSL grammar reprsentation defined in the spec.

Each optional parameter has its default value defined in the struct, and, each mandatory parameter does not have a default initialization.

For the variants RootFlags, RootConstants, RootParam, StaticSampler and DescriptorTableClause: each data member maps directly to a parameter in the grammar.

The DescriptorTable is modelled by having its Clauses as the previous RootElements in the array, and it holds a data member for the Visibility parameter.

Definition at line 152 of file HLSLRootSignature.h.

Enumeration Type Documentation

◆ RegisterType

Enumerator
BReg 
TReg 
UReg 
SReg 

Definition at line 31 of file HLSLRootSignature.h.

◆ RootSignatureElementKind

Enumerator
Error 
RootFlags 
RootConstants 
SRV 
UAV 
CBV 
DescriptorTable 
StaticSamplers 

Definition at line 215 of file RootSignatureMetadata.h.

Function Documentation

◆ computeRangeBound()

uint64_t llvm::hlsl::rootsig::computeRangeBound ( uint64_t Offset,
uint32_t Size )

◆ dumpRootElements()

void llvm::hlsl::rootsig::dumpRootElements ( raw_ostream & OS,
ArrayRef< RootElement > Elements )

Definition at line 203 of file HLSLRootSignature.cpp.

References llvm::First.

◆ extractEnumValue()

template<typename T, typename = std::enable_if_t< std::is_enum_v<T> && std::is_same_v<std::underlying_type_t<T>, uint32_t>>>
Expected< T > llvm::hlsl::rootsig::extractEnumValue ( MDNode * Node,
unsigned int OpId,
StringRef ErrText,
llvm::function_ref< bool(uint32_t)> VerifyFn )
static

Definition at line 64 of file RootSignatureMetadata.cpp.

References extractMdIntValue(), llvm::make_error(), and T.

◆ extractMdFloatValue()

std::optional< float > llvm::hlsl::rootsig::extractMdFloatValue ( MDNode * Node,
unsigned int OpId )
static

Definition at line 45 of file RootSignatureMetadata.cpp.

References llvm::mdconst::dyn_extract().

◆ extractMdIntValue()

std::optional< uint32_t > llvm::hlsl::rootsig::extractMdIntValue ( MDNode * Node,
unsigned int OpId )
static

Definition at line 37 of file RootSignatureMetadata.cpp.

References llvm::mdconst::dyn_extract().

Referenced by extractEnumValue().

◆ extractMdStringValue()

std::optional< StringRef > llvm::hlsl::rootsig::extractMdStringValue ( MDNode * Node,
unsigned int OpId )
static

Definition at line 52 of file RootSignatureMetadata.cpp.

References llvm::dyn_cast(), and llvm::MDString::getString().

◆ operator<<() [1/16]

◆ operator<<() [2/16]

raw_ostream & llvm::hlsl::rootsig::operator<< ( raw_ostream & OS,
const DescriptorTableClause & Clause )

Definition at line 139 of file HLSLRootSignature.cpp.

References DescriptorTableOffsetAppend, and NumDescriptorsUnbounded.

◆ operator<<() [3/16]

raw_ostream & llvm::hlsl::rootsig::operator<< ( raw_ostream & OS,
const dxbc::ComparisonFunc & CompFunc )
static

◆ operator<<() [4/16]

raw_ostream & llvm::hlsl::rootsig::operator<< ( raw_ostream & OS,
const dxbc::RootDescriptorFlags & Flags )
static

Definition at line 102 of file HLSLRootSignature.cpp.

References llvm::dxbc::getRootDescriptorFlags(), and printFlags().

◆ operator<<() [5/16]

raw_ostream & llvm::hlsl::rootsig::operator<< ( raw_ostream & OS,
const dxbc::RootFlags & Flags )

The following contains the serialization interface for root elements.

Definition at line 116 of file HLSLRootSignature.cpp.

References llvm::dxbc::getRootFlags(), and printFlags().

◆ operator<<() [6/16]

raw_ostream & llvm::hlsl::rootsig::operator<< ( raw_ostream & OS,
const dxbc::StaticBorderColor & BorderColor )
static

◆ operator<<() [7/16]

raw_ostream & llvm::hlsl::rootsig::operator<< ( raw_ostream & OS,
const dxbc::TextureAddressMode & Address )
static

◆ operator<<() [8/16]

raw_ostream & llvm::hlsl::rootsig::operator<< ( raw_ostream & OS,
const dxil::ResourceClass & Type )
static

Definition at line 96 of file HLSLRootSignature.cpp.

References llvm::dxil::getResourceClassName().

◆ operator<<() [9/16]

raw_ostream & llvm::hlsl::rootsig::operator<< ( raw_ostream & OS,
const llvm::dxbc::DescriptorRangeFlags & Flags )
static

Definition at line 109 of file HLSLRootSignature.cpp.

References llvm::dxbc::getDescriptorRangeFlags(), and printFlags().

◆ operator<<() [10/16]

raw_ostream & llvm::hlsl::rootsig::operator<< ( raw_ostream & OS,
const llvm::dxbc::SamplerFilter & Filter )
static

◆ operator<<() [11/16]

raw_ostream & llvm::hlsl::rootsig::operator<< ( raw_ostream & OS,
const llvm::dxbc::ShaderVisibility & Visibility )
static

◆ operator<<() [12/16]

raw_ostream & llvm::hlsl::rootsig::operator<< ( raw_ostream & OS,
const Register & Reg )
static

Definition at line 55 of file HLSLRootSignature.cpp.

References llvm::enumToStringRef(), Reg, and RegisterNames.

◆ operator<<() [13/16]

raw_ostream & llvm::hlsl::rootsig::operator<< ( raw_ostream & OS,
const RootConstants & Constants )

Definition at line 124 of file HLSLRootSignature.cpp.

◆ operator<<() [14/16]

◆ operator<<() [15/16]

raw_ostream & llvm::hlsl::rootsig::operator<< ( raw_ostream & OS,
const RootElement & Element )

Definition at line 190 of file HLSLRootSignature.cpp.

◆ operator<<() [16/16]

raw_ostream & llvm::hlsl::rootsig::operator<< ( raw_ostream & OS,
const StaticSampler & StaticSampler )

Definition at line 164 of file HLSLRootSignature.cpp.

◆ printFlags()

template<typename T>
raw_ostream & llvm::hlsl::rootsig::printFlags ( raw_ostream & OS,
const T Value,
ArrayRef< EnumEntry< T > > Flags )
static

◆ validateDescriptorTableRegisterOverflow()

◆ validateDescriptorTableSamplerMixin()

Error llvm::hlsl::rootsig::validateDescriptorTableSamplerMixin ( const mcdxbc::DescriptorTable & Table,
uint32_t Location )
static

◆ verifyDescriptorRangeFlag()

bool llvm::hlsl::rootsig::verifyDescriptorRangeFlag ( uint32_t Version,
dxil::ResourceClass Type,
dxbc::DescriptorRangeFlags FlagsVal )

◆ verifyLOD()

bool llvm::hlsl::rootsig::verifyLOD ( float LOD)

Definition at line 147 of file RootSignatureValidations.cpp.

◆ verifyMaxAnisotropy()

bool llvm::hlsl::rootsig::verifyMaxAnisotropy ( uint32_t MaxAnisotropy)

Definition at line 143 of file RootSignatureValidations.cpp.

◆ verifyMipLODBias()

bool llvm::hlsl::rootsig::verifyMipLODBias ( float MipLODBias)

Definition at line 139 of file RootSignatureValidations.cpp.

◆ verifyNoOverflowedOffset()

bool llvm::hlsl::rootsig::verifyNoOverflowedOffset ( uint64_t Offset)

Definition at line 149 of file RootSignatureValidations.cpp.

References llvm::Offset.

Referenced by validateDescriptorTableRegisterOverflow().

◆ verifyNumDescriptors()

bool llvm::hlsl::rootsig::verifyNumDescriptors ( uint32_t NumDescriptors)

Definition at line 135 of file RootSignatureValidations.cpp.

◆ verifyRangeType()

LLVM_ABI bool llvm::hlsl::rootsig::verifyRangeType ( uint32_t Type)

◆ verifyRegisterSpace()

bool llvm::hlsl::rootsig::verifyRegisterSpace ( uint32_t RegisterSpace)

Definition at line 33 of file RootSignatureValidations.cpp.

◆ verifyRegisterValue()

bool llvm::hlsl::rootsig::verifyRegisterValue ( uint32_t RegisterValue)

Definition at line 27 of file RootSignatureValidations.cpp.

◆ verifyRootDescriptorFlag()

bool llvm::hlsl::rootsig::verifyRootDescriptorFlag ( uint32_t Version,
uint32_t FlagsVal )

◆ verifyRootFlag()

bool llvm::hlsl::rootsig::verifyRootFlag ( uint32_t Flags)

Definition at line 21 of file RootSignatureValidations.cpp.

◆ verifyStaticSamplerFlags()

bool llvm::hlsl::rootsig::verifyStaticSamplerFlags ( uint32_t Version,
uint32_t FlagsNumber )

◆ verifyVersion()

bool llvm::hlsl::rootsig::verifyVersion ( uint32_t Version)

Definition at line 23 of file RootSignatureValidations.cpp.

References llvm::Version.

Variable Documentation

◆ DescriptorTableOffsetAppend

const uint32_t llvm::hlsl::rootsig::DescriptorTableOffsetAppend = 0xffffffff
static

Definition at line 85 of file HLSLRootSignature.h.

Referenced by operator<<(), and validateDescriptorTableRegisterOverflow().

◆ NumDescriptorsUnbounded

const uint32_t llvm::hlsl::rootsig::NumDescriptorsUnbounded = 0xffffffff
static

◆ RegisterNames

◆ RootSignatureValidationError< T >::ID