Struct gpu_descriptor::DescriptorAllocator

source ·
pub struct DescriptorAllocator<P, S> {
    buckets: HashMap<(DescriptorTotalCount, bool), DescriptorBucket<P>>,
    sets_cache: Vec<DescriptorSet<S>>,
    raw_sets_cache: Vec<S>,
    max_update_after_bind_descriptors_in_all_pools: u32,
    current_update_after_bind_descriptors_in_all_pools: u32,
    total: u32,
}
Expand description

Descriptor allocator. Can be used to allocate descriptor sets for any layout.

Fields§

§buckets: HashMap<(DescriptorTotalCount, bool), DescriptorBucket<P>>§sets_cache: Vec<DescriptorSet<S>>§raw_sets_cache: Vec<S>§max_update_after_bind_descriptors_in_all_pools: u32§current_update_after_bind_descriptors_in_all_pools: u32§total: u32

Implementations§

source§

impl<P, S> DescriptorAllocator<P, S>

source

pub fn new(max_update_after_bind_descriptors_in_all_pools: u32) -> Self

Create new allocator instance.

source

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>
where S: Debug, L: Debug, D: DescriptorDevice<L, P, S>,

Allocate descriptor set with specified layout.

§Safety
  • Same device instance must be passed to all method calls of one DescriptorAllocator instance.
  • flags must match flags that were used to create the layout.
  • layout_descriptor_count must match descriptor numbers in the layout.
source

pub unsafe fn free<L, D, I>(&mut self, device: &D, sets: I)
where D: DescriptorDevice<L, P, S>, I: IntoIterator<Item = DescriptorSet<S>>,

Free descriptor sets.

§Safety
  • Same device instance must be passed to all method calls of one DescriptorAllocator 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.
source

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 one DescriptorAllocator instance.

Trait Implementations§

source§

impl<P: Debug, S: Debug> Debug for DescriptorAllocator<P, S>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<P, S> Drop for DescriptorAllocator<P, S>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<P, S> Freeze for DescriptorAllocator<P, S>

§

impl<P, S> RefUnwindSafe for DescriptorAllocator<P, S>

§

impl<P, S> Send for DescriptorAllocator<P, S>
where S: Send, P: Send,

§

impl<P, S> Sync for DescriptorAllocator<P, S>
where S: Sync, P: Sync,

§

impl<P, S> Unpin for DescriptorAllocator<P, S>
where S: Unpin, P: Unpin,

§

impl<P, S> UnwindSafe for DescriptorAllocator<P, S>
where S: UnwindSafe, P: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.