Struct gpu_descriptor::DescriptorAllocator
source · pub struct DescriptorAllocator<P, S> { /* private fields */ }
Expand description
Descriptor allocator. Can be used to allocate descriptor sets for any layout.
Implementations§
source§impl<P, S> DescriptorAllocator<P, S>
impl<P, S> DescriptorAllocator<P, S>
sourcepub fn new(max_update_after_bind_descriptors_in_all_pools: u32) -> Self
pub fn new(max_update_after_bind_descriptors_in_all_pools: u32) -> Self
Create new allocator instance.
sourcepub unsafe fn allocate<L, D>(
&mut self,
device: &D,
layout: &L,
flags: DescriptorSetLayoutCreateFlags,
layout_descriptor_count: &DescriptorTotalCount,
count: u32
) -> Result<Vec<DescriptorSet<S>>, AllocationError>
pub unsafe fn allocate<L, D>( &mut self, device: &D, layout: &L, flags: DescriptorSetLayoutCreateFlags, layout_descriptor_count: &DescriptorTotalCount, count: u32 ) -> Result<Vec<DescriptorSet<S>>, AllocationError>
Allocate descriptor set with specified layout.
§Safety
- Same
device
instance must be passed to all method calls of oneDescriptorAllocator
instance. flags
must match flags that were used to create the layout.layout_descriptor_count
must match descriptor numbers in the layout.
sourcepub unsafe fn free<L, D, I>(&mut self, device: &D, sets: I)
pub unsafe fn free<L, D, I>(&mut self, device: &D, sets: I)
Free descriptor sets.
§Safety
- Same
device
instance must be passed to all method calls of oneDescriptorAllocator
instance. - None of descriptor sets can be referenced in any pending command buffers.
- All command buffers where at least one of descriptor sets referenced move to invalid state.
sourcepub unsafe fn cleanup<L>(&mut self, device: &impl DescriptorDevice<L, P, S>)
pub unsafe fn cleanup<L>(&mut self, device: &impl DescriptorDevice<L, P, S>)
Perform cleanup to allow resources reuse.
§Safety
- Same
device
instance must be passed to all method calls of oneDescriptorAllocator
instance.
Trait Implementations§
Auto Trait Implementations§
impl<P, S> Freeze for DescriptorAllocator<P, S>
impl<P, S> RefUnwindSafe for DescriptorAllocator<P, S>where
S: RefUnwindSafe,
P: RefUnwindSafe,
impl<P, S> Send for DescriptorAllocator<P, S>
impl<P, S> Sync for DescriptorAllocator<P, S>
impl<P, S> Unpin for DescriptorAllocator<P, S>
impl<P, S> UnwindSafe for DescriptorAllocator<P, S>where
S: UnwindSafe,
P: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more