Table of Contents

Class VulkanDeviceHandle

Namespace
Maplibre.NativeFfi
Assembly
Maplibre.NativeFfi.dll

A Vulkan instance, device, and queue that the library creates and owns.

public sealed class VulkanDeviceHandle : IDisposable
Inheritance
VulkanDeviceHandle
Implements
Inherited Members

Remarks

See mln_vulkan_device in the C API reference.

Properties

Id

The native handle value. It stays readable after release.

public ulong Id { get; }

Property Value

ulong

IsClosed

Whether a release, dispose, or discard has ended the handle.

public bool IsClosed { get; }

Property Value

bool

Methods

Create(VulkanDeviceOptions?)

Creates a Vulkan instance, device, and graphics queue for render sessions.

public static VulkanDeviceHandle Create(VulkanDeviceOptions? options = null)

Parameters

options VulkanDeviceOptions

Returns

VulkanDeviceHandle

Remarks

Attach sessions with the context from VulkanDeviceHandle.GetContext(), 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 MaplibreNative.SupportedRenderBackendMask() 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.

GetContext()

Gets the context to attach render sessions to the device with.

public VulkanDeviceContextResult GetContext()

Returns

VulkanDeviceContextResult

Remarks

Pass it as the context of MapHandle.AttachVulkanSurface() or MapHandle.AttachVulkanBorrowedTexture(). The sessions on the device share its graphics queue. To submit to the queue yourself, set RenderSessionAttachOptions.QueueLock on each session.

See mln_vulkan_device_get_context in the C API reference.

Release()

Releases a Vulkan device.

public void Release()

Remarks

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.

ToString()

Names the handle's type, its Id, and whether it is closed.

public override string ToString()

Returns

string