pub trait DeviceMemory: Send + Sync {
// Required methods
fn allocate(&self, size: usize) -> Result<Box<dyn GpuBuffer>>;
fn allocate_aligned(
&self,
size: usize,
alignment: usize,
) -> Result<Box<dyn GpuBuffer>>;
fn total_memory(&self) -> usize;
fn free_memory(&self) -> usize;
}Expand description
Trait for device memory allocation.
Required Methods§
Sourcefn allocate_aligned(
&self,
size: usize,
alignment: usize,
) -> Result<Box<dyn GpuBuffer>>
fn allocate_aligned( &self, size: usize, alignment: usize, ) -> Result<Box<dyn GpuBuffer>>
Allocate device memory with alignment.
Sourcefn total_memory(&self) -> usize
fn total_memory(&self) -> usize
Get total device memory.
Sourcefn free_memory(&self) -> usize
fn free_memory(&self) -> usize
Get free device memory.