pub struct VulkanDeviceHandle { /* private fields */ }Expand description
Owns one native handle.
A Vulkan instance, device, and queue that the library creates and owns.
See mln_vulkan_device in the
C API reference.
Implementations§
Source§impl VulkanDeviceHandle
impl VulkanDeviceHandle
Sourcepub fn create(
options: Option<&VulkanDeviceOptions<'_>>,
) -> Result<VulkanDeviceHandle>
pub fn create( options: Option<&VulkanDeviceOptions<'_>>, ) -> Result<VulkanDeviceHandle>
Creates a Vulkan instance, device, and graphics queue for render sessions.
Attach sessions with the context from
VulkanDeviceHandle::get_context(), in place of a device of your own.
Without device_uuid or device_luid, it prefers a discrete GPU. The
device enables the external memory and semaphore extensions that the GPU
offers.
See mln_vulkan_device_create in the
C API reference.
§Errors
Status::Unsupportedwhensupported_render_backend_mask()lacksRenderBackendFlag::VULKAN, or whenpresentationis true and the Vulkan loader or the GPU can’t present.Status::NotFoundwhen no GPU matchesdevice_uuidanddevice_luid.Status::NativeErrorwhen there is no Vulkan loader, no GPU has a graphics queue, or Vulkan can’t create the instance or the device.
Sourcepub fn get_context(&self) -> Result<VulkanDeviceContextResult>
pub fn get_context(&self) -> Result<VulkanDeviceContextResult>
Gets the context to attach render sessions to the device with.
Pass it as the context of MapHandle::attach_vulkan_surface() or
MapHandle::attach_vulkan_borrowed_texture(). The sessions on the
device share its graphics queue. To submit to the queue yourself, set
RenderSessionAttachOptions::queue_lock on each session.
See mln_vulkan_device_get_context in the
C API reference.
Sourcepub fn release(self) -> Result<(), ReleaseError<Self>>
pub fn release(self) -> Result<(), ReleaseError<Self>>
Releases a Vulkan device.
Render sessions that attached with the device’s context keep using it until they detach or their release finishes.
See mln_vulkan_device_release in the
C API reference.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VulkanDeviceHandle
impl RefUnwindSafe for VulkanDeviceHandle
impl Send for VulkanDeviceHandle
impl Sync for VulkanDeviceHandle
impl Unpin for VulkanDeviceHandle
impl UnsafeUnpin for VulkanDeviceHandle
impl UnwindSafe for VulkanDeviceHandle
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
impl<T> ErasedDestructor for Twhere
T: 'static,
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 more