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

Go to the source code of this file.

Data Structures

struct  mln_metal_surface_descriptor
 
struct  mln_vulkan_surface_descriptor
 
struct  mln_opengl_surface_descriptor
 

Functions

mln_metal_surface_descriptor mln_metal_surface_descriptor_default (void)
 
mln_vulkan_surface_descriptor mln_vulkan_surface_descriptor_default (void)
 
mln_opengl_surface_descriptor mln_opengl_surface_descriptor_default (void)
 
mln_status mln_metal_surface_attach (mln_map *map, const mln_metal_surface_descriptor *descriptor, mln_render_session **out_session)
 
mln_status mln_vulkan_surface_attach (mln_map *map, const mln_vulkan_surface_descriptor *descriptor, mln_render_session **out_session)
 
mln_status mln_opengl_surface_attach (mln_map *map, const mln_opengl_surface_descriptor *descriptor, mln_render_session **out_session)
 

Detailed Description

Public C API declarations for surface render targets.

Function Documentation

◆ mln_metal_surface_attach()

mln_status mln_metal_surface_attach ( mln_map * map,
const mln_metal_surface_descriptor * descriptor,
mln_render_session ** out_session )

Attaches a Metal native surface render target to a map.

The map may have at most one live render session. The session and every surface-session call are owner-thread affine to the map owner thread. The session retains descriptor->layer and optional descriptor->context.device. It renders into the layer and presents through it. On success, *out_session receives a handle the caller destroys with mln_render_session_destroy().

Returns:

  • MLN_STATUS_OK on success.
  • MLN_STATUS_INVALID_ARGUMENT when map is null or not live, descriptor is null or invalid, out_session is null, or *out_session is not null.
  • MLN_STATUS_INVALID_STATE when the map already has a render session.
  • MLN_STATUS_WRONG_THREAD when called from a thread other than the map owner thread.
  • MLN_STATUS_UNSUPPORTED when Metal surface sessions are not supported by this build.
  • MLN_STATUS_NATIVE_ERROR when an internal exception is converted to status.

◆ mln_metal_surface_descriptor_default()

mln_metal_surface_descriptor mln_metal_surface_descriptor_default ( void )

Returns Metal surface descriptor defaults for this C API version.

◆ mln_opengl_surface_attach()

mln_status mln_opengl_surface_attach ( mln_map * map,
const mln_opengl_surface_descriptor * descriptor,
mln_render_session ** out_session )

Attaches an OpenGL native surface render target to a map.

The map may have at most one live render session. The session and every surface-session call are owner-thread affine to the map owner thread. The session renders to descriptor->surface and presents through the selected context provider. WGL surfaces present with SwapBuffers(HDC), and EGL surfaces present with eglSwapBuffers(EGLDisplay, EGLSurface). OpenGL context handles are borrowed and must remain valid until detach or destroy. On success, *out_session receives a handle the caller destroys with mln_render_session_destroy().

Returns:

  • MLN_STATUS_OK on success.
  • MLN_STATUS_INVALID_ARGUMENT when map is null or not live, descriptor is null or invalid, out_session is null, or *out_session is not null.
  • MLN_STATUS_INVALID_STATE when the map already has a render session.
  • MLN_STATUS_WRONG_THREAD when called from a thread other than the map owner thread.
  • MLN_STATUS_UNSUPPORTED when OpenGL surface sessions are not supported by this build.
  • MLN_STATUS_NATIVE_ERROR when an internal exception is converted to status.

◆ mln_opengl_surface_descriptor_default()

mln_opengl_surface_descriptor mln_opengl_surface_descriptor_default ( void )

Returns OpenGL surface descriptor defaults for this C API version.

◆ mln_vulkan_surface_attach()

mln_status mln_vulkan_surface_attach ( mln_map * map,
const mln_vulkan_surface_descriptor * descriptor,
mln_render_session ** out_session )

Attaches a Vulkan native surface render target to a map.

The map may have at most one live render session. The session and every surface-session call are owner-thread affine to the map owner thread. The session renders to descriptor->surface and presents through it. The Vulkan device must support VK_KHR_swapchain, and the queue family must support graphics and presentation to descriptor->surface. Vulkan handles are borrowed and must remain valid until the session is detached or destroyed. On success, *out_session receives a handle the caller destroys with mln_render_session_destroy().

Returns:

  • MLN_STATUS_OK on success.
  • MLN_STATUS_INVALID_ARGUMENT when map is null or not live, descriptor is null or invalid, out_session is null, or *out_session is not null.
  • MLN_STATUS_INVALID_STATE when the map already has a render session.
  • MLN_STATUS_WRONG_THREAD when called from a thread other than the map owner thread.
  • MLN_STATUS_UNSUPPORTED when Vulkan surface sessions are not supported by this build.
  • MLN_STATUS_NATIVE_ERROR when an internal exception is converted to status.

◆ mln_vulkan_surface_descriptor_default()

mln_vulkan_surface_descriptor mln_vulkan_surface_descriptor_default ( void )

Returns Vulkan surface descriptor defaults for this C API version.