pub struct MemoryAllocation { /* private fields */ }Expand description
Note this doesn’t impl Drop. Destroy this yourself! e.g. with Buffer and Image Drop implementations
Implementations§
Source§impl MemoryAllocation
impl MemoryAllocation
pub fn write_into_bytes<T>(
&mut self,
write_data: T,
allocation_offset: usize,
) -> Result<(), MemoryError>where
T: NoUninit,
pub fn write_slice<T>(
&mut self,
write_data: &[T],
allocation_offset: usize,
) -> Result<(), MemoryError>where
T: NoUninit,
pub fn write_bytes( &mut self, write_bytes: &[u8], allocation_offset: usize, ) -> Result<(), MemoryError>
Sourcepub fn write_struct<T>(
&mut self,
write_data: T,
allocation_offset: usize,
) -> Result<(), MemoryError>
pub fn write_struct<T>( &mut self, write_data: T, allocation_offset: usize, ) -> Result<(), MemoryError>
Writes data to this memory allocation. Will flush if memory isn’t host coherent.
If memory wasn’t created with vk::MemoryPropertyFlags::HOST_VISIBLE this will fail.
Sourcepub fn write_iter<I, T>(
&mut self,
write_data: I,
allocation_offset: usize,
) -> Result<(), MemoryError>
pub fn write_iter<I, T>( &mut self, write_data: I, allocation_offset: usize, ) -> Result<(), MemoryError>
WARNING: This function writes one element at a time. In comparison, the write_slice
function will copy everything in one go (requires the bytemuck feature enabled).
If memory wasn’t created with vk::MemoryPropertyFlags::HOST_VISIBLE this will fail.
pub fn read_vec<T>(
&mut self,
element_count: usize,
allocation_offset: usize,
) -> Result<Vec<T>, MemoryError>where
T: Pod,
Sourcepub fn read_struct<T>(
&mut self,
allocation_offset: usize,
) -> Result<T, MemoryError>
pub fn read_struct<T>( &mut self, allocation_offset: usize, ) -> Result<T, MemoryError>
Writes data to this memory allocation. Will flush if memory isn’t host coherent.
If memory wasn’t created with vk::MemoryPropertyFlags::HOST_VISIBLE this will fail.
pub unsafe fn map_memory(&mut self) -> Result<*mut u8, MemoryError>
pub unsafe fn unmap_memory(&mut self)
Sourcepub fn flush_allocation(
&mut self,
allocation_offset: usize,
data_size: usize,
) -> Result<(), MemoryError>
pub fn flush_allocation( &mut self, allocation_offset: usize, data_size: usize, ) -> Result<(), MemoryError>
Flushes allocated memory. Note that the VMA function only runs is the memory is host visible and isn’t host coherent.
Sourcepub fn inner(&self) -> &Allocation
pub fn inner(&self) -> &Allocation
Access the bort_vma::Allocation handle that self contains.
Sourcepub fn inner_mut(&mut self) -> &mut Allocation
pub fn inner_mut(&mut self) -> &mut Allocation
Access the bort_vma::Allocation handle that self contains.
pub fn memory_type(&self) -> MemoryType
Sourcepub fn allocator_access(&self) -> &Arc<dyn AllocatorAccess>
pub fn allocator_access(&self) -> &Arc<dyn AllocatorAccess>
Returns self as a dynamic allocation type.