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

Maybe require #[repr(C)]? #1

Closed
bjorn3 opened this issue Aug 26, 2022 · 4 comments
Closed

Maybe require #[repr(C)]? #1

bjorn3 opened this issue Aug 26, 2022 · 4 comments

Comments

@bjorn3
Copy link

bjorn3 commented Aug 26, 2022

struct Test {
    position: [f32; 2],
    color: [f32; 4]
}

doesn't have a fixed layout. For example rustc may put color before position or add padding. In fact it will in all likelyhood if you use -Zrandomize-layout.

@CorentinDeblock
Copy link
Owner

You are correct, i will put patch asap. Probably in one or two week max.

But be aware that wrld::Desc macro generate only the VertexBufferLayout of the corresponding layout structure. It's up to you to format data with bytemuck and put the #[repr(C)] macro on your structure. Still an issue anyways.

Also you can have a look at BufferData derive macro which generate a structure with bytemuck and repr(C) macro with all the corresponding conversion to one and another.

@bjorn3
Copy link
Author

bjorn3 commented Aug 26, 2022

Makes sense. I missed the BufferData derive macro.

@CorentinDeblock
Copy link
Owner

It's ok, he was released with 0.2.0 which was just released today.

@CorentinDeblock
Copy link
Owner

This issue has been fix.

Wrld::desc now need #[repr(C)] or #[repr(transparent)] in 0.2.2, i will close this issue.

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

No branches or pull requests

2 participants