[llvm-branch-commits] [clang] [HLSL] Implement Texture2D::Load methods and builtin (PR #185708)

Helena Kotas via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Mar 10 19:24:02 PDT 2026


================
@@ -1256,6 +1256,34 @@ BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addLoadMethods() {
   return *this;
 }
 
+BuiltinTypeDeclBuilder &
+BuiltinTypeDeclBuilder::addTextureLoadMethods(ResourceDimension Dim) {
+  assert(!Record->isCompleteDefinition() && "record is already complete");
+  ASTContext &AST = Record->getASTContext();
+  uint32_t VecSize = getResourceDimensions(Dim);
+  QualType IntTy = AST.IntTy;
+  QualType Int2Ty = AST.getExtVectorType(IntTy, VecSize);
+  QualType Int3Ty = AST.getExtVectorType(IntTy, VecSize + 1);
----------------
hekota wrote:

`Int2Ty` and `Int3Ty` should be named differently because their size depends on the `VecSize` value. How about `IntVec` and `IntVecWithMips`? The 2 comments below also use actual values for Texture2D, they should be more generic.

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


More information about the llvm-branch-commits mailing list