|
MapLibre Native C API
Public C ABI for the MapLibre Native wrapper.
|
Go to the source code of this file.
Data Structures | |
| struct | mln_metal_owned_texture_descriptor |
| struct | mln_metal_borrowed_texture |
| struct | mln_metal_borrowed_texture_descriptor |
| struct | mln_metal_texture_frame |
| struct | mln_vulkan_owned_texture_descriptor |
| struct | mln_vulkan_borrowed_texture |
| struct | mln_vulkan_borrowed_texture_descriptor |
| struct | mln_vulkan_texture_frame |
| struct | mln_opengl_owned_texture_descriptor |
| struct | mln_opengl_borrowed_texture |
| struct | mln_opengl_borrowed_texture_descriptor |
| struct | mln_webgpu_owned_texture_descriptor |
| struct | mln_webgpu_borrowed_texture |
| struct | mln_webgpu_borrowed_texture_descriptor |
| struct | mln_webgpu_texture_frame |
| struct | mln_opengl_texture_frame |
| struct | mln_texture_image_info |
| struct | mln_texture_readback_result |
Typedefs | |
| typedef struct mln_metal_owned_texture_descriptor | mln_metal_owned_texture_descriptor |
| typedef struct mln_metal_borrowed_texture | mln_metal_borrowed_texture |
| typedef struct mln_metal_borrowed_texture_descriptor | mln_metal_borrowed_texture_descriptor |
| typedef struct mln_metal_texture_frame | mln_metal_texture_frame |
| typedef struct mln_vulkan_owned_texture_descriptor | mln_vulkan_owned_texture_descriptor |
| typedef struct mln_vulkan_borrowed_texture | mln_vulkan_borrowed_texture |
| typedef struct mln_vulkan_borrowed_texture_descriptor | mln_vulkan_borrowed_texture_descriptor |
| typedef struct mln_vulkan_texture_frame | mln_vulkan_texture_frame |
| typedef struct mln_opengl_owned_texture_descriptor | mln_opengl_owned_texture_descriptor |
| typedef struct mln_opengl_borrowed_texture | mln_opengl_borrowed_texture |
| typedef struct mln_opengl_borrowed_texture_descriptor | mln_opengl_borrowed_texture_descriptor |
| typedef struct mln_webgpu_owned_texture_descriptor | mln_webgpu_owned_texture_descriptor |
| typedef struct mln_webgpu_borrowed_texture | mln_webgpu_borrowed_texture |
| typedef struct mln_webgpu_borrowed_texture_descriptor | mln_webgpu_borrowed_texture_descriptor |
| typedef struct mln_webgpu_texture_frame | mln_webgpu_texture_frame |
| typedef struct mln_opengl_texture_frame | mln_opengl_texture_frame |
| typedef struct mln_texture_image_info | mln_texture_image_info |
| typedef struct mln_texture_readback_result | mln_texture_readback_result |
Public C API declarations for texture render targets.
| typedef struct mln_metal_borrowed_texture mln_metal_borrowed_texture |
One caller-owned Metal texture of a borrowed texture ring.
| typedef struct mln_metal_borrowed_texture_descriptor mln_metal_borrowed_texture_descriptor |
Metal attachment options for a borrowed texture target.
| typedef struct mln_metal_owned_texture_descriptor mln_metal_owned_texture_descriptor |
Metal attachment options for an owned texture target.
| typedef struct mln_metal_texture_frame mln_metal_texture_frame |
Metal frame acquired from a texture ring.
| typedef struct mln_opengl_borrowed_texture mln_opengl_borrowed_texture |
One caller-owned OpenGL texture of a borrowed texture ring.
| typedef struct mln_opengl_borrowed_texture_descriptor mln_opengl_borrowed_texture_descriptor |
OpenGL attachment options for a borrowed texture target.
| typedef struct mln_opengl_owned_texture_descriptor mln_opengl_owned_texture_descriptor |
OpenGL attachment options for an owned texture target.
| typedef struct mln_opengl_texture_frame mln_opengl_texture_frame |
OpenGL frame acquired from a texture ring.
| typedef struct mln_texture_image_info mln_texture_image_info |
CPU image readback metadata for a texture target frame.
| typedef struct mln_texture_readback_result mln_texture_readback_result |
Texture readback borrowed for a completion callback.
| typedef struct mln_vulkan_borrowed_texture mln_vulkan_borrowed_texture |
One caller-owned Vulkan image of a borrowed texture ring.
| typedef struct mln_vulkan_borrowed_texture_descriptor mln_vulkan_borrowed_texture_descriptor |
Vulkan attachment options for a borrowed texture target.
| typedef struct mln_vulkan_owned_texture_descriptor mln_vulkan_owned_texture_descriptor |
Vulkan attachment options for an owned texture target.
| typedef struct mln_vulkan_texture_frame mln_vulkan_texture_frame |
Vulkan frame acquired from a texture ring.
| typedef struct mln_webgpu_borrowed_texture mln_webgpu_borrowed_texture |
One caller-owned WebGPU texture of a borrowed texture ring.
| typedef struct mln_webgpu_borrowed_texture_descriptor mln_webgpu_borrowed_texture_descriptor |
WebGPU attachment options for a borrowed texture target.
| typedef struct mln_webgpu_owned_texture_descriptor mln_webgpu_owned_texture_descriptor |
WebGPU attachment options for an owned texture target.
| typedef struct mln_webgpu_texture_frame mln_webgpu_texture_frame |
WebGPU frame acquired from a texture ring.
| mln_status mln_acquired_frame_get_metal_texture | ( | mln_acquired_frame | frame, |
| mln_metal_texture_frame * | out_frame, | ||
| mln_diagnostic * | out_diagnostic ) |
Copies Metal-native metadata from an acquired frame.
The texture and device pointers are borrowed and remain valid only until mln_acquired_frame_release(). A host that may dispose the frame or its session from another thread uses them inside an mln_acquired_frame_view_begin() scope.
Returns:
| mln_status mln_acquired_frame_get_opengl_texture | ( | mln_acquired_frame | frame, |
| mln_opengl_texture_frame * | out_frame, | ||
| mln_diagnostic * | out_diagnostic ) |
Copies OpenGL-native metadata from an acquired frame.
The caller driver's context must be current on this thread. The texture name is borrowed and remains valid only until mln_acquired_frame_release(). A host that may dispose the frame or its session from another thread uses it inside an mln_acquired_frame_view_begin() scope.
Returns:
| mln_status mln_acquired_frame_get_vulkan_texture | ( | mln_acquired_frame | frame, |
| mln_vulkan_texture_frame * | out_frame, | ||
| mln_diagnostic * | out_diagnostic ) |
Copies Vulkan-native metadata from an acquired frame.
The image and image view handles and the device pointer are borrowed and remain valid only until mln_acquired_frame_release(). A host that may dispose the frame or its session from another thread uses them inside an mln_acquired_frame_view_begin() scope.
Returns:
| mln_status mln_acquired_frame_get_webgpu_texture | ( | mln_acquired_frame | frame, |
| mln_webgpu_texture_frame * | out_frame, | ||
| mln_diagnostic * | out_diagnostic ) |
Copies WebGPU-native metadata from an acquired frame.
The texture, view, and device pointers are borrowed and remain valid only until mln_acquired_frame_release(). A host that may dispose the frame or its session from another thread uses them inside an mln_acquired_frame_view_begin() scope.
Returns:
| mln_status mln_map_attach_metal_borrowed_texture | ( | mln_map | map, |
| const mln_metal_borrowed_texture_descriptor * | descriptor, | ||
| const mln_render_session_attach_options * | options, | ||
| mln_render_session * | out_session, | ||
| const mln_completion * | completion, | ||
| mln_diagnostic * | out_diagnostic ) |
Starts attachment of a ring of caller-owned Metal textures.
The session renders into the descriptor's textures as a ring whose depth is their count, and grants frame acquisition and consumer synchronization, but not readback. It never renders into a texture whose frame is acquired. Without acquisition, the session may render into any slot that no acquired frame holds whenever it runs a demand. A host that samples a texture across demands on a core worker acquires its frame first. The common options select driver placement; their requested ring depth is ignored. The descriptor, its textures array, and the options are copied before return.
Returns:
Completes with:
| mln_status mln_map_attach_metal_owned_texture | ( | mln_map | map, |
| const mln_metal_owned_texture_descriptor * | descriptor, | ||
| const mln_render_session_attach_options * | options, | ||
| mln_render_session * | out_session, | ||
| const mln_completion * | completion, | ||
| mln_diagnostic * | out_diagnostic ) |
Starts attachment of a session-owned Metal texture ring.
The common options select driver placement and requested ring depth. The descriptor and options are copied before return.
Returns:
Completes with:
| mln_status mln_map_attach_opengl_borrowed_texture | ( | mln_map | map, |
| const mln_opengl_borrowed_texture_descriptor * | descriptor, | ||
| const mln_render_session_attach_options * | options, | ||
| mln_render_session * | out_session, | ||
| const mln_completion * | completion, | ||
| mln_diagnostic * | out_diagnostic ) |
Starts attachment of a ring of caller-owned OpenGL textures.
The textures are GL_TEXTURE_2D, and the ring behaves as mln_map_attach_metal_borrowed_texture() describes.
Returns:
Completes with:
| mln_status mln_map_attach_opengl_owned_texture | ( | mln_map | map, |
| const mln_opengl_owned_texture_descriptor * | descriptor, | ||
| const mln_render_session_attach_options * | options, | ||
| mln_render_session * | out_session, | ||
| const mln_completion * | completion, | ||
| mln_diagnostic * | out_diagnostic ) |
Starts attachment of a session-owned OpenGL texture ring.
Shared WGL, EGL, and existing WebGL contexts require the caller driver and grant frame acquisition, readback, and consumer synchronization. Dedicated EGL, dedicated WGL, and transferred WebGL contexts require the core-worker driver and grant readback only with a ring depth of one.
The host keeps every descriptor-named backend handle valid through completed detach. In particular, it keeps an EGLDisplay initialized while its session is live.
Returns:
Completes with:
| mln_status mln_map_attach_vulkan_borrowed_texture | ( | mln_map | map, |
| const mln_vulkan_borrowed_texture_descriptor * | descriptor, | ||
| const mln_render_session_attach_options * | options, | ||
| mln_render_session * | out_session, | ||
| const mln_completion * | completion, | ||
| mln_diagnostic * | out_diagnostic ) |
Starts attachment of a ring of caller-owned Vulkan images.
The ring behaves as mln_map_attach_metal_borrowed_texture() describes.
Returns:
Completes with:
| mln_status mln_map_attach_vulkan_owned_texture | ( | mln_map | map, |
| const mln_vulkan_owned_texture_descriptor * | descriptor, | ||
| const mln_render_session_attach_options * | options, | ||
| mln_render_session * | out_session, | ||
| const mln_completion * | completion, | ||
| mln_diagnostic * | out_diagnostic ) |
Starts attachment of a session-owned Vulkan texture ring.
The common options select driver placement and requested ring depth. The descriptor and options are copied before return.
Returns:
Completes with:
| mln_status mln_map_attach_webgpu_borrowed_texture | ( | mln_map | map, |
| const mln_webgpu_borrowed_texture_descriptor * | descriptor, | ||
| const mln_render_session_attach_options * | options, | ||
| mln_render_session * | out_session, | ||
| const mln_completion * | completion, | ||
| mln_diagnostic * | out_diagnostic ) |
Starts attachment of a ring of caller-owned WebGPU textures.
Browser targets require MLN_RENDER_DRIVER_CALLER_GRAPHICS_THREAD. The ring otherwise behaves as mln_map_attach_metal_borrowed_texture() describes.
Returns:
Completes with:
| mln_status mln_map_attach_webgpu_owned_texture | ( | mln_map | map, |
| const mln_webgpu_owned_texture_descriptor * | descriptor, | ||
| const mln_render_session_attach_options * | options, | ||
| mln_render_session * | out_session, | ||
| const mln_completion * | completion, | ||
| mln_diagnostic * | out_diagnostic ) |
Starts attachment of a session-owned WebGPU texture ring.
Browser targets require MLN_RENDER_DRIVER_CALLER_GRAPHICS_THREAD.
Returns:
Completes with:
| mln_metal_borrowed_texture_descriptor mln_metal_borrowed_texture_descriptor_default | ( | void | ) |
Returns Metal borrowed-texture descriptor defaults for this C API version.
| mln_metal_owned_texture_descriptor mln_metal_owned_texture_descriptor_default | ( | void | ) |
Returns Metal owned-texture descriptor defaults for this C API version.
| mln_opengl_borrowed_texture_descriptor mln_opengl_borrowed_texture_descriptor_default | ( | void | ) |
Returns OpenGL borrowed-texture descriptor defaults for this C API version.
| mln_opengl_owned_texture_descriptor mln_opengl_owned_texture_descriptor_default | ( | void | ) |
Returns OpenGL owned-texture descriptor defaults for this C API version.
| mln_status mln_render_session_read_texture | ( | mln_render_session | session, |
| const mln_completion * | completion, | ||
| mln_diagnostic * | out_diagnostic ) |
Reads back the latest frame of the session's owned texture as premultiplied RGBA8.
The completion delivers one mln_texture_readback_result as its value, with a value_count of one. Its pixel bytes are borrowed for the duration of the callback; copy anything the host keeps.
On browser WebGPU the readback finishes on a later driver service, after the graphics thread's event loop delivers the mapped copy; see mln_render_session_service_driver_work(). The session's later driver work runs after it. A lost device fails the readback.
Returns:
Completes with:
| mln_status mln_render_session_set_metal_borrowed_texture_target | ( | mln_render_session | session, |
| const mln_metal_borrowed_texture_descriptor * | descriptor, | ||
| const mln_completion * | completion, | ||
| mln_diagnostic * | out_diagnostic ) |
Starts an ordered replacement of every texture of a caller-owned Metal ring.
The descriptor and its textures array are copied before return. The replacement names as many textures as the session attached with, each belonging to the device this session attached with.
The replacement runs in order with the session's other driver work. Frames published before the replacement can no longer be acquired: acquisition reports MLN_STATUS_NOT_READY from this call's return until the replacement has run. The replacement also returns to service every slot whose frame was disposed. The completion means that the session no longer renders into or reads the replaced textures.
Returns:
Completes with:
| mln_status mln_render_session_set_opengl_borrowed_texture_target | ( | mln_render_session | session, |
| const mln_opengl_borrowed_texture_descriptor * | descriptor, | ||
| const mln_completion * | completion, | ||
| mln_diagnostic * | out_diagnostic ) |
Starts an ordered replacement of every texture of a caller-owned OpenGL ring.
The descriptor and its textures array are copied before return. The replacement names as many GL_TEXTURE_2D textures as the session attached with, in the context this session attached with.
The replacement otherwise behaves as mln_render_session_set_metal_borrowed_texture_target() describes.
Returns:
Completes with:
| mln_status mln_render_session_set_vulkan_borrowed_texture_target | ( | mln_render_session | session, |
| const mln_vulkan_borrowed_texture_descriptor * | descriptor, | ||
| const mln_completion * | completion, | ||
| mln_diagnostic * | out_diagnostic ) |
Starts an ordered replacement of every image of a caller-owned Vulkan ring.
The descriptor and its textures array are copied before return. The replacement names as many images as the session attached with, and the context this session attached with.
The replacement otherwise behaves as mln_render_session_set_metal_borrowed_texture_target() describes.
Returns:
Completes with:
| mln_status mln_render_session_set_webgpu_borrowed_texture_target | ( | mln_render_session | session, |
| const mln_webgpu_borrowed_texture_descriptor * | descriptor, | ||
| const mln_completion * | completion, | ||
| mln_diagnostic * | out_diagnostic ) |
Starts an ordered replacement of every texture of a caller-owned WebGPU ring.
The descriptor and its textures array are copied before return. The replacement names as many textures as the session attached with, and the device and queue this session attached with.
The replacement otherwise behaves as mln_render_session_set_metal_borrowed_texture_target() describes.
Returns:
Completes with:
| mln_vulkan_borrowed_texture_descriptor mln_vulkan_borrowed_texture_descriptor_default | ( | void | ) |
Returns Vulkan borrowed-texture descriptor defaults for this C API version.
| mln_vulkan_owned_texture_descriptor mln_vulkan_owned_texture_descriptor_default | ( | void | ) |
Returns Vulkan owned-texture descriptor defaults for this C API version.
| mln_webgpu_borrowed_texture_descriptor mln_webgpu_borrowed_texture_descriptor_default | ( | void | ) |
Returns WebGPU borrowed-texture descriptor defaults for this C API version.
| mln_webgpu_owned_texture_descriptor mln_webgpu_owned_texture_descriptor_default | ( | void | ) |
Returns WebGPU owned-texture descriptor defaults for this C API version.