Skip to main content

VulkanDeviceHandle

Struct VulkanDeviceHandle 

Source
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

Source

pub fn id(&self) -> u64

Returns the native handle value.

Source§

impl VulkanDeviceHandle

Source

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::Unsupported when supported_render_backend_mask() lacks RenderBackendFlag::VULKAN, or when presentation is true and the Vulkan loader or the GPU can’t present.
  • Status::NotFound when no GPU matches device_uuid and device_luid.
  • Status::NativeError when there is no Vulkan loader, no GPU has a graphics queue, or Vulkan can’t create the instance or the device.
Source

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.

Source

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§

Source§

impl Debug for VulkanDeviceHandle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.