================
@@ -557,29 +553,47 @@ static void initializeBuffer(CodeGenModule &CGM, 
llvm::GlobalVariable *GV,
   CGM.AddCXXGlobalInit(InitResFunc);
 }
 
-static void initializeBufferFromBinding(CodeGenModule &CGM,
-                                        llvm::GlobalVariable *GV,
-                                        HLSLResourceBindingAttr *RBA) {
+void CGHLSLRuntime::initializeBufferFromBinding(const HLSLBufferDecl *BufDecl,
+                                                llvm::GlobalVariable *GV,
+                                                HLSLResourceBindingAttr *RBA) {
   llvm::Type *Int1Ty = llvm::Type::getInt1Ty(CGM.getLLVMContext());
   auto *NonUniform = llvm::ConstantInt::get(Int1Ty, false);
   auto *Index = llvm::ConstantInt::get(CGM.IntTy, 0);
   auto *RangeSize = llvm::ConstantInt::get(CGM.IntTy, 1);
   auto *Space =
       llvm::ConstantInt::get(CGM.IntTy, RBA ? RBA->getSpaceNumber() : 0);
+  Value *Name = nullptr;
+
+  // DXIL intrinsic includes resource name
+  if (getArch() == Triple::dxil) {
+    std::string Str = std::string(BufDecl->getName());
+    std::string GlobalName = Str + ".str";
----------------
bogner wrote:

Nit: I think constructor syntax is more readable here.
```suggestion
    std::string Str(BufDecl->getName());
    std::string GlobalName(Str + ".str");
```

https://github.com/llvm/llvm-project/pull/139991
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to