Precise descriptor set unit test
This commit is contained in:
parent
c5a5588696
commit
d64bc53d9a
2 changed files with 10 additions and 6 deletions
|
@ -347,7 +347,6 @@ mod test {
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
||||||
fn create_multiple_sets_from_one_pool() -> Result<()> {
|
fn create_multiple_sets_from_one_pool() -> Result<()> {
|
||||||
const DESCRIPTOR_COUNT: u32 = 2;
|
const DESCRIPTOR_COUNT: u32 = 2;
|
||||||
|
|
||||||
|
@ -367,11 +366,17 @@ mod test {
|
||||||
.set_layout(descriptor_layout.clone())
|
.set_layout(descriptor_layout.clone())
|
||||||
.build(device.clone())?;
|
.build(device.clone())?;
|
||||||
|
|
||||||
let descriptors: Result<Vec<Arc<DescriptorSet>>> = (0..DESCRIPTOR_COUNT)
|
let descriptors: Vec<Arc<DescriptorSet>> = (0..DESCRIPTOR_COUNT)
|
||||||
.map(|_| descriptor_pool.prepare_set().allocate())
|
.map(|_| {
|
||||||
|
let set = descriptor_pool.prepare_set().allocate();
|
||||||
|
|
||||||
|
assert!(set.is_ok(), "{}", set.err().unwrap());
|
||||||
|
|
||||||
|
set.unwrap()
|
||||||
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
assert!(descriptors.is_ok(), "{}", descriptors.err().unwrap());
|
assert_eq!(descriptors.len(), DESCRIPTOR_COUNT as usize);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -1142,8 +1142,7 @@ impl Device {
|
||||||
unsafe {
|
unsafe {
|
||||||
let count = allocate_info.descriptorSetCount as usize;
|
let count = allocate_info.descriptorSetCount as usize;
|
||||||
|
|
||||||
let mut descriptor_sets = Vec::with_capacity(count);
|
let mut descriptor_sets = vec![VkDescriptorSet::NULL_HANDLE; count];
|
||||||
descriptor_sets.set_len(count);
|
|
||||||
|
|
||||||
let result = self.device_functions.vkAllocateDescriptorSets(
|
let result = self.device_functions.vkAllocateDescriptorSets(
|
||||||
self.device,
|
self.device,
|
||||||
|
|
Loading…
Reference in a new issue