22bool ResourceInfo::isStruct()
const {
26bool ResourceInfo::isTyped()
const {
54bool ResourceInfo::isFeedback()
const {
59bool ResourceInfo::isMultiSample()
const {
69 assert(RI.isTyped() && !(RI.isStruct() || RI.isMultiSample()) &&
70 "Invalid ResourceKind for SRV constructor.");
71 RI.
Typed.ElementTy = ElementTy;
89 Name, Binding, UniqueID);
91 RI.
Struct.Alignment = Alignment;
102 RI.
Typed.ElementTy = ElementTy;
104 RI.MultiSample.Count = SampleCount;
112 Name, Binding, UniqueID);
113 RI.
Typed.ElementTy = ElementTy;
115 RI.MultiSample.Count = SampleCount;
122 bool GloballyCoherent,
bool IsROV,
125 assert(RI.isTyped() && !(RI.isStruct() || RI.isMultiSample()) &&
126 "Invalid ResourceKind for UAV constructor.");
127 RI.
Typed.ElementTy = ElementTy;
129 RI.
UAVFlags.GloballyCoherent = GloballyCoherent;
137 uint32_t UniqueID,
bool GloballyCoherent,
141 RI.
UAVFlags.GloballyCoherent = GloballyCoherent;
151 bool GloballyCoherent,
bool IsROV,
154 Name, Binding, UniqueID);
155 RI.
Struct.Stride = Stride;
156 RI.
Struct.Alignment = Alignment;
157 RI.
UAVFlags.GloballyCoherent = GloballyCoherent;
159 RI.
UAVFlags.HasCounter = HasCounter;
167 uint32_t SampleCount,
bool GloballyCoherent) {
170 RI.
Typed.ElementTy = ElementTy;
172 RI.
UAVFlags.GloballyCoherent = GloballyCoherent;
175 RI.MultiSample.Count = SampleCount;
183 uint32_t SampleCount,
bool GloballyCoherent) {
185 Name, Binding, UniqueID);
186 RI.
Typed.ElementTy = ElementTy;
188 RI.
UAVFlags.GloballyCoherent = GloballyCoherent;
191 RI.MultiSample.Count = SampleCount;
200 Name, Binding, UniqueID);
201 RI.
UAVFlags.GloballyCoherent =
false;
213 Symbol, Name, Binding, UniqueID);
214 RI.
UAVFlags.GloballyCoherent =
false;
240 if (std::tie(Symbol, Name, Binding, UniqueID, RC, Kind) !=
255 if (isTyped() &&
Typed !=
RHS.Typed)
259 return MultiSample ==
RHS.MultiSample;
270 auto getIntMD = [&I32Ty](
uint32_t V) {
274 auto getBoolMD = [&I1Ty](
uint32_t V) {
289 }
else if (isSampler()) {
303 uint32_t SampleCount = isMultiSample() ? MultiSample.Count : 0;
313 }
else if (isTyped()) {
316 }
else if (isFeedback()) {
330 bool IsUAV = isUAV();
331 bool IsROV = IsUAV ?
UAVFlags.IsROV : 0;
332 bool IsGloballyCoherent = IsUAV ?
UAVFlags.GloballyCoherent : 0;
333 uint8_t SamplerCmpOrHasCounter = 0;
335 SamplerCmpOrHasCounter =
UAVFlags.HasCounter;
336 else if (isSampler())
343 Word0 |= (AlignLog2 & 0xF) << 8;
344 Word0 |= (IsUAV & 1) << 12;
345 Word0 |= (IsROV & 1) << 13;
346 Word0 |= (IsGloballyCoherent & 1) << 14;
347 Word0 |= (SamplerCmpOrHasCounter & 1) << 15;
352 else if (isCBuffer())
354 else if (isFeedback())
356 else if (isTyped()) {
359 uint32_t SampleCount = isMultiSample() ? MultiSample.Count : 0;
361 Word1 |= (CompType & 0xFF) << 0;
362 Word1 |= (CompCount & 0xFF) << 8;
363 Word1 |= (SampleCount & 0xFF) << 16;
366 return {Word0, Word1};
369#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.