gfx-rs / gfx

[maintenance mode] A low-overhead Vulkan-like GPU API for Rust.
http://gfx-rs.github.io/
Apache License 2.0
5.35k stars 551 forks source link

[v0.18] Use #[repr(C)] for vertex & constant structs. #3791

Closed alexheretic closed 1 year ago

alexheretic commented 1 year ago

Fixes issues exposed by rust 1.67 field ordering changes (https://github.com/rust-lang/rust/pull/102750/)

This PR adds #[repr(C)] to vertex & constant structs preventing field ordering issues.

Note: This actually still works fine even if users have manually specified #[repr(C)] themselves since declaring it multiple times works fine, e.g. this works:

#[repr(C)]
#[repr(C)]
#[repr(C)]
pub struct Vertex { ...

Resolves #3790

Could we get a new gfx crate release with this in it please? I think this will help out any old-school users of this crate.

alexheretic commented 1 year ago

Hey @kvark i know v0.18 is ancient these days, but this fix is quite valuable for anyone still using it with rust 1.67 (like me). I think it's worth making a 0.18.3 release with this. Wdyt?

kvark commented 1 year ago

@alexheretic sure, sounds good!

kvark commented 1 year ago

Would you mind bumping the version to 0.18.3 in the PR?

alexheretic commented 1 year ago

Would you mind bumping the version to 0.18.3 in the PR?

:heavy_check_mark:

kvark commented 1 year ago

Published now. Thank you for support!