Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HLSL] Treat structures in resources as packed #121010

Open
bogner opened this issue Dec 23, 2024 · 0 comments
Open

[HLSL] Treat structures in resources as packed #121010

bogner opened this issue Dec 23, 2024 · 0 comments
Labels
HLSL HLSL Language Support

Comments

@bogner
Copy link
Contributor

bogner commented Dec 23, 2024

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 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

This is obviously not how we should handle this in upstream.

@bogner bogner added the HLSL HLSL Language Support label Dec 23, 2024
@bogner bogner moved this to Planning in HLSL Support Dec 23, 2024
bogner added a commit to bogner/HLSLTest that referenced this issue Dec 23, 2024
This moves the current structured buffer test to a new file and
introduces a simpler one that doesn't need llvm/llvm-project#104503 and
llvm/llvm-project#121010 to be in place in order to pass.

Note: this would be better if it exercised both SRVs and UAVs, but SRV
support isn't implemented in the test framework yet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HLSL HLSL Language Support
Projects
Status: Planning
Development

No branches or pull requests

1 participant