Struct ccthw_ash_allocator::Allocation
source · pub struct Allocation { /* private fields */ }
Expand description
A GPU memory allocation.
Implementations§
source§impl Allocation
impl Allocation
sourcepub unsafe fn memory(&self) -> DeviceMemory
pub unsafe fn memory(&self) -> DeviceMemory
The underlying Vulkan memory handle.
Safety
Unsafe because the allocation logically owns the device memory. It is incorrect to free the memory by any means other than to return the full allocation instance to the memory allocator.
sourcepub fn offset_in_bytes(&self) -> DeviceSize
pub fn offset_in_bytes(&self) -> DeviceSize
The offset where this allocation begins in device memory.
This is needed because some memory allocator implementations will subdivide big regions of GPU memory into smaller allocations. Therefore the actual device memory handle can be shared by many allocations.
sourcepub fn size_in_bytes(&self) -> DeviceSize
pub fn size_in_bytes(&self) -> DeviceSize
The size of the allocation in bytes.
sourcepub fn allocation_requirements(&self) -> &AllocationRequirements
pub fn allocation_requirements(&self) -> &AllocationRequirements
The allocation requirements used when acquiring the device memory.
sourcepub unsafe fn map(&self, device: &Device) -> Result<*mut c_void, AllocatorError>
pub unsafe fn map(&self, device: &Device) -> Result<*mut c_void, AllocatorError>
Map the allocation into application address space.
Safety
Unsafe because:
- The application must synchronize access to the underlying device memory. All previously submitted GPU commands which write to the memory owned by this alloctaion must be finished before the host reads or writes from the mapped pointer.
- Synchronization requirements vary depending on the HOST_COHERENT memory property. See the Vulkan spec for details.
For details, see the specification at: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkMapMemory.html
Trait Implementations§
source§impl Clone for Allocation
impl Clone for Allocation
source§fn clone(&self) -> Allocation
fn clone(&self) -> Allocation
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more