Closed
Description
Structures in HLSL are all treated as packed by DXC. This is especially important for structures within a StructuredBuffer.
dxc
implements this by hacking padding off of all structures in CGRecordLowering::lower, like so:
#if 0 // HLSL Change - No padding for structure. Array offset will be handled when load/store is called
Members.push_back(StorageInfo(Size, getIntNType(8)));
clipTailPadding();
determinePacked(NVBaseType);
insertPadding();
Members.pop_back();
calculateZeroInit();
#endif // HLSL Change End
In upstream, we can probably get away with attaching __attribute__((packed))
implicitly to structs during Sema. This is similar to how AddAlignmentAttributesForRecord and AddMsStructLayoutForRecord work and should match DXC's behaviour.
AC:
- Implement and test implicitly applying the packed attribute to structs
Metadata
Metadata
Assignees
Type
Projects
Status
Closed