pub unsafe trait CommandPool: DeviceOwned {
    type Iter: Iterator<Item = Self::Builder>;
    type Builder: CommandPoolBuilderAlloc<Alloc = Self::Alloc>;
    type Alloc: CommandPoolAlloc;

    fn alloc(&self, secondary: bool, count: u32) -> Result<Self::Iter, OomError>;
    fn queue_family(&self) -> QueueFamily<'_>;
}
Expand description

Types that manage the memory of command buffers.

Safety

A Vulkan command pool must be externally synchronized as if it owned the command buffers that were allocated from it. This includes allocating from the pool, freeing from the pool, resetting the pool or individual command buffers, and most importantly recording commands to command buffers.

The implementation of CommandPool is expected to manage this. For as long as a Builder is alive, the trait implementation is expected to lock the pool that allocated the Builder for the current thread.

Note: This may be modified in the future to allow different implementation strategies.

The destructors of the CommandPoolBuilderAlloc and the CommandPoolAlloc are expected to free the command buffer, reset the command buffer, or add it to a pool so that it gets reused. If the implementation frees or resets the command buffer, it must not forget that this operation must lock the pool.

Required Associated Types

See alloc().

Represents a command buffer that has been allocated and that is currently being built.

Represents a command buffer that has been allocated and that is pending execution or is being executed.

Required Methods

Allocates command buffers from this pool.

Returns an iterator that contains an bunch of allocated command buffers.

Returns the queue family that this pool targets.

Implementations on Foreign Types

Implementors