pub unsafe trait CommandBufferAllocator: DeviceOwned {
type Iter: Iterator<Item = Self::Builder>;
type Builder: CommandBufferBuilderAlloc<Alloc = Self::Alloc>;
type Alloc: CommandBufferAlloc;
// Required method
fn allocate(
&self,
queue_family_index: u32,
level: CommandBufferLevel,
command_buffer_count: u32
) -> Result<Self::Iter, VulkanError>;
}
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 CommandBufferAllocator
is expected to manage this.
The destructors of the CommandBufferBuilderAlloc
and the CommandBufferAlloc
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 be externally synchronized.
Required Associated Types§
sourcetype Builder: CommandBufferBuilderAlloc<Alloc = Self::Alloc>
type Builder: CommandBufferBuilderAlloc<Alloc = Self::Alloc>
Represents a command buffer that has been allocated and that is currently being built.
sourcetype Alloc: CommandBufferAlloc
type Alloc: CommandBufferAlloc
Represents a command buffer that has been allocated and that is pending execution or is being executed.
Required Methods§
sourcefn allocate(
&self,
queue_family_index: u32,
level: CommandBufferLevel,
command_buffer_count: u32
) -> Result<Self::Iter, VulkanError>
fn allocate( &self, queue_family_index: u32, level: CommandBufferLevel, command_buffer_count: u32 ) -> Result<Self::Iter, VulkanError>
Allocates command buffers.
Returns an iterator that contains the requested amount of allocated command buffers.