[clang] [HLSL][NFC] Move packoffset validation to separate function and calculate offsets in bytes (PR #121989)

Joshua Batista via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 7 13:13:45 PST 2025


================
@@ -4721,9 +4721,9 @@ def HLSLPackOffset: HLSLAnnotationAttr {
   let Args = [IntArgument<"Subcomponent">, IntArgument<"Component">];
   let Documentation = [HLSLPackOffsetDocs];
   let AdditionalMembers = [{
-      unsigned getOffset() {
-        return subcomponent * 4 + component;
-      }
+  unsigned getOffsetInBytes() {
----------------
bob80905 wrote:

These coefficients are being increased by a factor of 4.
This is strange, as if this returns offset in bits, you'd expect an increase by a factor of 8 to get bytes. 
Do you mean *32 and *8?
Why *16 and *4?

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


More information about the cfe-commits mailing list