pub trait ComposableAllocator {
    // Required methods
    unsafe fn allocate(
        &mut self,
        allocation_requirements: AllocationRequirements
    ) -> Result<Allocation, AllocatorError>;
    unsafe fn free(&mut self, allocation: Allocation);
}

Required Methods§

source

unsafe fn allocate( &mut self, allocation_requirements: AllocationRequirements ) -> Result<Allocation, AllocatorError>

Allocate GPU memory based on the given requirements.

Safety

Unsafe because memory must be freed before the device is destroyed.

source

unsafe fn free(&mut self, allocation: Allocation)

Return a GPU memory allocation to the device.

Safety

Unsafe because:

  • memory must be freed by the application before the device is destroyed
  • the application is responsible for synchronizing access to device memory. It is an error to free memory while ongoing GPU operations are still referencing it.

Trait Implementations§

source§

impl ComposableAllocator for Box<dyn ComposableAllocator>

source§

unsafe fn allocate( &mut self, allocation_requirements: AllocationRequirements ) -> Result<Allocation, AllocatorError>

Allocate GPU memory based on the given requirements. Read more
source§

unsafe fn free(&mut self, allocation: Allocation)

Return a GPU memory allocation to the device. Read more

Implementations on Foreign Types§

source§

impl ComposableAllocator for Box<dyn ComposableAllocator>

source§

unsafe fn allocate( &mut self, allocation_requirements: AllocationRequirements ) -> Result<Allocation, AllocatorError>

source§

unsafe fn free(&mut self, allocation: Allocation)

source§

impl<T> ComposableAllocator for Rc<RefCell<T>>where T: ComposableAllocator,

source§

unsafe fn allocate( &mut self, allocation_requirements: AllocationRequirements ) -> Result<Allocation, AllocatorError>

source§

unsafe fn free(&mut self, allocation: Allocation)

source§

impl<T> ComposableAllocator for Box<T>where T: ComposableAllocator,

source§

unsafe fn allocate( &mut self, allocation_requirements: AllocationRequirements ) -> Result<Allocation, AllocatorError>

source§

unsafe fn free(&mut self, allocation: Allocation)

Implementors§