-
Notifications
You must be signed in to change notification settings - Fork 236
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
Add a way to index into array pointers with custom element alignment #5873
Comments
This isn't possible right now. Before we are able to add support for this feature, the work around is to wrap the element type in a wrapper struct that pads the size to alignment boundary, and then use |
Thank you for filing this issue. This is worth resolving, but we don’t have current available bandwidth – moving to the backlog for now. Please do feel welcome to propose a solution if you’re able to before it makes it out of the backlog! |
The easiest path to allow this in the Slang compiler is to add a [Align(x)] attribute that works on
If this works for you, we should be able to implement this relatively quickly. |
This is the C++ style I mentioned so yes this would work perfectly! Wouldn't this also completely replace the need for |
LoadAligned/storeAligned is simply a lower level concept so you can do aligned access without any type wrappers. |
In GLSL,
buffer_reference_align
can be used to specify a custom alignment:GLSL_EXT_buffer_reference
, pointers are assumed to point to a single element T, whose address is aligned tobuffer_reference_align
.GLSL_EXT_buffer_reference2
, pointers can point to an unsized array of elements T, where each element is individually aligned tobuffer_reference_align
.I believe this is not currently possible in Slang.
I see two ways in which this use case could be implemented:
buffer_reference_align
), where we can specify the element alignment/stride at the pointer levelalignas()
) where we can specify the alignment at the type levelThe text was updated successfully, but these errors were encountered: