22bool ResourceInfo::isStruct()
const {
26bool ResourceInfo::isTyped()
const {
55bool ResourceInfo::isFeedback()
const {
60bool ResourceInfo::isMultiSample()
const {
70 assert(RI.isTyped() && !(RI.isStruct() || RI.isMultiSample()) &&
71 "Invalid ResourceKind for SRV constructor.");
72 RI.
Typed.ElementTy = ElementTy;
90 Name, Binding, UniqueID);
92 RI.
Struct.Alignment = Alignment;
103 RI.
Typed.ElementTy = ElementTy;
105 RI.MultiSample.Count = SampleCount;
113 Name, Binding, UniqueID);
114 RI.
Typed.ElementTy = ElementTy;
116 RI.MultiSample.Count = SampleCount;
123 bool GloballyCoherent,
bool IsROV,
126 assert(RI.isTyped() && !(RI.isStruct() || RI.isMultiSample()) &&
127 "Invalid ResourceKind for UAV constructor.");
128 RI.
Typed.ElementTy = ElementTy;
130 RI.
UAVFlags.GloballyCoherent = GloballyCoherent;
138 uint32_t UniqueID,
bool GloballyCoherent,
142 RI.
UAVFlags.GloballyCoherent = GloballyCoherent;
152 bool GloballyCoherent,
bool IsROV,
155 Name, Binding, UniqueID);
156 RI.
Struct.Stride = Stride;
157 RI.
Struct.Alignment = Alignment;
158 RI.
UAVFlags.GloballyCoherent = GloballyCoherent;
160 RI.
UAVFlags.HasCounter = HasCounter;
168 uint32_t SampleCount,
bool GloballyCoherent) {
171 RI.
Typed.ElementTy = ElementTy;
173 RI.
UAVFlags.GloballyCoherent = GloballyCoherent;
176 RI.MultiSample.Count = SampleCount;
184 uint32_t SampleCount,
bool GloballyCoherent) {
186 Name, Binding, UniqueID);
187 RI.
Typed.ElementTy = ElementTy;
189 RI.
UAVFlags.GloballyCoherent = GloballyCoherent;
192 RI.MultiSample.Count = SampleCount;
201 Name, Binding, UniqueID);
202 RI.
UAVFlags.GloballyCoherent =
false;
214 Symbol, Name, Binding, UniqueID);
215 RI.
UAVFlags.GloballyCoherent =
false;
241 if (std::tie(Symbol, Name, Binding, UniqueID, RC, Kind) !=
256 if (isTyped() &&
Typed !=
RHS.Typed)
260 return MultiSample ==
RHS.MultiSample;
271 auto getIntMD = [&I32Ty](
uint32_t V) {
275 auto getBoolMD = [&I1Ty](
uint32_t V) {
290 }
else if (isSampler()) {
304 uint32_t SampleCount = isMultiSample() ? MultiSample.Count : 0;
314 }
else if (isTyped()) {
317 }
else if (isFeedback()) {
331 bool IsUAV = isUAV();
332 bool IsROV = IsUAV ?
UAVFlags.IsROV : 0;
333 bool IsGloballyCoherent = IsUAV ?
UAVFlags.GloballyCoherent : 0;
334 uint8_t SamplerCmpOrHasCounter = 0;
336 SamplerCmpOrHasCounter =
UAVFlags.HasCounter;
337 else if (isSampler())
344 Word0 |= (AlignLog2 & 0xF) << 8;
345 Word0 |= (IsUAV & 1) << 12;
346 Word0 |= (IsROV & 1) << 13;
347 Word0 |= (IsGloballyCoherent & 1) << 14;
348 Word0 |= (SamplerCmpOrHasCounter & 1) << 15;
353 else if (isCBuffer())
355 else if (isFeedback())
357 else if (isTyped()) {
360 uint32_t SampleCount = isMultiSample() ? MultiSample.Count : 0;
362 Word1 |= (CompType & 0xFF) << 0;
363 Word1 |= (CompCount & 0xFF) << 8;
364 Word1 |= (SampleCount & 0xFF) << 16;
367 return {Word0, Word1};
370#define DEBUG_TYPE "dxil-resource"
This file implements a class to represent arbitrary precision integral constant values and operations...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Class for arbitrary precision integers.
static Constant * getIntegerValue(Type *Ty, const APInt &V)
Return the value for an integer or pointer constant, or a vector thereof, with the given scalar value...
This is an important class for using LLVM in a threaded context.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
static MDString * get(LLVMContext &Context, StringRef Str)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
The instances of the Type class are immutable: once they are created, they are never changed.
static IntegerType * getInt1Ty(LLVMContext &C)
static IntegerType * getInt32Ty(LLVMContext &C)
LLVM Value Representation.
static ResourceInfo RWTexture2DMSArray(Value *Symbol, StringRef Name, ResourceBinding Binding, uint32_t UniqueID, dxil::ElementType ElementTy, uint32_t ElementCount, uint32_t SampleCount, bool GloballyCoherent)
static ResourceInfo Texture2DMSArray(Value *Symbol, StringRef Name, ResourceBinding Binding, uint32_t UniqueID, dxil::ElementType ElementTy, uint32_t ElementCount, uint32_t SampleCount)
static ResourceInfo SRV(Value *Symbol, StringRef Name, ResourceBinding Binding, uint32_t UniqueID, dxil::ElementType ElementTy, uint32_t ElementCount, dxil::ResourceKind Kind)
static ResourceInfo RWRawBuffer(Value *Symbol, StringRef Name, ResourceBinding Binding, uint32_t UniqueID, bool GloballyCoherent, bool IsROV)
static ResourceInfo FeedbackTexture2DArray(Value *Symbol, StringRef Name, ResourceBinding Binding, uint32_t UniqueID, dxil::SamplerFeedbackType FeedbackTy)
std::pair< uint32_t, uint32_t > getAnnotateProps() const
static ResourceInfo UAV(Value *Symbol, StringRef Name, ResourceBinding Binding, uint32_t UniqueID, dxil::ElementType ElementTy, uint32_t ElementCount, bool GloballyCoherent, bool IsROV, dxil::ResourceKind Kind)
static ResourceInfo Sampler(Value *Symbol, StringRef Name, ResourceBinding Binding, uint32_t UniqueID, dxil::SamplerType SamplerTy)
static ResourceInfo StructuredBuffer(Value *Symbol, StringRef Name, ResourceBinding Binding, uint32_t UniqueID, uint32_t Stride, Align Alignment)
static ResourceInfo Texture2DMS(Value *Symbol, StringRef Name, ResourceBinding Binding, uint32_t UniqueID, dxil::ElementType ElementTy, uint32_t ElementCount, uint32_t SampleCount)
dxil::SamplerType SamplerTy
static ResourceInfo RawBuffer(Value *Symbol, StringRef Name, ResourceBinding Binding, uint32_t UniqueID)
bool operator==(const ResourceInfo &RHS) const
static ResourceInfo RWStructuredBuffer(Value *Symbol, StringRef Name, ResourceBinding Binding, uint32_t UniqueID, uint32_t Stride, Align Alignment, bool GloballyCoherent, bool IsROV, bool HasCounter)
static ResourceInfo RWTexture2DMS(Value *Symbol, StringRef Name, ResourceBinding Binding, uint32_t UniqueID, dxil::ElementType ElementTy, uint32_t ElementCount, uint32_t SampleCount, bool GloballyCoherent)
static ResourceInfo CBuffer(Value *Symbol, StringRef Name, ResourceBinding Binding, uint32_t UniqueID, uint32_t Size)
MDTuple * getAsMetadata(LLVMContext &Ctx) const
static ResourceInfo FeedbackTexture2D(Value *Symbol, StringRef Name, ResourceBinding Binding, uint32_t UniqueID, dxil::SamplerFeedbackType FeedbackTy)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
ResourceKind
The kind of resource for an SRV or UAV resource.
@ RTAccelerationStructure
ElementType
The element type of an SRV or UAV resource.
This is an optimization pass for GlobalISel generic memory operations.
constexpr std::underlying_type_t< Enum > to_underlying(Enum E)
Returns underlying integer value of an enum.
unsigned Log2(Align A)
Returns the log2 of the alignment.
This struct is a compact representation of a valid (non-zero power of two) alignment.