pub struct GpuMemoryManager { /* private fields */ }
Expand description
Advanced GPU memory management and optimization utilities with smart caching
Implementations§
Source§impl GpuMemoryManager
impl GpuMemoryManager
pub fn new(backend: GpuBackend) -> Result<Self, GpuError>
Sourcepub fn get_buffer<T>(&mut self, size: usize) -> Result<GpuBuffer<T>, GpuError>where
T: GpuDataType + Default + 'static,
pub fn get_buffer<T>(&mut self, size: usize) -> Result<GpuBuffer<T>, GpuError>where
T: GpuDataType + Default + 'static,
Get an optimally-aligned buffer from the pool or create a new one with smart caching
Sourcepub fn get_buffer_with_layout<T>(
&mut self,
size: usize,
layout: MemoryLayout,
) -> Result<GpuBuffer<T>, GpuError>where
T: GpuDataType + Default + 'static,
pub fn get_buffer_with_layout<T>(
&mut self,
size: usize,
layout: MemoryLayout,
) -> Result<GpuBuffer<T>, GpuError>where
T: GpuDataType + Default + 'static,
Get a buffer with specific memory layout optimization
Sourcepub fn return_buffer<T>(&mut self, buffer: GpuBuffer<T>)where
T: GpuDataType + 'static,
pub fn return_buffer<T>(&mut self, buffer: GpuBuffer<T>)where
T: GpuDataType + 'static,
Return a buffer to the pool for reuse with smart cleanup
Sourcepub fn transfer_data_optimized<T>(
&mut self,
host_data: &[T],
_priority: TransferPriority,
) -> Result<GpuBuffer<T>, GpuError>where
T: GpuDataType + Copy,
pub fn transfer_data_optimized<T>(
&mut self,
host_data: &[T],
_priority: TransferPriority,
) -> Result<GpuBuffer<T>, GpuError>where
T: GpuDataType + Copy,
Optimize data transfer between host and device with adaptive strategies
Sourcepub fn batch_operations<F, R>(&mut self, operations: F) -> Result<R, GpuError>
pub fn batch_operations<F, R>(&mut self, operations: F) -> Result<R, GpuError>
Batch multiple operations to reduce GPU-CPU synchronization with smart scheduling
Sourcepub fn get_memory_stats(&self) -> &GpuMemoryStats
pub fn get_memory_stats(&self) -> &GpuMemoryStats
Get current memory usage statistics
Sourcepub fn get_pool_efficiency(&self) -> f64
pub fn get_pool_efficiency(&self) -> f64
Get buffer pool efficiency metrics
Auto Trait Implementations§
impl Freeze for GpuMemoryManager
impl !RefUnwindSafe for GpuMemoryManager
impl !Send for GpuMemoryManager
impl !Sync for GpuMemoryManager
impl Unpin for GpuMemoryManager
impl !UnwindSafe for GpuMemoryManager
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> 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