pub struct VkBufferHandle { /* private fields */ }Expand description
Vulkan VkBuffer on a specific VkDevice.
Implementations§
Source§impl VkBufferHandle
impl VkBufferHandle
Sourcepub unsafe fn try_from_raw(
buffer: u64,
device: *mut c_void,
uuid: Option<[u8; 16]>,
size: u64,
keep_alive: Option<KeepAlive>,
) -> Result<Self, InvalidHandleError>
pub unsafe fn try_from_raw( buffer: u64, device: *mut c_void, uuid: Option<[u8; 16]>, size: u64, keep_alive: Option<KeepAlive>, ) -> Result<Self, InvalidHandleError>
Wrap a raw VkBuffer and its device parentage. Borrowing: the
handle is stored non-owningly, this type has no Drop, and every
obligation below extends to each Clone.
§Safety
buffermust be a liveVkBufferhandle ondevice. As withVkImage::try_from_raw, only the zero handle is rejected (InvalidHandleError::NullHandle); everything else is stored verbatim and later used invkCmdCopyBuffer/vkGetBufferMemoryRequirementsby the importer.device == nullis permitted and carries the same trusted-import meaning as onVkImage::try_from_raw; when non-null it must be theVkDevicebufferwas created on.uuid, whenSome, must equal that device’s physical devicedeviceUUID, for the same cross-adapter refusal check.sizemust not exceed the buffer’s actualVkBufferCreateInfo::size— importers copysizebytes out of it. A zerosizeis rejected asInvalidHandleError::ZeroSizeand is therefore not a caller obligation.- Lifetime and thread affinity are exactly as for
VkImage::try_from_raw: nothing is retained, there is noDrop, andvkDestroyBuffermust not run while this value or anyCloneof it is reachable.
pub fn buffer(&self) -> u64
pub fn device(&self) -> *mut c_void
pub fn uuid(&self) -> Option<[u8; 16]>
pub fn size(&self) -> u64
pub fn keep_alive(&self) -> Option<&KeepAlive>
Source§impl VkBufferHandle
impl VkBufferHandle
Sourcepub fn as_ash_buffer(&self) -> Buffer
Available on crate feature ash only.
pub fn as_ash_buffer(&self) -> Buffer
ash only.Re-wrap the stored u64 handle as ash’s typed vk::Buffer.
Trait Implementations§
Source§impl Clone for VkBufferHandle
impl Clone for VkBufferHandle
Source§impl Debug for VkBufferHandle
impl Debug for VkBufferHandle
impl Send for VkBufferHandle
impl Sync for VkBufferHandle
Auto Trait Implementations§
impl !RefUnwindSafe for VkBufferHandle
impl !UnwindSafe for VkBufferHandle
impl Freeze for VkBufferHandle
impl Unpin for VkBufferHandle
impl UnsafeUnpin for VkBufferHandle
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
Mutably borrows from an owned value. Read more