[llvm] [SPIRV] Add reads from image buffer for shaders. (PR #115178)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 8 08:37:52 PST 2024


================
@@ -3305,6 +3394,23 @@ bool SPIRVInstructionSelector::selectSpvThreadId(Register ResVReg,
   return MIB.constrainAllUses(TII, TRI, RBI);
 }
 
+SPIRVType *SPIRVInstructionSelector::widenTypeToVec4(const SPIRVType *Type,
+                                                     MachineInstr &I) const {
+  MachineIRBuilder MIRBuilder(I);
+  if (Type->getOpcode() != SPIRV::OpTypeVector) {
+    return GR.getOrCreateSPIRVVectorType(Type, 4, MIRBuilder);
+  }
+
+  uint64_t VectorSize = Type->getOperand(2).getImm();
+  if (VectorSize == 4) {
+    return Type;
+  }
----------------
Keenuts wrote:

nit
```suggestion
  if (VectorSize == 4)
    return Type;
```

https://github.com/llvm/llvm-project/pull/115178


More information about the llvm-commits mailing list