Struct rafx::framework::DynCommandPoolAllocator
source · pub struct DynCommandPoolAllocator { /* private fields */ }
Expand description
An allocator for DynCommandPools, objects that are short-lived and NOT persisted across frames. Meant for allocating command buffers that are usually single use and only for the current frame. The allocator is multi-thread friendly, but the pools themselves are not. So if writing command buffers from multiple threads, allocate a pool per thread.
Implementations§
source§impl DynCommandPoolAllocator
impl DynCommandPoolAllocator
sourcepub fn new(max_frames_in_flight: u32) -> DynCommandPoolAllocator
pub fn new(max_frames_in_flight: u32) -> DynCommandPoolAllocator
Create an allocator for DynCommandPools.
sourcepub fn allocate_dyn_pool(
&self,
queue: &RafxQueue,
command_pool_def: &RafxCommandPoolDef,
delay_submission_by_frame_count: u64
) -> Result<DynCommandPool, RafxError>
pub fn allocate_dyn_pool( &self, queue: &RafxQueue, command_pool_def: &RafxCommandPoolDef, delay_submission_by_frame_count: u64 ) -> Result<DynCommandPool, RafxError>
Allocates a pool. DynPools wrap CommandPools. The parameters match inputs for
CommandPool::new. delay_submission_by_frame_count
indicates how many frames will pass
before the commands will be submitted (which affects how long-lived they will be). DO NOT
submit command buffers earlier than this as the commands pools themselves are pooled and
may be available to writing in future frames.
The common case for delay_submission_by_frame_count is to pass 0. You might pass 1 if for example, you are building a command buffer for frame N + 1 while frame N is not yet submitted.
sourcepub fn on_frame_complete(&self) -> Result<(), RafxError>
pub fn on_frame_complete(&self) -> Result<(), RafxError>
Call every frame to recycle command pools that are no-longer in flight
Trait Implementations§
source§impl Clone for DynCommandPoolAllocator
impl Clone for DynCommandPoolAllocator
source§fn clone(&self) -> DynCommandPoolAllocator
fn clone(&self) -> DynCommandPoolAllocator
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl RefUnwindSafe for DynCommandPoolAllocator
impl Send for DynCommandPoolAllocator
impl Sync for DynCommandPoolAllocator
impl Unpin for DynCommandPoolAllocator
impl UnwindSafe for DynCommandPoolAllocator
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.