Issue 121010
Summary [HLSL] Treat structures in resources as packed
Labels HLSL
Assignees
Reporter bogner
    Structures in HLSL's StructuredBuffer need to be treated as packed, or otherwise made to skip adding any padding for compatibility with DXC.

Note: `dxc` does this by [hacking padding off](https://github.com/microsoft/DirectXShaderCompiler/blob/v1.8.2407/tools/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp#L277) of *all* structures in CGRecordLowering::lower, like so:
```c++
#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
```

This is obviously not how we should handle this in upstream.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to