Struct gpu_allocator::vulkan::Allocation
source · [−]pub struct Allocation { /* private fields */ }
Implementations
sourceimpl Allocation
impl Allocation
pub fn chunk_id(&self) -> Option<NonZeroU64>
sourcepub unsafe fn memory(&self) -> DeviceMemory
pub unsafe fn memory(&self) -> DeviceMemory
Returns the vk::DeviceMemory
object that is backing this allocation.
This memory object can be shared with multiple other allocations and shouldn’t be freed (or allocated from)
without this library, because that will lead to undefined behavior.
Safety
The result of this function can safely be used to pass into ash::Device::bind_buffer_memory()
,
ash::Device::bind_image_memory()
etc. It is exposed for this reason. Keep in mind to also
pass Self::offset()
along to those.
sourcepub fn offset(&self) -> u64
pub 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.
sourcepub fn mapped_ptr(&self) -> Option<NonNull<c_void>>
pub 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.
sourcepub fn mapped_slice(&self) -> Option<&[u8]>
pub fn mapped_slice(&self) -> Option<&[u8]>
Returns a valid mapped slice if the memory is host visible, otherwise it will return None. The slice already references the exact memory region of the allocation, so no offset needs to be applied.
sourcepub fn mapped_slice_mut(&mut self) -> Option<&mut [u8]>
pub fn mapped_slice_mut(&mut self) -> Option<&mut [u8]>
Returns a valid mapped mutable slice if the memory is host visible, otherwise it will return None. The slice already references the exact memory region of the allocation, so no offset needs to be applied.
pub fn is_null(&self) -> bool
Trait Implementations
sourceimpl Debug for Allocation
impl Debug for Allocation
sourceimpl Default for Allocation
impl Default for Allocation
impl Send for Allocation
impl Sync for Allocation
Auto Trait Implementations
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more