MapLibre Native C API
Public C ABI for the MapLibre Native wrapper.
Loading...
Searching...
No Matches
vulkan.h File Reference

Go to the source code of this file.

Data Structures

struct  mln_vulkan_device_options
struct  mln_vulkan_device_context_result

Typedefs

typedef enum mln_vulkan_device_option_field mln_vulkan_device_option_field
typedef uint32_t mln_vulkan_device_option_fields
typedef struct mln_vulkan_device_options mln_vulkan_device_options
typedef struct mln_vulkan_device_context_result mln_vulkan_device_context_result

Enumerations

enum  mln_vulkan_device_option_field : uint32_t { MLN_VULKAN_DEVICE_OPTION_PRESENTATION = 1U << 0U , MLN_VULKAN_DEVICE_OPTION_DEVICE_UUID = 1U << 1U , MLN_VULKAN_DEVICE_OPTION_DEVICE_LUID = 1U << 2U }

Functions

mln_status mln_vulkan_device_create (const mln_vulkan_device_options *options, mln_vulkan_device *out_device, mln_diagnostic *out_diagnostic)
mln_status mln_vulkan_device_get_context (mln_vulkan_device device, mln_vulkan_device_context_result *out_result, mln_diagnostic *out_diagnostic)
void mln_vulkan_device_release (mln_vulkan_device device)

Detailed Description

Render with a Vulkan device that the library creates and owns.

Typedef Documentation

◆ mln_vulkan_device_context_result

typedef struct mln_vulkan_device_context_result mln_vulkan_device_context_result

A Vulkan device's context, as mln_vulkan_device_get_context() reports it.

◆ mln_vulkan_device_option_field

◆ mln_vulkan_device_option_fields

◆ mln_vulkan_device_options

typedef struct mln_vulkan_device_options mln_vulkan_device_options

Enumeration Type Documentation

◆ mln_vulkan_device_option_field

The fields that mln_vulkan_device_options sets.

Enumerator
MLN_VULKAN_DEVICE_OPTION_PRESENTATION 
MLN_VULKAN_DEVICE_OPTION_DEVICE_UUID 
MLN_VULKAN_DEVICE_OPTION_DEVICE_LUID 

Function Documentation

◆ mln_vulkan_device_create()

mln_status mln_vulkan_device_create ( const mln_vulkan_device_options * options,
mln_vulkan_device * out_device,
mln_diagnostic * out_diagnostic )

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

Attach sessions with the context from mln_vulkan_device_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.

Returns:

  • MLN_STATUS_UNSUPPORTED when mln_supported_render_backend_mask() lacks MLN_RENDER_BACKEND_FLAG_VULKAN, or when presentation is true and the Vulkan loader or the GPU can't present.
  • MLN_STATUS_NOT_FOUND when no GPU matches device_uuid and device_luid.
  • MLN_STATUS_NATIVE_ERROR when there is no Vulkan loader, no GPU has a graphics queue, or Vulkan can't create the instance or the device.

◆ mln_vulkan_device_get_context()

mln_status mln_vulkan_device_get_context ( mln_vulkan_device device,
mln_vulkan_device_context_result * out_result,
mln_diagnostic * out_diagnostic )

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

Pass it as the context of mln_map_attach_vulkan_surface() or mln_map_attach_vulkan_borrowed_texture(). The sessions on the device share its graphics queue. To submit to the queue yourself, set mln_render_session_attach_options.queue_lock on each session.

Lifetimes: The objects that out_result names stay valid until you release the device.

◆ mln_vulkan_device_release()

void mln_vulkan_device_release ( mln_vulkan_device device)

Releases a Vulkan device.

Render sessions that attached with the device's context keep using it until they detach or their release finishes.

Lifetimes: The library destroys the device once you release it and no session uses it. Destroy the Vulkan objects that you created with its context, such as images and surfaces, before then.