[llvm-branch-commits] [clang] [HLSL] Implement explicit layout for default constant buffer ($Globals) (PR #128991)
Damyan Pepper via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Feb 26 20:27:52 PST 2025
================
@@ -179,21 +179,45 @@ createBufferHandleType(const HLSLBufferDecl *BufDecl) {
return cast<HLSLAttributedResourceType>(QT.getTypePtr());
}
+// Iterates over all declarations in the HLSL buffer and based on the
+// packoffset or register(c#) annotations it fills outs the Layout
+// vector with the user-specified layout offsets.
+// The buffer offsets can be specified 2 ways:
+// 1. declarations in cbuffer {} block can have a packoffset annotation
+// (translates to HLSLPackOffsetAttr)
+// 2. default constant buffer declarations at global scope can have
+// register(c#) annotations (translates to HLSLResourceBindingAttr with
+// RegisterType::C)
+// It is not quaranteed that all declarations in a buffer have an annotation.
----------------
damyanp wrote:
```suggestion
// It is not guaranteed that all declarations in a buffer have an annotation.
```
https://github.com/llvm/llvm-project/pull/128991
More information about the llvm-branch-commits
mailing list