[llvm] [DirectX] Implement lowering of Texture Load and Texture .operator[] (PR #193343)
Helena Kotas via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 21 16:48:06 PDT 2026
================
@@ -566,6 +566,73 @@ class OpLowerer {
});
}
+ [[nodiscard]] bool lowerTextureLoad(Function &F) {
+ IRBuilder<> &IRB = OpBuilder.getIRB();
+ Type *Int32Ty = IRB.getInt32Ty();
+
+ return replaceFunction(F, [&](CallInst *CI) -> Error {
+ IRB.SetInsertPoint(CI);
+
+ Value *Handle =
+ createTmpHandleCast(CI->getArgOperand(0), OpBuilder.getHandleType());
+ Value *Coords = CI->getArgOperand(1);
+ Value *MipLevel = CI->getArgOperand(2);
+ Value *Offsets = CI->getArgOperand(3);
+
+ Type *OldTy = CI->getType();
+ Type *NewRetTy = OpBuilder.getResRetType(OldTy->getScalarType());
+
+ std::array<Value *, 3> CoordArgs = {UndefValue::get(Int32Ty),
----------------
hekota wrote:
These need be `undef` because we are lowering to LLVM 3.7 (=DXIL).
https://github.com/llvm/llvm-project/pull/193343
More information about the llvm-commits
mailing list