diff --git a/crates/bevy_render/src/render_resource/uniform_buffer.rs b/crates/bevy_render/src/render_resource/uniform_buffer.rs index c9fa3bec3da1d..77eaa4464922e 100644 --- a/crates/bevy_render/src/render_resource/uniform_buffer.rs +++ b/crates/bevy_render/src/render_resource/uniform_buffer.rs @@ -195,7 +195,7 @@ impl Default for DynamicUniformBuffer { } } -impl DynamicUniformBuffer { +impl DynamicUniformBuffer { pub fn new_with_alignment(alignment: u64) -> Self { Self { scratch: DynamicUniformBufferWrapper::new_with_alignment(Vec::new(), alignment), @@ -226,12 +226,6 @@ impl DynamicUniformBuffer { self.scratch.as_ref().is_empty() } - /// Push data into the `DynamicUniformBuffer`'s internal vector (residing on system RAM). - #[inline] - pub fn push(&mut self, value: &T) -> u32 { - self.scratch.write(value).unwrap() as u32 - } - pub fn set_label(&mut self, label: Option<&str>) { let label = label.map(str::to_string); @@ -353,6 +347,14 @@ impl DynamicUniformBuffer { } } +impl DynamicUniformBuffer { + /// Push data into the `DynamicUniformBuffer`'s internal vector (residing on system RAM). + #[inline] + pub fn push(&mut self, value: &T) -> u32 { + self.scratch.write(value).unwrap() as u32 + } +} + /// A writer that can be used to directly write elements into the target buffer. /// /// For more information, see [`DynamicUniformBuffer::get_writer`]. diff --git a/crates/bevy_render/src/uniform.rs b/crates/bevy_render/src/uniform.rs index 79d8f61c4041c..e51a424e896d0 100644 --- a/crates/bevy_render/src/uniform.rs +++ b/crates/bevy_render/src/uniform.rs @@ -75,9 +75,12 @@ impl ComponentUniforms { impl Default for ComponentUniforms { fn default() -> Self { - Self { - uniforms: Default::default(), - } + let mut uniforms = DynamicUniformBuffer::default(); + uniforms.set_label(Some(&format!( + "{} ComponentUniforms buffer", + core::any::type_name::() + ))); + Self { uniforms } } }