You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
always give the guarantee that vertices are repr(C)
Would you mind if I asked where you're using the repr(C) attribute? Does GLSL require repr(C) condition for some reason?
No, it doesn't.
However, the Rust representation on my machine for the various vertices is the same as repr(C) (e.g., TexturedVertex is 36 bytes, the same as 9 f32).
However, it seems to me that with repr(C) you're more sure you can pass Vec<V> (with V a vertex type) slices to glBufferData.
From repr(C) in the Rustonomicon:
This [repr(C)] is also necessary to soundly do more elaborate tricks with data layout such as reinterpreting values as a different type.
Hence the request.
Also, you are also sure you can send these types through FFI in this way.
For example, nalgebra also uses #[repr(C)], even though not strictly needed.
For my case, using bytemuck would also work, but for now I had to use reinterpret, instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I think it'd be useful to always give the guarantee that vertices are
repr(C), not only with vulkano.