[−][src]Struct gpu_alloc::GpuAllocator
Memory allocator for Vulkan-like APIs.
Implementations
impl<M> GpuAllocator<M> where
M: MemoryBounds + 'static, [src]
M: MemoryBounds + 'static,
pub fn new(config: Config, props: DeviceProperties<'_>) -> Self[src]
Creates new instance of GpuAllocator.
Provided DeviceProperties should match propertices 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> where
M: Clone, [src]
&mut self,
device: &impl MemoryDevice<M>,
request: Request
) -> Result<MemoryBlock<M>, AllocationError> where
M: Clone,
Allocates memory block from specified device according to the request.
Safety
devicemust be one withDevicePropertiesthat were provided to create thisGpuAllocatorinstance.- Same
deviceinstance must be used for all interactions with oneGpuAllocatorinstance 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> where
M: Clone, [src]
&mut self,
device: &impl MemoryDevice<M>,
request: Request,
dedicated: Dedicated
) -> Result<MemoryBlock<M>, AllocationError> where
M: Clone,
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
devicemust be one withDevicePropertiesthat were provided to create thisGpuAllocatorinstance.- Same
deviceinstance must be used for all interactions with oneGpuAllocatorinstance and memory blocks allocated from it.
pub unsafe fn dealloc(
&mut self,
device: &impl MemoryDevice<M>,
block: MemoryBlock<M>
)[src]
&mut self,
device: &impl MemoryDevice<M>,
block: MemoryBlock<M>
)
Deallocates memory block previously allocated from this GpuAllocator instance.
Safety
- Memory block must have been allocated by this
GpuAllocatorinstance devicemust be one withDevicePropertiesthat were provided to create thisGpuAllocatorinstance- Same
deviceinstance must be used for all interactions with oneGpuAllocatorinstance and memory blocks allocated from it
pub unsafe fn cleanup(&mut self, device: &impl MemoryDevice<M>)[src]
Deallocates leftover memory objects. Should be used before dropping.
Safety
devicemust be one withDevicePropertiesthat were provided to create thisGpuAllocatorinstance- Same
deviceinstance must be used for all interactions with oneGpuAllocatorinstance 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: UnwindSafe,
M: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,