MemoryAllocation

Struct MemoryAllocation 

Source
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

Source

pub fn write_into_bytes<T>( &mut self, write_data: T, allocation_offset: usize, ) -> Result<(), MemoryError>
where T: NoUninit,

Source

pub fn write_slice<T>( &mut self, write_data: &[T], allocation_offset: usize, ) -> Result<(), MemoryError>
where T: NoUninit,

Source

pub fn write_bytes( &mut self, write_bytes: &[u8], allocation_offset: usize, ) -> Result<(), MemoryError>

Source

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.

Source

pub fn write_iter<I, T>( &mut self, write_data: I, allocation_offset: usize, ) -> Result<(), MemoryError>
where I: IntoIterator<Item = T>, I::IntoIter: ExactSizeIterator,

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.

Source

pub fn read_vec<T>( &mut self, element_count: usize, allocation_offset: usize, ) -> Result<Vec<T>, MemoryError>
where T: Pod,

Source

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.

Source

pub unsafe fn map_memory(&mut self) -> Result<*mut u8, MemoryError>

Source

pub unsafe fn unmap_memory(&mut self)

Source

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.

Source

pub fn inner(&self) -> &Allocation

Access the bort_vma::Allocation handle that self contains.

Source

pub fn inner_mut(&mut self) -> &mut Allocation

Access the bort_vma::Allocation handle that self contains.

Source

pub fn memory_type(&self) -> MemoryType

Source

pub fn allocator_access(&self) -> &Arc<dyn AllocatorAccess>

Returns self as a dynamic allocation type.

Source

pub fn memory_property_flags(&self) -> MemoryPropertyFlags

Source

pub fn device(&self) -> &Arc<Device>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.