diff --git a/crates/bevy_pbr/src/light.rs b/crates/bevy_pbr/src/light.rs index 046ebd60c2..24b0a68751 100644 --- a/crates/bevy_pbr/src/light.rs +++ b/crates/bevy_pbr/src/light.rs @@ -28,7 +28,8 @@ impl Default for PointLight { pub(crate) struct PointLightUniform { pub pos: [f32; 4], pub color: [f32; 4], - pub inverse_range_squared: f32, + // storing as a `[f32; 4]` for memory alignement + pub inverse_range_squared: [f32; 4], } unsafe impl Byteable for PointLightUniform {} @@ -43,7 +44,7 @@ impl PointLightUniform { PointLightUniform { pos: [x, y, z, 1.0], color, - inverse_range_squared: 1.0 / (light.range * light.range), + inverse_range_squared: [1.0 / (light.range * light.range), 0., 0., 0.], } } } diff --git a/crates/bevy_pbr/src/render_graph/lights_node.rs b/crates/bevy_pbr/src/render_graph/lights_node.rs index 8dfb20cf6c..8f89570eae 100644 --- a/crates/bevy_pbr/src/render_graph/lights_node.rs +++ b/crates/bevy_pbr/src/render_graph/lights_node.rs @@ -47,6 +47,7 @@ impl Node for LightsNode { #[repr(C)] #[derive(Debug, Clone, Copy)] struct LightCount { + // storing as a `[u32; 4]` for memory alignement pub num_lights: [u32; 4], }