21#include <system_error>
27static_assert((uint64_t)dxbc::FeatureFlags::NextUnusedBit <= 1ull << 63,
28 "Shader flag bits exceed enum size.");
31#define SHADER_FEATURE_FLAG(Num, DxilModuleNum, Val, Str) \
32 Val = (FlagData & (uint64_t)dxbc::FeatureFlags::Val) > 0;
33#include "llvm/BinaryFormat/DXContainerConstants.def"
46 auto Table = *TableOrErr;
56 for (
const auto &R : Table.Ranges) {
59 R.OffsetInDescriptorsFromTableStart;
64 if constexpr (std::is_same_v<T, dxbc::RTS0::v2::DescriptorRange>) {
66#define DESCRIPTOR_RANGE_FLAG(Num, Enum, Flag) \
68 (R.Flags & llvm::to_underlying(dxbc::DescriptorRangeFlags::Enum)) != 0;
69#include "llvm/BinaryFormat/DXContainerConstants.def"
71 TableYaml.
Ranges.push_back(NewR);
95 "Invalid value for parameter type");
98 Header.Offset = PH.ParameterOffset;
99 Header.Type = PH.ParameterType;
103 "Invalid value for shader visibility");
105 Header.Visibility = PH.ShaderVisibility;
108 Data.getParameter(PH);
119 auto Constants = *ConstantsOrErr;
128 }
else if (
auto *RDV =
134 auto Descriptor = *DescriptorOrErr;
143#define ROOT_DESCRIPTOR_FLAG(Num, Enum, Flag) \
144 YamlDescriptor.Enum = \
145 (Descriptor.Flags & \
146 llvm::to_underlying(dxbc::RootDescriptorFlags::Enum)) > 0;
147#include "llvm/BinaryFormat/DXContainerConstants.def"
149 }
else if (
auto *DTV =
153 Header, RootSigDesc, DTV))
157 Header, RootSigDesc, DTV))
164 for (
const auto &S :
Data.samplers()) {
183#define ROOT_SIGNATURE_FLAG(Num, Val) \
184 RootSigDesc.Val = (Flags & llvm::to_underlying(dxbc::RootFlags::Val)) > 0;
185#include "llvm/BinaryFormat/DXContainerConstants.def"
191#define ROOT_DESCRIPTOR_FLAG(Num, Enum, Flag) \
193 Flags |= (uint32_t)dxbc::RootDescriptorFlags::Enum;
194#include "llvm/BinaryFormat/DXContainerConstants.def"
200#define ROOT_SIGNATURE_FLAG(Num, Val) \
202 Flag |= (uint32_t)dxbc::RootFlags::Val;
203#include "llvm/BinaryFormat/DXContainerConstants.def"
209#define DESCRIPTOR_RANGE_FLAG(Num, Enum, Flag) \
211 Flags |= (uint32_t)dxbc::DescriptorRangeFlags::Enum;
212#include "llvm/BinaryFormat/DXContainerConstants.def"
218#define SHADER_FEATURE_FLAG(Num, DxilModuleNum, Val, Str) \
220 Flag |= (uint64_t)dxbc::FeatureFlags::Val;
221#include "llvm/BinaryFormat/DXContainerConstants.def"
242 assert(Stage < std::numeric_limits<uint8_t>::max() &&
243 "Stage should be a very small number");
266 P->EntryNameOffset)) {
302#define SHADER_FEATURE_FLAG(Num, DxilModuleNum, Val, Str) \
303 IO.mapRequired(#Val, Flags.Val);
304#include "llvm/BinaryFormat/DXContainerConstants.def"
384#define ROOT_SIGNATURE_FLAG(Num, Val) IO.mapOptional(#Val, S.Val, false);
385#include "llvm/BinaryFormat/DXContainerConstants.def"
393 if (R.NumDescriptors == UINT_MAX) {
399 int32_t TmpNumDesc = 0;
401 R.NumDescriptors =
static_cast<uint32_t>(TmpNumDesc);
407 R.OffsetInDescriptorsFromTableStart);
408#define DESCRIPTOR_RANGE_FLAG(Num, Enum, Flag) \
409 IO.mapOptional(#Flag, R.Enum, false);
410#include "llvm/BinaryFormat/DXContainerConstants.def"
427 switch (L.Header.Type) {
462#define ROOT_DESCRIPTOR_FLAG(Num, Enum, Flag) \
463 IO.mapOptional(#Flag, D.Enum, false);
464#include "llvm/BinaryFormat/DXContainerConstants.def"
506#define RESOURCE_FLAG(FlagIndex, Enum) IO.mapRequired(#Enum, Flags.Bits.Enum);
507#include "llvm/BinaryFormat/DXContainerConstants.def"
546void ScalarEnumerationTraits<dxbc::PSV::ComponentType>::enumeration(
549 IO.enumCase(
Value,
E.Name.str().c_str(),
E.Value);
552void ScalarEnumerationTraits<dxbc::PSV::InterpolationMode>::enumeration(
553 IO &IO, dxbc::PSV::InterpolationMode &Value) {
554 for (
const auto &
E : dxbc::PSV::getInterpolationModes())
555 IO.enumCase(Value,
E.Name.str().c_str(),
E.Value);
558void ScalarEnumerationTraits<dxbc::PSV::ResourceType>::enumeration(
559 IO &IO, dxbc::PSV::ResourceType &
Value) {
560 for (
const auto &
E : dxbc::PSV::getResourceTypes())
561 IO.enumCase(
Value,
E.Name.str().c_str(),
E.Value);
564void ScalarEnumerationTraits<dxbc::PSV::ResourceKind>::enumeration(
565 IO &IO, dxbc::PSV::ResourceKind &
Value) {
566 for (
const auto &
E : dxbc::PSV::getResourceKinds())
567 IO.enumCase(
Value,
E.Name.str().c_str(),
E.Value);
570void ScalarEnumerationTraits<dxbc::D3DSystemValue>::enumeration(
571 IO &IO, dxbc::D3DSystemValue &
Value) {
572 for (
const auto &
E : dxbc::getD3DSystemValues())
573 IO.enumCase(
Value,
E.Name.str().c_str(),
E.Value);
576void ScalarEnumerationTraits<dxbc::SigMinPrecision>::enumeration(
577 IO &IO, dxbc::SigMinPrecision &
Value) {
578 for (
const auto &
E : dxbc::getSigMinPrecisions())
579 IO.enumCase(
Value,
E.Name.str().c_str(),
E.Value);
582void ScalarEnumerationTraits<dxbc::SigComponentType>::enumeration(
583 IO &IO, dxbc::SigComponentType &
Value) {
584 for (
const auto &
E : dxbc::getSigComponentTypes())
585 IO.enumCase(
Value,
E.Name.str().c_str(),
E.Value);
625 IO.
mapRequired(
"GroupSharedBytesDependentOnViewID",
653 Info.GeomData.SigPatchConstOrPrimVectors);
656 IO.
mapRequired(
"SigPrimVectors",
Info.GeomData.MeshInfo.SigPrimVectors);
658 Info.GeomData.MeshInfo.MeshOutputTopology);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file declares classes for handling the YAML representation of DXContainer.
This file contains library features backported from future STL versions.
This file defines the make_scope_exit function, which executes user-defined cleanup logic at scope ex...
static StringRef substr(StringRef Str, uint64_t Len)
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
reference get()
Returns a reference to the stored T value.
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
StringRef - Represent a constant reference to a string, i.e.
A table of densely packed, null-terminated strings indexed by offset.
LLVM Value Representation.
void mapOptional(const char *Key, T &Val)
virtual bool outputting() const =0
virtual bool mapTag(StringRef Tag, bool Default=false)=0
void mapRequired(const char *Key, T &Val)
void * getContext() const
void enumCase(T &Val, const char *Str, const T ConstVal)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
dxbc::PSV::ResourceFlags ResourceFlags
dxbc::PSV::v2::ResourceBindInfo ResourceBindInfo
LLVM_ABI ArrayRef< EnumEntry< ComponentType > > getComponentTypes()
LLVM_ABI ArrayRef< EnumEntry< SemanticKind > > getSemanticKinds()
bool isValidShaderVisibility(uint32_t V)
Triple::EnvironmentType getShaderStage(uint32_t Kind)
bool isValidParameterType(uint32_t V)
This is an optimization pass for GlobalISel generic memory operations.
auto find(R &&Range, const T &Val)
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
detail::scope_exit< std::decay_t< Callable > > make_scope_exit(Callable &&F)
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
FunctionAddr VTableAddr uintptr_t uintptr_t Version
constexpr std::underlying_type_t< Enum > to_underlying(Enum E)
Returns underlying integer value of an enum.
static llvm::Error readDescriptorRanges(DXContainerYAML::RootParameterHeaderYaml &Header, DXContainerYAML::RootSignatureYamlDesc &RootSigDesc, object::DirectX::DescriptorTableView *DTV)
FunctionAddr VTableAddr uintptr_t uintptr_t Data
uint16_t DXILMajorVersion
std::optional< uint32_t > Size
uint16_t DXILMinorVersion
std::optional< std::vector< llvm::yaml::Hex8 > > DXIL
std::optional< uint32_t > DXILSize
uint32_t OffsetInDescriptorsFromTableStart
uint32_t BaseShaderRegister
LLVM_ABI uint32_t getEncodedFlags() const
SmallVector< DescriptorRangeYaml > Ranges
std::vector< Part > Parts
std::array< MaskVector, 4 > InputOutputMap
MaskVector PatchOutputMap
SmallVector< SignatureElement > SigOutputElements
MaskVector PatchOrPrimMasks
SmallVector< SignatureElement > SigPatchOrPrimElements
SmallVector< ResourceBindInfo > Resources
SmallVector< SignatureElement > SigInputElements
LLVM_ABI void mapInfoForVersion(yaml::IO &IO)
dxbc::PSV::v3::RuntimeInfo Info
std::array< MaskVector, 4 > OutputVectorMasks
LLVM_ABI uint32_t getEncodedFlags() const
RootDescriptorYaml & getOrInsertDescriptor(RootParameterLocationYaml &ParamDesc)
SmallVector< RootParameterLocationYaml > Locations
RootConstantsYaml & getOrInsertConstants(RootParameterLocationYaml &ParamDesc)
void insertLocation(RootParameterLocationYaml &Location)
DescriptorTableYaml & getOrInsertTable(RootParameterLocationYaml &ParamDesc)
uint32_t NumRootParameters
uint32_t NumStaticSamplers
SmallVector< StaticSamplerYamlDesc > StaticSamplers
std::optional< uint32_t > RootParametersOffset
RootSignatureYamlDesc()=default
LLVM_ABI uint32_t getEncodedFlags()
static LLVM_ABI llvm::Expected< DXContainerYAML::RootSignatureYamlDesc > create(const object::DirectX::RootSignature &Data)
RootParameterYamlDesc Parameters
std::optional< uint32_t > StaticSamplersOffset
ShaderFeatureFlags()=default
LLVM_ABI uint64_t getEncodedFlags()
std::vector< llvm::yaml::Hex8 > Digest
dxbc::PSV::ComponentType Type
dxbc::PSV::InterpolationMode Mode
llvm::yaml::Hex8 DynamicMask
dxbc::PSV::SemanticKind Kind
SmallVector< uint32_t > Indices
dxbc::SigComponentType CompType
dxbc::SigMinPrecision MinPrecision
dxbc::D3DSystemValue SystemValue
llvm::SmallVector< SignatureParameter > Parameters
uint32_t ShaderVisibility
uint32_t PayloadSizeInBytes
uint32_t InputControlPointCount
uint32_t TessellatorDomain
uint8_t OutputPositionPresent
uint8_t OutputPositionPresent
uint32_t OutputStreamMask
uint32_t TessellatorOutputPrimitive
uint32_t OutputControlPointCount
uint32_t InputControlPointCount
uint32_t TessellatorDomain
uint32_t PayloadSizeInBytes
uint16_t MaxOutputVertices
uint16_t MaxOutputPrimitives
uint32_t GroupSharedBytesDependentOnViewID
uint32_t GroupSharedBytesUsed
uint8_t OutputPositionPresent
llvm::Expected< DescriptorTable< T > > read()
This class is similar to MappingTraits<T> but allows you to pass in additional context for each map o...
This class should be specialized by any type that needs to be converted to/from a YAML mapping.
This class should be specialized by any integral type that converts to/from a YAML scalar where there...