Struct wgpu_core::command::allocator::CommandAllocator
source · pub(crate) struct CommandAllocator {
free_encoders: Mutex<Vec<Box<dyn DynCommandEncoder>>>,
}
Expand description
A pool of free wgpu_hal::CommandEncoder
s, owned by a Device
.
Each encoder in this list is in the “closed” state.
Since a raw CommandEncoder
is itself a pool for allocating
raw CommandBuffer
s, this is a pool of pools.
Fields§
§free_encoders: Mutex<Vec<Box<dyn DynCommandEncoder>>>
Implementations§
source§impl CommandAllocator
impl CommandAllocator
pub(crate) fn new() -> Self
sourcepub(crate) fn acquire_encoder(
&self,
device: &dyn DynDevice,
queue: &dyn DynQueue,
) -> Result<Box<dyn DynCommandEncoder>, DeviceError>
pub(crate) fn acquire_encoder( &self, device: &dyn DynDevice, queue: &dyn DynQueue, ) -> Result<Box<dyn DynCommandEncoder>, DeviceError>
Return a fresh wgpu_hal::CommandEncoder
in the “closed” state.
If we have free encoders in the pool, take one of those. Otherwise,
create a new one on device
.
sourcepub(crate) fn release_encoder(&self, encoder: Box<dyn DynCommandEncoder>)
pub(crate) fn release_encoder(&self, encoder: Box<dyn DynCommandEncoder>)
Add encoder
back to the free pool.
Auto Trait Implementations§
impl !Freeze for CommandAllocator
impl !RefUnwindSafe for CommandAllocator
impl Send for CommandAllocator
impl Sync for CommandAllocator
impl Unpin for CommandAllocator
impl !UnwindSafe for CommandAllocator
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