-
Notifications
You must be signed in to change notification settings - Fork 31
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 bytemuck
integration for vector types
#80
Comments
Why not! I'll look into it and get back to you soon. |
Just now, I published 0.15.4, which adds support for I did not implement these traits for matrices, quaternions and others, because the order of their members is not "standardized", but they can be explicitly converted to vectors if needed. I'll close this issue but feel free to let me know of any remarks or requests you may have! |
Sorry in advance for commenting on an old issue, but is there a reason why |
Hi @jedjoud10 , actually In my last comment my argument was:
I'm not sure how much that holds, actually. What I think I meant is that the order of members within a quaternion is not guaranteed (some libs store them as WXYZ), and for matrices you have to know whether you're using a row-major or column-major layout; all of that meaning that if you want to (de-)serialize, you should convert to a stable intermediate representation that you control; one of these being vectors; the order of their members will always be the same, there is no question about what the memory layout is. So what you can do is convert your quaternions and matrices to vectors or vectors-of-vectors respectively, and then do I'd accept a PR that does this; if you'd prefer I do it, feel free to ask, but I can't guarantee how soon I'll get to work on it, due to limited time. |
I have a PR ready, sorry it took a while I was busy with other stuff. Really small change as well. Just to make sure I understand correctly though, you'd only implement bytemuck's |
If you do it for I don't think people care that much about using Thanks! |
Oh okay sure! |
Actually I've taken a look at the codebase and remembered that at some point, I made It would be extra nice to add a test that proves that |
Just FYI, I needed to upgrade the version of |
Sure, go ahead! |
As far as I can tell all of the various vector types can be
Pod
and maybe evenZeroable
, adding a bytemuck feature that enables implementations for the various vec types would allow (for example) casting slices of vectors into slices of bytes safety, among other things.As a real-world example this could be used within Rust-CUDA here to convert the buffer safety
The text was updated successfully, but these errors were encountered: