From 2a221f78f6de83b2ac58385a012262290124f9db Mon Sep 17 00:00:00 2001 From: Alex Butler Date: Thu, 26 Jan 2023 23:43:13 +0000 Subject: [PATCH] Use #[repr(C)] for vertex & constant structs. Fixes issues with rust 1.67 field ordering. --- CHANGELOG.md | 3 +++ src/render/src/macros/structure.rs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c75aff0686..156987ee586 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## Change Log +### v0.18.3 + - `gfx_defines!` uses `#[repr(C)]` for vertex & constant structs. Fixes issues with rust 1.67 field ordering. + ### v0.18 (2019-02-12) - changed `get_dimensions` to return a minimum of 1 - Features: diff --git a/src/render/src/macros/structure.rs b/src/render/src/macros/structure.rs index cf4541b5ffe..673496b1f67 100644 --- a/src/render/src/macros/structure.rs +++ b/src/render/src/macros/structure.rs @@ -95,7 +95,7 @@ macro_rules! gfx_vertex_struct_meta { ($(#[$attr:meta])* vertex_struct_meta $root:ident { $( $(#[$field_attr:meta])* $field:ident: $ty:ty = $name:expr, )* }) => (gfx_impl_struct_meta!{ - $(#[$attr])* impl_struct_meta + $(#[$attr])* #[repr(C)] impl_struct_meta $crate::format::Format : $crate::format::Formatted = $root { $( $(#[$field_attr])* $field: $ty = $name, )* @@ -121,7 +121,7 @@ macro_rules! gfx_constant_struct_meta { ($(#[$attr:meta])* constant_struct_meta $root:ident { $( $(#[$field_attr:meta])* $field:ident: $ty:ty = $name:expr, )* }) => (gfx_impl_struct_meta!{ - $(#[$attr])* impl_struct_meta + $(#[$attr])* #[repr(C)] impl_struct_meta $crate::shade::ConstFormat : $crate::shade::Formatted = $root { $( $(#[$field_attr])* $field: $ty = $name, )*