[llvm-branch-commits] [clang] [HLSL] Implicit resource binding for cbuffers (PR #139022)
Justin Bogner via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun May 11 14:47:02 PDT 2025
================
@@ -539,19 +537,27 @@ static void initializeBuffer(CodeGenModule &CGM, llvm::GlobalVariable *GV,
}
static void initializeBufferFromBinding(CodeGenModule &CGM,
- llvm::GlobalVariable *GV, unsigned Slot,
- unsigned Space) {
+ llvm::GlobalVariable *GV,
+ HLSLResourceBindingAttr *RBA) {
llvm::Type *Int1Ty = llvm::Type::getInt1Ty(CGM.getLLVMContext());
- llvm::Value *Args[] = {
- llvm::ConstantInt::get(CGM.IntTy, Space), /* reg_space */
- llvm::ConstantInt::get(CGM.IntTy, Slot), /* lower_bound */
- llvm::ConstantInt::get(CGM.IntTy, 1), /* range_size */
- llvm::ConstantInt::get(CGM.IntTy, 0), /* index */
- llvm::ConstantInt::get(Int1Ty, false) /* non-uniform */
- };
- initializeBuffer(CGM, GV,
- CGM.getHLSLRuntime().getCreateHandleFromBindingIntrinsic(),
- Args);
+ auto *False = llvm::ConstantInt::get(Int1Ty, false);
+ auto *Zero = llvm::ConstantInt::get(CGM.IntTy, 0);
+ auto *One = llvm::ConstantInt::get(CGM.IntTy, 1);
----------------
bogner wrote:
Shouldn't these be called `NonUniform`, `Index`, and `RangeSize`? Naming these after their values isn't very helpful.
https://github.com/llvm/llvm-project/pull/139022
More information about the llvm-branch-commits
mailing list