[llvm] [SPIRV] Implement handle_fromBinding intrinsic. (PR #111052)
Nathan Gauër via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 4 01:02:32 PDT 2024
================
@@ -2558,6 +2580,37 @@ bool SPIRVInstructionSelector::selectIntrinsic(Register ResVReg,
return true;
}
+void SPIRVInstructionSelector::selectHandleFromBinding(Register &ResVReg,
+ const SPIRVType *ResType,
+ MachineInstr &I) const {
+
+ uint32_t Set =
+ getUnsignedConstantValueFromReg(I.getOperand(2).getReg(), *MRI);
+ uint32_t Binding =
+ getUnsignedConstantValueFromReg(I.getOperand(3).getReg(), *MRI);
+ uint32_t ArraySize =
+ getUnsignedConstantValueFromReg(I.getOperand(4).getReg(), *MRI);
+
+ MachineIRBuilder MIRBuilder(I);
+ Register VarReg =
+ buildPointerToResource(ResType, Set, Binding, ArraySize, MIRBuilder);
+
+ // TODO: For now we assume the resource is an image, which needs to be
+ // loaded to get the handle. That will not be true for storage buffers.
----------------
Keenuts wrote:
How will those be differentiated? Would that be from the name, or the type? Or another annotation?
https://github.com/llvm/llvm-project/pull/111052
More information about the llvm-commits
mailing list