pub struct GpuBufferPool { /* private fields */ }Expand description
A simple pool that allocates and recycles GpuBuffer instances.
Implementations§
Source§impl GpuBufferPool
impl GpuBufferPool
Sourcepub fn allocate(&mut self, usage: BufferUsage, size: usize) -> GpuBuffer
pub fn allocate(&mut self, usage: BufferUsage, size: usize) -> GpuBuffer
Allocates a buffer of the given usage and size.
If a compatible free buffer exists it is reused; otherwise a new one is created.
Sourcepub fn total_allocated(&self) -> usize
pub fn total_allocated(&self) -> usize
Returns the total number of bytes currently allocated across all active and free buffers.
Sourcepub fn active_count(&self) -> usize
pub fn active_count(&self) -> usize
Returns the number of active (in-use) buffers.
Sourcepub fn free_count(&self) -> usize
pub fn free_count(&self) -> usize
Returns the number of buffers waiting in the free list.
Trait Implementations§
Source§impl Debug for GpuBufferPool
impl Debug for GpuBufferPool
Source§impl Default for GpuBufferPool
impl Default for GpuBufferPool
Source§fn default() -> GpuBufferPool
fn default() -> GpuBufferPool
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for GpuBufferPool
impl RefUnwindSafe for GpuBufferPool
impl Send for GpuBufferPool
impl Sync for GpuBufferPool
impl Unpin for GpuBufferPool
impl UnsafeUnpin for GpuBufferPool
impl UnwindSafe for GpuBufferPool
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more