Struct gpu_alloc::GpuAllocator [−][src]
pub struct GpuAllocator<M> { /* fields omitted */ }
Expand description
Memory allocator for Vulkan-like APIs.
Implementations
impl<M> GpuAllocator<M> where
M: MemoryBounds + 'static,
[src]
impl<M> GpuAllocator<M> where
M: MemoryBounds + 'static,
[src]pub fn new(config: Config, props: DeviceProperties<'_>) -> Self
[src]
pub fn new(config: Config, props: DeviceProperties<'_>) -> Self
[src]Creates new instance of GpuAllocator
.
Provided DeviceProperties
should match properties of MemoryDevice
that will be used
with created GpuAllocator
instance.
pub unsafe fn alloc(
&mut self,
device: &impl MemoryDevice<M>,
request: Request
) -> Result<MemoryBlock<M>, AllocationError>
[src]
pub unsafe fn alloc(
&mut self,
device: &impl MemoryDevice<M>,
request: Request
) -> Result<MemoryBlock<M>, AllocationError>
[src]Allocates memory block from specified device
according to the request
.
Safety
device
must be one withDeviceProperties
that were provided to create thisGpuAllocator
instance.- Same
device
instance must be used for all interactions with oneGpuAllocator
instance and memory blocks allocated from it.
pub unsafe fn alloc_with_dedicated(
&mut self,
device: &impl MemoryDevice<M>,
request: Request,
dedicated: Dedicated
) -> Result<MemoryBlock<M>, AllocationError>
[src]
pub unsafe fn alloc_with_dedicated(
&mut self,
device: &impl MemoryDevice<M>,
request: Request,
dedicated: Dedicated
) -> Result<MemoryBlock<M>, AllocationError>
[src]Allocates memory block from specified device
according to the request
.
This function allows user to force specific allocation strategy.
Improper use can lead to suboptimal performance or too large overhead.
Prefer GpuAllocator::alloc
if doubt.
Safety
device
must be one withDeviceProperties
that were provided to create thisGpuAllocator
instance.- Same
device
instance must be used for all interactions with oneGpuAllocator
instance and memory blocks allocated from it.
pub unsafe fn dealloc(
&mut self,
device: &impl MemoryDevice<M>,
block: MemoryBlock<M>
)
[src]
pub unsafe fn dealloc(
&mut self,
device: &impl MemoryDevice<M>,
block: MemoryBlock<M>
)
[src]Deallocates memory block previously allocated from this GpuAllocator
instance.
Safety
- Memory block must have been allocated by this
GpuAllocator
instance device
must be one withDeviceProperties
that were provided to create thisGpuAllocator
instance- Same
device
instance must be used for all interactions with oneGpuAllocator
instance and memory blocks allocated from it
pub unsafe fn cleanup(&mut self, device: &impl MemoryDevice<M>)
[src]
pub unsafe fn cleanup(&mut self, device: &impl MemoryDevice<M>)
[src]Deallocates leftover memory objects. Should be used before dropping.
Safety
device
must be one withDeviceProperties
that were provided to create thisGpuAllocator
instance- Same
device
instance must be used for all interactions with oneGpuAllocator
instance and memory blocks allocated from it
Trait Implementations
Auto Trait Implementations
impl<M> RefUnwindSafe for GpuAllocator<M> where
M: RefUnwindSafe,
M: RefUnwindSafe,
impl<M> Send for GpuAllocator<M> where
M: Send,
M: Send,
impl<M> Sync for GpuAllocator<M> where
M: Sync,
M: Sync,
impl<M> Unpin for GpuAllocator<M>
impl<M> UnwindSafe for GpuAllocator<M> where
M: RefUnwindSafe,
M: RefUnwindSafe,