-
Notifications
You must be signed in to change notification settings - Fork 34
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
[0010] Is type punning allowed? #43
Comments
This is hard to answer. SPIR-V does not allow unions. It is unclear what we would be able to do with type punning. |
If it is decided that type punning through unions is allowed, I think we could define what happens during type punning of a buffer pointer between buffer pointers or a buffer pointer and a uint64_t. It would essentially be a casting operation. Any interaction between a buffer pointer and any other type would be undefined. If it is decided to support the aliasing attributes vk::aliased and vk::restrict, it would be the users responsibility to make sure any pointers are attributed correctly based on how they are dereferenced. If the aliasing attributes are not supported, the user must take care when dereferencing pointers to assure correct behavior. |
Given the current aliasing policy, I must change change the proposal above. Type punning across different buffer pointer types with the vk::aliased_pointer attribute is currently not directly expressible in SPIR-V, so I would lean toward disallowing it. |
I think that is fine. People will still have the option to have a BufferPointer to a union. We can revisit later if needed, but you shouldn't have to deal with that now. |
* Add type punning rules to vk::BufferPointer Fixes #43 * Clarify that type punning with buffer pointers leads to undefined behavior.
Which proposal does this relate to?
0010-vk-buffer-ref.md
Describe the issue or outstanding question.
With the planned introduction of unions to HLSL we need to know if
vk::BufferPointer<T,A>
objects are allowed in unions and if type punning is allowed.Additional context
See initial review discussion.
Related unions issue.
The text was updated successfully, but these errors were encountered: