Struct vulkano::descriptor_set::pool::UnsafeDescriptorPool
source · [−]pub struct UnsafeDescriptorPool { /* private fields */ }
Expand description
Pool that descriptors are allocated from.
A pool has a maximum number of descriptor sets and a maximum number of descriptors (one value per descriptor type) it can allocate.
Implementations
sourceimpl UnsafeDescriptorPool
impl UnsafeDescriptorPool
sourcepub fn new(
device: Arc<Device>,
create_info: UnsafeDescriptorPoolCreateInfo
) -> Result<UnsafeDescriptorPool, OomError>
pub fn new(
device: Arc<Device>,
create_info: UnsafeDescriptorPoolCreateInfo
) -> Result<UnsafeDescriptorPool, OomError>
Creates a new UnsafeDescriptorPool
.
Panics
- Panics if
create_info.max_sets
is0
. - Panics if
create_info.pool_sizes
is empty. - Panics if
create_info.pool_sizes
contains a descriptor type with a count of0
.
sourcepub fn max_sets(&self) -> u32
pub fn max_sets(&self) -> u32
Returns the maximum number of sets that can be allocated from the pool.
sourcepub fn pool_sizes(&self) -> &HashMap<DescriptorType, u32>
pub fn pool_sizes(&self) -> &HashMap<DescriptorType, u32>
Returns the number of descriptors of each type that the pool was created with.
sourcepub fn can_free_descriptor_sets(&self) -> bool
pub fn can_free_descriptor_sets(&self) -> bool
Returns whether the descriptor sets allocated from the pool can be individually freed.
sourcepub unsafe fn allocate_descriptor_sets<'a>(
&mut self,
allocate_info: impl IntoIterator<Item = DescriptorSetAllocateInfo<'a>>
) -> Result<impl ExactSizeIterator<Item = UnsafeDescriptorSet>, DescriptorPoolAllocError>
pub unsafe fn allocate_descriptor_sets<'a>(
&mut self,
allocate_info: impl IntoIterator<Item = DescriptorSetAllocateInfo<'a>>
) -> Result<impl ExactSizeIterator<Item = UnsafeDescriptorSet>, DescriptorPoolAllocError>
Allocates descriptor sets from the pool, one for each element in create_info
.
Returns an iterator to the allocated sets, or an error.
The FragmentedPool
errors often can’t be prevented. If the function returns this error,
you should just create a new pool.
Panic
- Panics if one of the layouts wasn’t created with the same device as the pool.
Safety
See also the new
function.
- The total descriptors of the layouts must fit in the pool.
- The total number of descriptor sets allocated from the pool must not overflow the pool.
- You must ensure that the allocated descriptor sets are no longer in use when the pool is destroyed, as destroying the pool is equivalent to freeing all the sets.
sourcepub unsafe fn free_descriptor_sets<I>(
&mut self,
descriptor_sets: I
) -> Result<(), OomError> where
I: IntoIterator<Item = UnsafeDescriptorSet>,
pub unsafe fn free_descriptor_sets<I>(
&mut self,
descriptor_sets: I
) -> Result<(), OomError> where
I: IntoIterator<Item = UnsafeDescriptorSet>,
Frees some descriptor sets.
Note that it is not mandatory to free sets. Destroying or resetting the pool destroys all the descriptor sets.
Safety
- The pool must have been created with
free_descriptor_set_bit
set totrue
. - The descriptor sets must have been allocated from the pool.
- The descriptor sets must not be free’d twice.
- The descriptor sets must not be in use by the GPU.
Trait Implementations
sourceimpl Debug for UnsafeDescriptorPool
impl Debug for UnsafeDescriptorPool
sourceimpl DeviceOwned for UnsafeDescriptorPool
impl DeviceOwned for UnsafeDescriptorPool
sourceimpl Drop for UnsafeDescriptorPool
impl Drop for UnsafeDescriptorPool
sourceimpl Hash for UnsafeDescriptorPool
impl Hash for UnsafeDescriptorPool
sourceimpl VulkanObject for UnsafeDescriptorPool
impl VulkanObject for UnsafeDescriptorPool
type Object = DescriptorPool
type Object = DescriptorPool
The type of the object.
sourcefn internal_object(&self) -> Self::Object
fn internal_object(&self) -> Self::Object
Returns a reference to the object.
impl Eq for UnsafeDescriptorPool
Auto Trait Implementations
impl RefUnwindSafe for UnsafeDescriptorPool
impl Send for UnsafeDescriptorPool
impl Sync for UnsafeDescriptorPool
impl Unpin for UnsafeDescriptorPool
impl UnwindSafe for UnsafeDescriptorPool
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more