|
MapLibre Native C API
Public C ABI for the MapLibre Native wrapper.
|
Go to the source code of this file.
Data Structures | |
| struct | mln_queue_lock |
| struct | mln_render_session_attach_options |
| struct | mln_render_session_capabilities |
| struct | mln_gpu_sync |
| struct | mln_metal_context_descriptor |
| struct | mln_vulkan_context_descriptor |
| struct | mln_webgpu_context_descriptor |
| struct | mln_wgl_context_descriptor |
| struct | mln_egl_context_descriptor |
| struct | mln_webgl_context_descriptor |
| union | mln_opengl_context_descriptor_data |
| struct | mln_opengl_context_descriptor |
Macros | |
| #define | MLN_VULKAN_NON_DISPATCHABLE_HANDLE_NULL UINT64_C(0) |
| #define | MLN_TEXTURE_RING_MAX_DEPTH 8 |
Enumerations | |
| enum | mln_render_driver_kind : uint32_t { MLN_RENDER_DRIVER_CORE_WORKER = 1U , MLN_RENDER_DRIVER_CALLER_GRAPHICS_THREAD = 2U } |
| enum | mln_render_session_capability_flag : uint32_t |
| enum | mln_gpu_sync_kind : uint32_t { MLN_GPU_SYNC_CPU_COMPLETE = 0U , MLN_GPU_SYNC_OPENGL_FENCE = 3U } |
| enum | mln_opengl_context_provider_flag : uint32_t { } |
| enum | mln_opengl_context_platform : uint32_t { MLN_OPENGL_CONTEXT_PLATFORM_UNSPECIFIED = 0u , MLN_OPENGL_CONTEXT_PLATFORM_WGL = 1u , MLN_OPENGL_CONTEXT_PLATFORM_EGL = 2u , MLN_OPENGL_CONTEXT_PLATFORM_WEBGL = 3u } |
| enum | mln_opengl_context_ownership : uint32_t { MLN_OPENGL_CONTEXT_OWNERSHIP_SHARED = 0u , MLN_OPENGL_CONTEXT_OWNERSHIP_DEDICATED = 1u } |
| enum | mln_opengl_client_api : uint32_t { MLN_OPENGL_CLIENT_API_UNSPECIFIED = 0u , MLN_OPENGL_CLIENT_API_GL = 1u , MLN_OPENGL_CLIENT_API_GLES = 2u } |
| enum | mln_webgl_context_kind : uint32_t { MLN_WEBGL_CONTEXT_EXISTING = 0U , MLN_WEBGL_CONTEXT_TRANSFERRED_CANVAS = 1U } |
Functions | |
| mln_gpu_sync | mln_gpu_sync_default (void) |
| mln_render_session_attach_options | mln_render_session_attach_options_default (void) |
| mln_status | mln_logical_extent_physical_size (mln_logical_extent extent, uint32_t *out_width, uint32_t *out_height, mln_diagnostic *out_diagnostic) |
| uint32_t | mln_opengl_supported_context_provider_mask (void) |
Shared public C API declarations for render target descriptors.
| #define MLN_TEXTURE_RING_MAX_DEPTH 8 |
The most slots a texture ring holds, owned or borrowed.
| #define MLN_VULKAN_NON_DISPATCHABLE_HANDLE_NULL UINT64_C(0) |
Null Vulkan non-dispatchable handle.
| typedef struct mln_egl_context_descriptor mln_egl_context_descriptor |
EGL context fields shared by OpenGL render targets.
| typedef struct mln_gpu_sync mln_gpu_sync |
Backend synchronization copied by frame access and release calls.
OpenGL ownership and lifetimes follow MLN_GPU_SYNC_OPENGL_FENCE.
| typedef enum mln_gpu_sync_kind mln_gpu_sync_kind |
Synchronization payload kind for acquired texture frames.
| typedef struct mln_metal_context_descriptor mln_metal_context_descriptor |
Metal backend context fields shared by Metal render targets.
| typedef enum mln_opengl_client_api mln_opengl_client_api |
OpenGL client API a dedicated EGL session creates its context for.
| typedef struct mln_opengl_context_descriptor mln_opengl_context_descriptor |
OpenGL backend context fields shared by OpenGL render targets.
| typedef union mln_opengl_context_descriptor_data mln_opengl_context_descriptor_data |
Backend-specific OpenGL context data.
| typedef enum mln_opengl_context_ownership mln_opengl_context_ownership |
How a session's OpenGL context relates to its driver thread and host graphics state.
A shared session leaves the thread as it found it: every render makes the session context current and restores whatever was current before. The session context joins the host share group named by the descriptor, so a host may hand the session a texture and sample it from its own context.
A dedicated session joins no share group and leaves its context current after a render instead of restoring what was current before. A render that finds another context current makes its own current again, so several dedicated sessions can share one thread, and the host can use its own context between renders. Teardown releases the session context from the thread and restores nothing.
| typedef enum mln_opengl_context_platform mln_opengl_context_platform |
OpenGL platform context provider used by a context descriptor.
OpenGL context providers supported by this build.
| typedef struct mln_queue_lock mln_queue_lock |
Host lock on the graphics queue that a session shares with its host, copied by a successful attach.
Vulkan requires the host to synchronize every call that uses a queue. A Vulkan session submits to the context's graphics_queue. A host that also uses that queue must pass a lock here and take the same lock around its own queue calls. The callbacks may run on the graphics thread or the thread that abandons the session. Each queue submission or presentation holds the lock only for that call, never across a wait.
Both callbacks are null to disable the lock, or both are set. A disabled lock must not carry release_user_data. A session without a lock assumes that the host leaves the queue alone while the session is attached.
The callbacks must not call the C API; each status-returning function returns MLN_STATUS_INVALID_STATE when a callback calls it. The host must not hold the lock while calling the C API or waiting on a thread that does. Sessions sharing a queue must use the same host mutex.
Native code calls release_user_data once, after the session can no longer invoke the callbacks.
| typedef void(*) mln_queue_lock_callback(void *user_data) |
Takes or returns the host's lock on the queue that a session shares with it. Native code relies on the lock being held or released when the call returns.
| typedef enum mln_render_driver_kind mln_render_driver_kind |
Execution placement for one render session.
| typedef struct mln_render_session_attach_options mln_render_session_attach_options |
Common attachment policy copied before an attach call returns.
Every backend attachment call requires *out_session to be MLN_HANDLE_NULL on entry. MLN_STATUS_OK transfers an ATTACHING session to the caller and accepts its completion. A non-OK return leaves *out_session unchanged and invokes no completion. Hosts may service caller-driver work before attachment completes. A failed completion still requires mln_render_session_detach() or mln_render_session_abandon() before mln_render_session_release().
| typedef struct mln_render_session_capabilities mln_render_session_capabilities |
Driver and target capabilities fixed for one attached render session.
Optional render-session capabilities.
| typedef struct mln_vulkan_context_descriptor mln_vulkan_context_descriptor |
Vulkan backend context fields shared by Vulkan render targets.
| typedef uint64_t mln_vulkan_non_dispatchable_handle |
Bit pattern of a Vulkan non-dispatchable handle.
It carries either native representation of the handle, a pointer or a uint64_t. Zero represents VK_NULL_HANDLE.
| typedef struct mln_webgl_context_descriptor mln_webgl_context_descriptor |
WebGL context fields shared by OpenGL render targets in the browser.
| typedef enum mln_webgl_context_kind mln_webgl_context_kind |
WebGL context placement.
| typedef struct mln_webgpu_context_descriptor mln_webgpu_context_descriptor |
WebGPU backend context fields shared by WebGPU render targets.
| typedef struct mln_wgl_context_descriptor mln_wgl_context_descriptor |
WGL context fields shared by OpenGL render targets on Windows.
| enum mln_gpu_sync_kind : uint32_t |
Synchronization payload kind for acquired texture frames.
| enum mln_opengl_client_api : uint32_t |
| enum mln_opengl_context_ownership : uint32_t |
How a session's OpenGL context relates to its driver thread and host graphics state.
A shared session leaves the thread as it found it: every render makes the session context current and restores whatever was current before. The session context joins the host share group named by the descriptor, so a host may hand the session a texture and sample it from its own context.
A dedicated session joins no share group and leaves its context current after a render instead of restoring what was current before. A render that finds another context current makes its own current again, so several dedicated sessions can share one thread, and the host can use its own context between renders. Teardown releases the session context from the thread and restores nothing.
| enum mln_opengl_context_platform : uint32_t |
| enum mln_opengl_context_provider_flag : uint32_t |
| enum mln_render_driver_kind : uint32_t |
Execution placement for one render session.
| enum mln_render_session_capability_flag : uint32_t |
Optional render-session capabilities.
| enum mln_webgl_context_kind : uint32_t |
| mln_gpu_sync mln_gpu_sync_default | ( | void | ) |
Returns CPU-complete synchronization for this C API version.
| mln_status mln_logical_extent_physical_size | ( | mln_logical_extent | extent, |
| uint32_t * | out_width, | ||
| uint32_t * | out_height, | ||
| mln_diagnostic * | out_diagnostic ) |
Computes the physical device-pixel size of a logical extent.
Each dimension is ceil(logical * scale_factor). Session-owned texture targets and surface targets are sized this way. Caller-owned borrowed texture targets state their physical size directly; see texture.h.
Returns:
| uint32_t mln_opengl_supported_context_provider_mask | ( | void | ) |
Returns OpenGL context providers supported by this build.
| mln_render_session_attach_options mln_render_session_attach_options_default | ( | void | ) |
Returns attachment options initialized for this C API version, with each field at its documented default.