[llvm] [SPIRV][HLSL] Handle arrays of resources (PR #111564)
Vyacheslav Levytskyy via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 28 10:54:11 PDT 2024
================
@@ -716,6 +716,16 @@ Register SPIRVGlobalRegistry::buildGlobalVariable(
static std::string buildSpirvTypeName(const SPIRVType *Type,
MachineIRBuilder &MIRBuilder) {
switch (Type->getOpcode()) {
+ case SPIRV::OpTypeSampledImage: {
+ Register SampledTypeReg = Type->getOperand(1).getReg();
+ auto *SampledType = MIRBuilder.getMRI()->getUniqueVRegDef(SampledTypeReg);
+ std::string TypeName =
+ "sampled_image_" + buildSpirvTypeName(SampledType, MIRBuilder);
+ for (uint32_t I = 2; I < Type->getNumOperands(); ++I) {
+ TypeName = (TypeName + '_' + Twine(Type->getOperand(I).getImm())).str();
+ }
+ return TypeName;
+ }
----------------
VyacheslavLevytskyy wrote:
Looks identical to the following case except for "sampled_image_" instead of "image_". Does it make sense to factor common code out as a function call?
https://github.com/llvm/llvm-project/pull/111564
More information about the llvm-commits
mailing list