pub struct GpuBufferPool { /* private fields */ }Expand description
Reusable GPU storage buffers keyed by byte length.
Buffers are recycled through WgpuRuntime::recycle_storage or
GpuBufferPool::recycle. Prefer the runtime helpers for typical use;
access the pool directly when implementing custom kernels.
Implementations§
Source§impl GpuBufferPool
impl GpuBufferPool
Sourcepub fn acquire_storage(
&self,
runtime: &WgpuRuntime,
label: &'static str,
byte_len: u64,
) -> Buffer
pub fn acquire_storage( &self, runtime: &WgpuRuntime, label: &'static str, byte_len: u64, ) -> Buffer
Acquires an uninitialized reusable storage buffer of the requested size.
Sourcepub fn upload_pod_storage<T: Pod>(
&self,
runtime: &WgpuRuntime,
label: &'static str,
data: &[T],
) -> SpatialResult<Buffer>
pub fn upload_pod_storage<T: Pod>( &self, runtime: &WgpuRuntime, label: &'static str, data: &[T], ) -> SpatialResult<Buffer>
Uploads a POD slice into a pooled storage buffer.
Sourcepub fn upload_f32_storage(
&self,
runtime: &WgpuRuntime,
label: &'static str,
data: &[f32],
) -> SpatialResult<Buffer>
pub fn upload_f32_storage( &self, runtime: &WgpuRuntime, label: &'static str, data: &[f32], ) -> SpatialResult<Buffer>
Uploads f32 values into a pooled storage buffer.
Sourcepub fn upload_u32_storage(
&self,
runtime: &WgpuRuntime,
label: &'static str,
data: &[u32],
) -> SpatialResult<Buffer>
pub fn upload_u32_storage( &self, runtime: &WgpuRuntime, label: &'static str, data: &[u32], ) -> SpatialResult<Buffer>
Uploads u32 values into a pooled storage buffer.
Sourcepub fn recycle(&self, byte_len: u64, buffer: Buffer)
pub fn recycle(&self, byte_len: u64, buffer: Buffer)
Returns a storage buffer to the pool for reuse.
Sourcepub fn clear(&self)
pub fn clear(&self)
Discards all cached buffers without returning them to the device allocator.
Sourcepub fn cached_buffer_count(&self) -> usize
pub fn cached_buffer_count(&self) -> usize
Returns the number of buffers currently held in the pool.
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