Allocation

Trait Allocation 

Source
pub trait Allocation: Send + Sync {
    // Required methods
    unsafe fn memory(&self) -> DeviceMemory;
    fn offset(&self) -> u64;
    fn size(&self) -> u64;
    fn mapped_ptr(&self) -> Option<NonNull<c_void>>;
}
Expand description

Represents a memory allocation.

Required Methods§

Source

unsafe fn memory(&self) -> DeviceMemory

Returns the vk::DeviceMemory object that is backing this allocation.

Source

fn offset(&self) -> u64

Returns the offset of the allocation on the vk::DeviceMemory. When binding the memory to a buffer or image, this offset needs to be supplied as well.

Source

fn size(&self) -> u64

Returns the size of the allocation

Source

fn mapped_ptr(&self) -> Option<NonNull<c_void>>

Returns a valid mapped pointer if the memory is host visible, otherwise it will return None. The pointer already points to the exact memory region of the suballocation, so no offset needs to be applied.

Implementors§