File tree 2 files changed +14
-0
lines changed
2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -1359,6 +1359,9 @@ bool isSamplerTy(Type *Ty) {
1359
1359
auto *STy = dyn_cast_or_null<StructType>(TPT->getElementType ());
1360
1360
return STy && STy->hasName () && STy->getName () == kSPR2TypeName ::Sampler;
1361
1361
}
1362
+ if (auto *TET = dyn_cast_or_null<TargetExtType>(Ty)) {
1363
+ return TET->getName () == " spirv.Sampler" ;
1364
+ }
1362
1365
return false ;
1363
1366
}
1364
1367
Original file line number Diff line number Diff line change @@ -189,6 +189,10 @@ bool isOCLImageType(llvm::Type *Ty, StringRef *Name) {
189
189
return true ;
190
190
}
191
191
}
192
+ if (auto *TET = dyn_cast_or_null<TargetExtType>(Ty)) {
193
+ assert (!Name && " Cannot get the name for a target-extension type image" );
194
+ return TET->getName () == " spirv.Image" ;
195
+ }
192
196
return false ;
193
197
}
194
198
// / \param BaseTyName is the type Name as in spirv.BaseTyName.Postfixes
@@ -1605,6 +1609,13 @@ std::string getImageBaseTypeName(StringRef Name) {
1605
1609
}
1606
1610
1607
1611
SPIRVTypeImageDescriptor getImageDescriptor (Type *Ty) {
1612
+ if (auto *TET = dyn_cast_or_null<TargetExtType>(Ty)) {
1613
+ auto IntParams = TET->int_params ();
1614
+ assert (IntParams.size () > 6 && " Expected type to be an image type" );
1615
+ return SPIRVTypeImageDescriptor (SPIRVImageDimKind (IntParams[0 ]),
1616
+ IntParams[1 ], IntParams[2 ], IntParams[3 ],
1617
+ IntParams[4 ], IntParams[5 ]);
1618
+ }
1608
1619
StringRef TyName;
1609
1620
[[maybe_unused]] bool IsImg = isOCLImageType (Ty, &TyName);
1610
1621
assert (IsImg && " Must be an image type" );
You can’t perform that action at this time.
0 commit comments