diff --git a/crates/bevy_render/src/pipeline/binding.rs b/crates/bevy_render/src/pipeline/binding.rs index 1ef8cea107..a467d8fd91 100644 --- a/crates/bevy_render/src/pipeline/binding.rs +++ b/crates/bevy_render/src/pipeline/binding.rs @@ -21,7 +21,7 @@ pub struct BindingDescriptor { pub enum BindType { Uniform { dynamic: bool, - properties: Vec, + property: UniformProperty, }, StorageBuffer { dynamic: bool, @@ -45,11 +45,7 @@ pub enum BindType { impl BindType { pub fn get_uniform_size(&self) -> Option { match self { - BindType::Uniform { properties, .. } => Some( - properties - .iter() - .fold(0, |total, property| total + property.get_size()), - ), + BindType::Uniform { property, .. } => Some(property.get_size()), _ => None, } } diff --git a/crates/bevy_render/src/render_graph/nodes/pass_node.rs b/crates/bevy_render/src/render_graph/nodes/pass_node.rs index dbc46fe09f..d0731533e9 100644 --- a/crates/bevy_render/src/render_graph/nodes/pass_node.rs +++ b/crates/bevy_render/src/render_graph/nodes/pass_node.rs @@ -77,7 +77,7 @@ impl PassNode { index: 0, bind_type: BindType::Uniform { dynamic: false, - properties: vec![UniformProperty::Struct(vec![UniformProperty::Mat4])], + property: UniformProperty::Struct(vec![UniformProperty::Mat4]), }, shader_stage: BindingShaderStage::VERTEX | BindingShaderStage::FRAGMENT, }], diff --git a/crates/bevy_render/src/renderer/render_resource/render_resource_bindings.rs b/crates/bevy_render/src/renderer/render_resource/render_resource_bindings.rs index 1536531107..e1e3941c9c 100644 --- a/crates/bevy_render/src/renderer/render_resource/render_resource_bindings.rs +++ b/crates/bevy_render/src/renderer/render_resource/render_resource_bindings.rs @@ -273,7 +273,7 @@ mod tests { name: "a".to_string(), bind_type: BindType::Uniform { dynamic: false, - properties: vec![UniformProperty::Struct(vec![UniformProperty::Mat4])], + property: UniformProperty::Struct(vec![UniformProperty::Mat4]), }, shader_stage: BindingShaderStage::VERTEX | BindingShaderStage::FRAGMENT, }, @@ -282,7 +282,7 @@ mod tests { name: "b".to_string(), bind_type: BindType::Uniform { dynamic: false, - properties: vec![UniformProperty::Float], + property: UniformProperty::Float, }, shader_stage: BindingShaderStage::VERTEX | BindingShaderStage::FRAGMENT, }, diff --git a/crates/bevy_render/src/shader/shader_reflect.rs b/crates/bevy_render/src/shader/shader_reflect.rs index 86bc07c611..c6aa300d45 100644 --- a/crates/bevy_render/src/shader/shader_reflect.rs +++ b/crates/bevy_render/src/shader/shader_reflect.rs @@ -177,7 +177,7 @@ fn reflect_binding(binding: &ReflectDescriptorBinding) -> BindingDescriptor { &type_description.type_name, BindType::Uniform { dynamic: false, - properties: vec![reflect_uniform(type_description)], + property: reflect_uniform(type_description), }, ), ReflectDescriptorType::SampledImage => ( @@ -412,9 +412,9 @@ mod tests { name: "Camera".into(), bind_type: BindType::Uniform { dynamic: false, - properties: vec![UniformProperty::Struct(vec![ + property: UniformProperty::Struct(vec![ UniformProperty::Mat4 - ])], + ]), }, shader_stage: BindingShaderStage::VERTEX | BindingShaderStage::FRAGMENT, }] diff --git a/crates/bevy_wgpu/src/wgpu_type_converter.rs b/crates/bevy_wgpu/src/wgpu_type_converter.rs index e5bf27d3f7..f8d7bdd657 100644 --- a/crates/bevy_wgpu/src/wgpu_type_converter.rs +++ b/crates/bevy_wgpu/src/wgpu_type_converter.rs @@ -182,7 +182,7 @@ impl WgpuFrom<&BindType> for wgpu::BindingType { match bind_type { BindType::Uniform { dynamic, - properties: _properties, + .. } => wgpu::BindingType::UniformBuffer { dynamic: *dynamic, min_binding_size: bind_type