Enum vulkano::memory::MemoryImportInfo
source · #[non_exhaustive]pub enum MemoryImportInfo {
Fd {
handle_type: ExternalMemoryHandleType,
file: File,
},
Win32 {
handle_type: ExternalMemoryHandleType,
handle: HANDLE,
},
}
Expand description
Parameters to import memory from an external source.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Fd
Import memory from a Unix file descriptor.
handle_type
must be either ExternalMemoryHandleType::OpaqueFd
or
ExternalMemoryHandleType::DmaBuf
.
Safety
file
must be a valid Unix file descriptor.- Vulkan will take ownership of
file
, and once the memory is imported, you must not perform any operations onfile
nor on any of its clones/duplicates. - If
file
was created by the Vulkan API, andhandle_type
isExternalMemoryHandleType::OpaqueFd
:MemoryAllocateInfo::allocation_size
andMemoryAllocateInfo::memory_type_index
must match those of the original memory allocation.- If the original memory allocation used
MemoryAllocateInfo::dedicated_allocation
, the imported one must also use it, and the associated buffer or image must be defined identically to the original.
- If
file
was not created by the Vulkan API, thenMemoryAllocateInfo::memory_type_index
must be one of the memory types returned byDevice::memory_fd_properties
.
Win32
Import memory from a Windows handle.
handle_type
must be either ExternalMemoryHandleType::OpaqueWin32
or
ExternalMemoryHandleType::OpaqueWin32Kmt
.
Safety
handle
must be a valid Windows handle.- Vulkan will not take ownership of
handle
. - If
handle_type
isExternalMemoryHandleType::OpaqueWin32
, it owns a reference to the underlying resource and must eventually be closed by the caller. - If
handle_type
isExternalMemoryHandleType::OpaqueWin32Kmt
, it does not own a reference to the underlying resource. handle
must be created by the Vulkan API.MemoryAllocateInfo::allocation_size
andMemoryAllocateInfo::memory_type_index
must match those of the original memory allocation.- If the original memory allocation used
MemoryAllocateInfo::dedicated_allocation
, the imported one must also use it, and the associated buffer or image must be defined identically to the original.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for MemoryImportInfo
impl !Send for MemoryImportInfo
impl !Sync for MemoryImportInfo
impl Unpin for MemoryImportInfo
impl UnwindSafe for MemoryImportInfo
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