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
IsClosed
Whether a release, dispose, or discard has ended the handle.
public bool IsClosed { get; }
Property Value
Methods
Create(VulkanDeviceOptions?)
Creates a Vulkan instance, device, and graphics queue for render sessions.
public static VulkanDeviceHandle Create(VulkanDeviceOptions? options = null)
Parameters
optionsVulkanDeviceOptions
Returns
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.UnsupportedwhenMaplibreNative.SupportedRenderBackendMask()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.
GetContext()
Gets the context to attach render sessions to the device with.
public VulkanDeviceContextResult GetContext()
Returns
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()