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§
sourceunsafe fn allocate(
&mut self,
allocation_requirements: AllocationRequirements
) -> Result<Allocation, AllocatorError>
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.
sourceunsafe fn free(&mut self, allocation: Allocation)
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>
impl ComposableAllocator for Box<dyn ComposableAllocator>
source§unsafe fn allocate(
&mut self,
allocation_requirements: AllocationRequirements
) -> Result<Allocation, AllocatorError>
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)
unsafe fn free(&mut self, allocation: Allocation)
Return a GPU memory allocation to the device. Read more