Precise descriptor set unit test

This commit is contained in:
hodasemi 2023-04-16 06:57:39 +02:00
parent c5a5588696
commit d64bc53d9a
2 changed files with 10 additions and 6 deletions

View file

@ -347,7 +347,6 @@ mod test {
use std::sync::Arc;
#[test]
fn create_multiple_sets_from_one_pool() -> Result<()> {
const DESCRIPTOR_COUNT: u32 = 2;
@ -367,11 +366,17 @@ mod test {
.set_layout(descriptor_layout.clone())
.build(device.clone())?;
let descriptors: Result<Vec<Arc<DescriptorSet>>> = (0..DESCRIPTOR_COUNT)
.map(|_| descriptor_pool.prepare_set().allocate())
let descriptors: Vec<Arc<DescriptorSet>> = (0..DESCRIPTOR_COUNT)
.map(|_| {
let set = descriptor_pool.prepare_set().allocate();
assert!(set.is_ok(), "{}", set.err().unwrap());
set.unwrap()
})
.collect();
assert!(descriptors.is_ok(), "{}", descriptors.err().unwrap());
assert_eq!(descriptors.len(), DESCRIPTOR_COUNT as usize);
Ok(())
}

View file

@ -1142,8 +1142,7 @@ impl Device {
unsafe {
let count = allocate_info.descriptorSetCount as usize;
let mut descriptor_sets = Vec::with_capacity(count);
descriptor_sets.set_len(count);
let mut descriptor_sets = vec![VkDescriptorSet::NULL_HANDLE; count];
let result = self.device_functions.vkAllocateDescriptorSets(
self.device,