Replace vector of UniformProperty with a single property
This commit is contained in:
parent
7db4821287
commit
9883cd15cd
@ -21,7 +21,7 @@ pub struct BindingDescriptor {
|
|||||||
pub enum BindType {
|
pub enum BindType {
|
||||||
Uniform {
|
Uniform {
|
||||||
dynamic: bool,
|
dynamic: bool,
|
||||||
properties: Vec<UniformProperty>,
|
property: UniformProperty,
|
||||||
},
|
},
|
||||||
StorageBuffer {
|
StorageBuffer {
|
||||||
dynamic: bool,
|
dynamic: bool,
|
||||||
@ -45,11 +45,7 @@ pub enum BindType {
|
|||||||
impl BindType {
|
impl BindType {
|
||||||
pub fn get_uniform_size(&self) -> Option<u64> {
|
pub fn get_uniform_size(&self) -> Option<u64> {
|
||||||
match self {
|
match self {
|
||||||
BindType::Uniform { properties, .. } => Some(
|
BindType::Uniform { property, .. } => Some(property.get_size()),
|
||||||
properties
|
|
||||||
.iter()
|
|
||||||
.fold(0, |total, property| total + property.get_size()),
|
|
||||||
),
|
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ impl<Q: HecsQuery> PassNode<Q> {
|
|||||||
index: 0,
|
index: 0,
|
||||||
bind_type: BindType::Uniform {
|
bind_type: BindType::Uniform {
|
||||||
dynamic: false,
|
dynamic: false,
|
||||||
properties: vec![UniformProperty::Struct(vec![UniformProperty::Mat4])],
|
property: UniformProperty::Struct(vec![UniformProperty::Mat4]),
|
||||||
},
|
},
|
||||||
shader_stage: BindingShaderStage::VERTEX | BindingShaderStage::FRAGMENT,
|
shader_stage: BindingShaderStage::VERTEX | BindingShaderStage::FRAGMENT,
|
||||||
}],
|
}],
|
||||||
|
@ -273,7 +273,7 @@ mod tests {
|
|||||||
name: "a".to_string(),
|
name: "a".to_string(),
|
||||||
bind_type: BindType::Uniform {
|
bind_type: BindType::Uniform {
|
||||||
dynamic: false,
|
dynamic: false,
|
||||||
properties: vec![UniformProperty::Struct(vec![UniformProperty::Mat4])],
|
property: UniformProperty::Struct(vec![UniformProperty::Mat4]),
|
||||||
},
|
},
|
||||||
shader_stage: BindingShaderStage::VERTEX | BindingShaderStage::FRAGMENT,
|
shader_stage: BindingShaderStage::VERTEX | BindingShaderStage::FRAGMENT,
|
||||||
},
|
},
|
||||||
@ -282,7 +282,7 @@ mod tests {
|
|||||||
name: "b".to_string(),
|
name: "b".to_string(),
|
||||||
bind_type: BindType::Uniform {
|
bind_type: BindType::Uniform {
|
||||||
dynamic: false,
|
dynamic: false,
|
||||||
properties: vec![UniformProperty::Float],
|
property: UniformProperty::Float,
|
||||||
},
|
},
|
||||||
shader_stage: BindingShaderStage::VERTEX | BindingShaderStage::FRAGMENT,
|
shader_stage: BindingShaderStage::VERTEX | BindingShaderStage::FRAGMENT,
|
||||||
},
|
},
|
||||||
|
@ -177,7 +177,7 @@ fn reflect_binding(binding: &ReflectDescriptorBinding) -> BindingDescriptor {
|
|||||||
&type_description.type_name,
|
&type_description.type_name,
|
||||||
BindType::Uniform {
|
BindType::Uniform {
|
||||||
dynamic: false,
|
dynamic: false,
|
||||||
properties: vec![reflect_uniform(type_description)],
|
property: reflect_uniform(type_description),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ReflectDescriptorType::SampledImage => (
|
ReflectDescriptorType::SampledImage => (
|
||||||
@ -412,9 +412,9 @@ mod tests {
|
|||||||
name: "Camera".into(),
|
name: "Camera".into(),
|
||||||
bind_type: BindType::Uniform {
|
bind_type: BindType::Uniform {
|
||||||
dynamic: false,
|
dynamic: false,
|
||||||
properties: vec![UniformProperty::Struct(vec![
|
property: UniformProperty::Struct(vec![
|
||||||
UniformProperty::Mat4
|
UniformProperty::Mat4
|
||||||
])],
|
]),
|
||||||
},
|
},
|
||||||
shader_stage: BindingShaderStage::VERTEX | BindingShaderStage::FRAGMENT,
|
shader_stage: BindingShaderStage::VERTEX | BindingShaderStage::FRAGMENT,
|
||||||
}]
|
}]
|
||||||
|
@ -182,7 +182,7 @@ impl WgpuFrom<&BindType> for wgpu::BindingType {
|
|||||||
match bind_type {
|
match bind_type {
|
||||||
BindType::Uniform {
|
BindType::Uniform {
|
||||||
dynamic,
|
dynamic,
|
||||||
properties: _properties,
|
..
|
||||||
} => wgpu::BindingType::UniformBuffer {
|
} => wgpu::BindingType::UniformBuffer {
|
||||||
dynamic: *dynamic,
|
dynamic: *dynamic,
|
||||||
min_binding_size: bind_type
|
min_binding_size: bind_type
|
||||||
|
Loading…
Reference in New Issue
Block a user