@@ -23,6 +23,7 @@ class TargetExtType;
2323namespace dxil {
2424
2525class ResourceInfo {
26+ public:
2627 struct ResourceBinding {
2728 uint32_t RecordID;
2829 uint32_t Space;
@@ -89,6 +90,7 @@ class ResourceInfo {
8990 bool operator !=(const FeedbackInfo &RHS) const { return !(*this == RHS); }
9091 };
9192
93+ private:
9294 // Universal properties.
9395 Value *Symbol;
9496 StringRef Name;
@@ -115,6 +117,10 @@ class ResourceInfo {
115117
116118 MSInfo MultiSample;
117119
120+ // We need a default constructor if we want to insert this in a MapVector.
121+ ResourceInfo () {}
122+ friend class MapVector <CallInst *, ResourceInfo>;
123+
118124public:
119125 ResourceInfo (dxil::ResourceClass RC, dxil::ResourceKind Kind, Value *Symbol,
120126 StringRef Name)
@@ -136,12 +142,17 @@ class ResourceInfo {
136142 Binding.LowerBound = LowerBound;
137143 Binding.Size = Size;
138144 }
145+ const ResourceBinding &getBinding () const { return Binding; }
139146 void setUAV (bool GloballyCoherent, bool HasCounter, bool IsROV) {
140147 assert (isUAV () && " Not a UAV" );
141148 UAVFlags.GloballyCoherent = GloballyCoherent;
142149 UAVFlags.HasCounter = HasCounter;
143150 UAVFlags.IsROV = IsROV;
144151 }
152+ const UAVInfo &getUAV () const {
153+ assert (isUAV () && " Not a UAV" );
154+ return UAVFlags;
155+ }
145156 void setCBuffer (uint32_t Size) {
146157 assert (isCBuffer () && " Not a CBuffer" );
147158 CBufferSize = Size;
@@ -157,6 +168,10 @@ class ResourceInfo {
157168 Typed.ElementTy = ElementTy;
158169 Typed.ElementCount = ElementCount;
159170 }
171+ const TypedInfo &getTyped () const {
172+ assert (isTyped () && " Not typed" );
173+ return Typed;
174+ }
160175 void setFeedback (dxil::SamplerFeedbackType Type) {
161176 assert (isFeedback () && " Not Feedback" );
162177 Feedback.Type = Type;
@@ -165,6 +180,14 @@ class ResourceInfo {
165180 assert (isMultiSample () && " Not MultiSampled" );
166181 MultiSample.Count = Count;
167182 }
183+ const MSInfo &getMultiSample () const {
184+ assert (isMultiSample () && " Not MultiSampled" );
185+ return MultiSample;
186+ }
187+
188+ StringRef getName () const { return Name; }
189+ dxil::ResourceClass getResourceClass () const { return RC; }
190+ dxil::ResourceKind getResourceKind () const { return Kind; }
168191
169192 bool operator ==(const ResourceInfo &RHS) const ;
170193
@@ -214,7 +237,6 @@ class ResourceInfo {
214237
215238 MDTuple *getAsMetadata (LLVMContext &Ctx) const ;
216239
217- ResourceBinding getBinding () const { return Binding; }
218240 std::pair<uint32_t , uint32_t > getAnnotateProps () const ;
219241
220242 void print (raw_ostream &OS) const ;
0 commit comments