pub struct MkGpuPool<B: MkGpuBackend> { /* private fields */ }Expand description
A pool of GPU buffers for efficient reuse.
Implementations§
Source§impl<B: MkGpuBackend> MkGpuPool<B>
impl<B: MkGpuBackend> MkGpuPool<B>
Sourcepub fn new(
memory_type: MkMemoryType,
buffer_size: usize,
usage: MkBufferUsage,
max_buffers: usize,
) -> Self
pub fn new( memory_type: MkMemoryType, buffer_size: usize, usage: MkBufferUsage, max_buffers: usize, ) -> Self
Create a new GPU buffer pool.
Sourcepub fn acquire(&mut self, backend: &B) -> Result<MkDeviceBuffer<B>, B::Error>
pub fn acquire(&mut self, backend: &B) -> Result<MkDeviceBuffer<B>, B::Error>
Acquire a buffer from the pool or create a new one.
Sourcepub fn release(&mut self, buffer: MkDeviceBuffer<B>, backend: &B)
pub fn release(&mut self, buffer: MkDeviceBuffer<B>, backend: &B)
Return a buffer to the pool.
Sourcepub fn free_count(&self) -> usize
pub fn free_count(&self) -> usize
Get the number of free buffers.
Auto Trait Implementations§
impl<B> Freeze for MkGpuPool<B>
impl<B> RefUnwindSafe for MkGpuPool<B>
impl<B> Send for MkGpuPool<B>
impl<B> Sync for MkGpuPool<B>
impl<B> Unpin for MkGpuPool<B>
impl<B> UnwindSafe for MkGpuPool<B>
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