================
@@ -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() {
----------------
hekota wrote:

The `subcomponent` number is a row index and each row is 16 bytes long. The 
`component` number is 0-3 and it is an index of one of the 4 elements on the 
row (`xyzw`). So if you have `packoffset(c2.y)`, the subcomponent is 2, 
component is 1, and the byte offset is 2*16 + 4.

Previously this was returning the offset as a number of 4-byte elements from 
the start of the buffer and the packoffset validation was converting it to bits 
by multiplying it by 32. I am changing all of these to use bytes.

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

Reply via email to