Save an allocation of raw bindings in create_bind_group

This commit is contained in:
Dzmitry Malyshau committed 2020-10-15 16:37:10 -04:00
1 parent 7ecd9b477f
commit 8ce2530b69
1 file changed
+4 -4
+4 -4
View File
@@ -702,13 +702,13 @@ impl<B: GfxBackend> Device<B> {
.map_or(1, |v| v.get() as hal::pso::DescriptorArrayIndex), //TODO: consolidate
stage_flags: conv::map_shader_stage_flags(entry.visibility),
immutable_samplers: false, // TODO
})
.collect::<Vec<_>>(); //TODO: avoid heap allocation
});
let desc_counts = raw_bindings.clone().collect();
let raw = unsafe {
let mut raw_layout = self
.raw
.create_descriptor_set_layout(&raw_bindings, &[])
.create_descriptor_set_layout(raw_bindings, &[])
.or(Err(DeviceError::OutOfMemory))?;
if let Some(label) = label {
self.raw
@@ -734,7 +734,7 @@ impl<B: GfxBackend> Device<B> {
ref_count: self.life_guard.add_ref(),
},
multi_ref_count: MultiRefCount::new(),
desc_counts: raw_bindings.iter().cloned().collect(),
desc_counts,
dynamic_count: entry_map
.values()
.filter(|b| b.ty.has_dynamic_offset())