[clang] [HLSL] support packoffset in clang codeGen (PR #91999)

Xiang Li via cfe-commits cfe-commits at lists.llvm.org
Thu May 16 08:18:39 PDT 2024


================
@@ -5671,6 +5671,54 @@ HLSLBufferDecl *HLSLBufferDecl::CreateDeserialized(ASTContext &C,
                                     SourceLocation(), SourceLocation());
 }
 
+static uint64_t calculateLegacyCbufferAlign(const ASTContext &Context,
+                                            QualType T) {
+  if (T->isAggregateType())
+    return 128;
+  else if (const VectorType *VT = T->getAs<VectorType>())
+    return Context.getTypeSize(VT->getElementType());
+  else
+    return Context.getTypeSize(T);
+}
+
+unsigned HLSLBufferDecl::calculateLegacyCbufferSize(const ASTContext &Context,
----------------
python3kgae wrote:

Done.

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


More information about the cfe-commits mailing list