Struct demo_vk::graphics::vulkan::OwnedBlock
source · pub struct OwnedBlock { /* private fields */ }Expand description
A block allocation that frees itself when dropped.
Implementations§
source§impl OwnedBlock
impl OwnedBlock
sourcepub fn allocate_image(
allocator: Arc<Allocator>,
image_create_info: &ImageCreateInfo<'_>,
flags: MemoryPropertyFlags,
) -> Result<(Self, Image)>
pub fn allocate_image( allocator: Arc<Allocator>, image_create_info: &ImageCreateInfo<'_>, flags: MemoryPropertyFlags, ) -> Result<(Self, Image)>
Creates an image and allocates memory to back it.
The image is bound to the memory prior to return, so the caller can use it right away.
sourcepub fn allocate_buffer(
allocator: Arc<Allocator>,
buffer_create_info: &BufferCreateInfo<'_>,
flags: MemoryPropertyFlags,
) -> Result<(OwnedBlock, Buffer)>
pub fn allocate_buffer( allocator: Arc<Allocator>, buffer_create_info: &BufferCreateInfo<'_>, flags: MemoryPropertyFlags, ) -> Result<(OwnedBlock, Buffer)>
Creates a buffer and allocates memory to back it.
The buffer is bound to the memory prior to return, so the caller can use it right away.
Methods from Deref<Target = Block>§
sourcepub fn is_subregion_of(&self, other: &Block) -> bool
pub fn is_subregion_of(&self, other: &Block) -> bool
Returns true when self is entirely contained by other, false otherwise.
Note: partial overlaps are not considered ‘subregions’. A.is_subregion_of(B) will return true iff A is fully contained by B.
sourcepub fn subregion(&self, offset: u64, size: u64) -> Result<Self>
pub fn subregion(&self, offset: u64, size: u64) -> Result<Self>
Returns a subregion of the current Block.
Fails if the requested subregion is out of bounds or cannot fit within the current block.
§Params
- offset: the offset in bytes from the beginning of the current block
- size: the size of the subregion to return
sourcepub fn offset(&self) -> u64
pub fn offset(&self) -> u64
Returns the start of the block as a byte offset into device memory.
sourcepub fn memory(&self) -> DeviceMemory
pub fn memory(&self) -> DeviceMemory
Gets a non-owning copy of the underlying DeviceMemory handle.
Multiple blocks can reference the underlying memory. Blocks returned by the allocator are guaranteed to not overlap.
sourcepub fn mapped_ptr(&self) -> *mut c_void
pub fn mapped_ptr(&self) -> *mut c_void
Returns the memory-mapped pointer for the DeviceMemory.
The pointer is null() if the memory is not mapped.
The pointer always points to the start of the Block and does not need to be manually adjusted to account for the offset.
sourcepub fn memory_type_index(&self) -> u32
pub fn memory_type_index(&self) -> u32
Returns the memory type index for the Block’s device memory.
Trait Implementations§
source§impl Debug for OwnedBlock
impl Debug for OwnedBlock
source§impl Deref for OwnedBlock
impl Deref for OwnedBlock
Auto Trait Implementations§
impl Freeze for OwnedBlock
impl !RefUnwindSafe for OwnedBlock
impl Send for OwnedBlock
impl Sync for OwnedBlock
impl Unpin for OwnedBlock
impl !UnwindSafe for OwnedBlock
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.