[clang] [HLSL][Sema] Fix Struct Size Calculation containing 16/32 bit scalars (PR #128086)

Ashley Coleman via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 21 09:08:47 PST 2025


================
@@ -172,6 +172,27 @@ Decl *SemaHLSL::ActOnStartBuffer(Scope *BufferScope, bool CBuffer,
   return Result;
 }
 
+static unsigned calculateLegacyCbufferFieldAlign(const ASTContext &Context,
+                                                 QualType T) {
+  // Aggregate types are always aligned to new buffer rows
+  if (T->isAggregateType())
+    return 16;
+
+  assert(Context.getTypeSize(T) <= 64 &&
----------------
V-FEXrt wrote:

Ah it seems I have incorrectly assumed that vector is considered an aggregate, I need to go handle that case

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


More information about the cfe-commits mailing list