LLVM: lib/Frontend/HLSL/HLSLRootSignature.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
16
17namespace llvm {
18namespace hlsl {
20
21template
24 bool FlagSet = false;
26 while (Remaining) {
28 if (Remaining & Bit) {
29 if (FlagSet)
30 OS << " | ";
31
33 if (!MaybeFlag.empty())
34 OS << MaybeFlag;
35 else
36 OS << "invalid: " << Bit;
37
38 FlagSet = true;
39 }
40 Remaining &= ~Bit;
41 }
42
43 if (!FlagSet)
44 OS << "None";
45 return OS;
46}
47
54
60
67
74
81
88
95
101
108
115
122
124 OS << "RootFlags(";
126 OS << ")";
127
128 return OS;
129}
130
132 OS << "RootConstants(num32BitConstants = " << Constants.Num32BitConstants
133 << ", " << Constants.Reg << ", space = " << Constants.Space
134 << ", visibility = " << Constants.Visibility << ")";
135
136 return OS;
137}
138
140 OS << "DescriptorTable(numClauses = " << Table.NumClauses
141 << ", visibility = " << Table.Visibility << ")";
142
143 return OS;
144}
145
147 OS << Clause.Type << "(" << Clause.Reg << ", numDescriptors = ";
149 OS << "unbounded";
150 else
151 OS << Clause.NumDescriptors;
152 OS << ", space = " << Clause.Space << ", offset = ";
154 OS << "DescriptorTableOffsetAppend";
155 else
157 OS << ", flags = " << Clause.Flags << ")";
158
159 return OS;
160}
161
163 OS << "Root" << Descriptor.Type << "(" << Descriptor.Reg
164 << ", space = " << Descriptor.Space
165 << ", visibility = " << Descriptor.Visibility
166 << ", flags = " << Descriptor.Flags << ")";
167
168 return OS;
169}
170
172 OS << "StaticSampler(" << Sampler.Reg << ", filter = " << Sampler.Filter
173 << ", addressU = " << Sampler.AddressU
174 << ", addressV = " << Sampler.AddressV
175 << ", addressW = " << Sampler.AddressW
176 << ", mipLODBias = " << Sampler.MipLODBias
177 << ", maxAnisotropy = " << Sampler.MaxAnisotropy
178 << ", comparisonFunc = " << Sampler.CompFunc
179 << ", borderColor = " << Sampler.BorderColor
180 << ", minLOD = " << Sampler.MinLOD << ", maxLOD = " << Sampler.MaxLOD
181 << ", space = " << Sampler.Space << ", visibility = " << Sampler.Visibility
182 << ", flags = " << Sampler.Flags << ")";
183 return OS;
184}
185
186namespace {
187
188
189
190template <class... Ts> struct OverloadedVisit : Ts... {
191 using Ts::operator()...;
192};
193template <class... Ts> OverloadedVisit(Ts...) -> OverloadedVisit<Ts...>;
194
195}
196
198 const auto Visitor = OverloadedVisit{
200 [&OS](const RootConstants &Constants) { OS << Constants; },
201 [&OS](const RootDescriptor &Descriptor) { OS << Descriptor; },
204 [&OS](const StaticSampler &Sampler) { OS << Sampler; },
205 };
206 std::visit(Visitor, Element);
207 return OS;
208}
209
211 OS << " RootElements{";
212 bool First = true;
213 for (const RootElement &Element : Elements) {
215 OS << ",";
216 OS << " " << Element;
218 }
219 OS << "}";
220}
221
222}
223}
224}
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream.
LLVM_ABI ArrayRef< EnumEntry< ComparisonFunc > > getComparisonFuncs()
LLVM_ABI ArrayRef< EnumEntry< ShaderVisibility > > getShaderVisibility()
LLVM_ABI ArrayRef< EnumEntry< RootFlags > > getRootFlags()
LLVM_ABI ArrayRef< EnumEntry< DescriptorRangeFlags > > getDescriptorRangeFlags()
LLVM_ABI ArrayRef< EnumEntry< SamplerFilter > > getSamplerFilters()
LLVM_ABI ArrayRef< EnumEntry< StaticBorderColor > > getStaticBorderColors()
LLVM_ABI ArrayRef< EnumEntry< TextureAddressMode > > getTextureAddressModes()
LLVM_ABI ArrayRef< EnumEntry< StaticSamplerFlags > > getStaticSamplerFlags()
LLVM_ABI ArrayRef< EnumEntry< RootDescriptorFlags > > getRootDescriptorFlags()
LLVM_ABI StringRef getResourceClassName(ResourceClass RC)
static const uint32_t NumDescriptorsUnbounded
static const uint32_t DescriptorTableOffsetAppend
static const EnumEntry< RegisterType > RegisterNames[]
Definition HLSLRootSignature.cpp:48
LLVM_ABI void dumpRootElements(raw_ostream &OS, ArrayRef< RootElement > Elements)
Definition HLSLRootSignature.cpp:210
std::variant< dxbc::RootFlags, RootConstants, RootDescriptor, DescriptorTable, DescriptorTableClause, StaticSampler > RootElement
Models RootElement : RootFlags | RootConstants | RootParam | DescriptorTable | DescriptorTableClause ...
static raw_ostream & printFlags(raw_ostream &OS, const T Value, ArrayRef< EnumEntry< T > > Flags)
Definition HLSLRootSignature.cpp:22
LLVM_ABI raw_ostream & operator<<(raw_ostream &OS, const dxbc::RootFlags &Flags)
The following contains the serialization interface for root elements.
Definition HLSLRootSignature.cpp:123
This is an optimization pass for GlobalISel generic memory operations.
int countr_zero(T Val)
Count number of 0's from the least significant bit to the most stopping at the first 1.
constexpr std::underlying_type_t< Enum > to_underlying(Enum E)
Returns underlying integer value of an enum.
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
StringRef enumToStringRef(T Value, ArrayRef< EnumEntry< TEnum > > EnumValues)
Retrieves the Value's enum name.
dxbc::ShaderVisibility Visibility
dxbc::ShaderVisibility Visibility
dxbc::RootDescriptorFlags Flags