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

MSL: Handle OpPtrAccessChain with ArrayStride #2346

Merged
merged 6 commits into from
Jun 19, 2024
Merged

Conversation

HansKristian-Work
Copy link
Contributor

Case here is pointer to float3 with array stride of 12. Plain dereference will not work. To be more general, we can do pointer arith instead. For alignment, we have to cast the result to a packed_float3. All of this is rather awkward, but there aren't many great alternatives.

We're missing handling of Aligned mask for Load/Store, where we might have to cast a pointer to scalar types at last minute, which would make this reinterpret_cast chain even more ridiculous.

Fixes #2336.

Normally BDA is pointer to block, but there are use cases with
OpPtrAccessChain.
If the stride is weird for non-struct types you gotta do what you gotta
do.
We're still technically missing handling for Aligned mask on Load/Store,
but that needs separate analysis and gets horribly annoying ...
This should cover most use cases.
@HansKristian-Work HansKristian-Work merged commit d79ba7d into main Jun 19, 2024
6 checks passed
@HansKristian-Work HansKristian-Work deleted the fix-2336 branch June 19, 2024 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Slang produces spv that works on win/linux but not with MoltenVk
1 participant