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_metal_surface_replacement
struct  mln_vulkan_surface_descriptor
struct  mln_vulkan_surface_replacement
struct  mln_web_gpu_surface_descriptor
struct  mln_web_gpu_surface_replacement
struct  mln_open_gl_surface_descriptor
struct  mln_open_gl_surface_replacement

Typedefs

typedef struct mln_metal_surface_descriptor mln_metal_surface_descriptor
typedef struct mln_metal_surface_replacement mln_metal_surface_replacement
typedef struct mln_vulkan_surface_descriptor mln_vulkan_surface_descriptor
typedef struct mln_vulkan_surface_replacement mln_vulkan_surface_replacement
typedef struct mln_web_gpu_surface_descriptor mln_web_gpu_surface_descriptor
typedef struct mln_web_gpu_surface_replacement mln_web_gpu_surface_replacement
typedef struct mln_open_gl_surface_descriptor mln_open_gl_surface_descriptor
typedef struct mln_open_gl_surface_replacement mln_open_gl_surface_replacement

Functions

mln_status mln_map_attach_metal_surface (mln_map map, const mln_metal_surface_descriptor *descriptor, const mln_render_session_attach_options *options, mln_render_session *out_session, const mln_completion *completion, mln_diagnostic *out_diagnostic)
mln_status mln_map_attach_vulkan_surface (mln_map map, const mln_vulkan_surface_descriptor *descriptor, const mln_render_session_attach_options *options, mln_render_session *out_session, const mln_completion *completion, mln_diagnostic *out_diagnostic)
mln_status mln_map_attach_open_gl_surface (mln_map map, const mln_open_gl_surface_descriptor *descriptor, const mln_render_session_attach_options *options, mln_render_session *out_session, const mln_completion *completion, mln_diagnostic *out_diagnostic)
mln_status mln_map_attach_web_gpu_surface (mln_map map, const mln_web_gpu_surface_descriptor *descriptor, const mln_render_session_attach_options *options, mln_render_session *out_session, const mln_completion *completion, mln_diagnostic *out_diagnostic)
mln_status mln_render_session_set_metal_surface_target (mln_render_session session, const mln_metal_surface_replacement *replacement, const mln_completion *completion, mln_diagnostic *out_diagnostic)
mln_status mln_render_session_set_vulkan_surface_target (mln_render_session session, const mln_vulkan_surface_replacement *replacement, const mln_completion *completion, mln_diagnostic *out_diagnostic)
mln_status mln_render_session_set_open_gl_surface_target (mln_render_session session, const mln_open_gl_surface_replacement *replacement, const mln_completion *completion, mln_diagnostic *out_diagnostic)
mln_status mln_render_session_set_web_gpu_surface_target (mln_render_session session, const mln_web_gpu_surface_replacement *replacement, const mln_completion *completion, mln_diagnostic *out_diagnostic)

Detailed Description

Render a map to a window's surface.

Typedef Documentation

◆ mln_metal_surface_descriptor

typedef struct mln_metal_surface_descriptor mln_metal_surface_descriptor

A Metal layer to render to, for mln_map_attach_metal_surface().

The session sets the layer's device, pixel format, and drawable size. It uses the layer until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.

◆ mln_metal_surface_replacement

typedef struct mln_metal_surface_replacement mln_metal_surface_replacement

A new Metal layer for mln_render_session_set_metal_surface_target().

The session renders to it with the device that it attached with. It uses the layer until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.

◆ mln_open_gl_surface_descriptor

typedef struct mln_open_gl_surface_descriptor mln_open_gl_surface_descriptor

An OpenGL surface to present to, for mln_map_attach_open_gl_surface().

The session uses the surface until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.

◆ mln_open_gl_surface_replacement

typedef struct mln_open_gl_surface_replacement mln_open_gl_surface_replacement

A new OpenGL surface for mln_render_session_set_open_gl_surface_target().

The session presents to it with the context that it attached with. It uses the surface until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.

◆ mln_vulkan_surface_descriptor

typedef struct mln_vulkan_surface_descriptor mln_vulkan_surface_descriptor

A Vulkan surface to present to, for mln_map_attach_vulkan_surface().

The device must have VK_KHR_swapchain enabled, and the queue family of graphics_queue_family_index must support presenting to the surface. The session creates the swapchain. It uses the surface until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.

◆ mln_vulkan_surface_replacement

typedef struct mln_vulkan_surface_replacement mln_vulkan_surface_replacement

A new Vulkan surface for mln_render_session_set_vulkan_surface_target().

The session presents to it with the context that it attached with, so the queue family of that context's graphics_queue_family_index must support presenting to the surface. It uses the surface until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.

◆ mln_web_gpu_surface_descriptor

typedef struct mln_web_gpu_surface_descriptor mln_web_gpu_surface_descriptor

A WebGPU surface to present to, for mln_map_attach_web_gpu_surface().

The session configures the surface. It uses the surface until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.

◆ mln_web_gpu_surface_replacement

typedef struct mln_web_gpu_surface_replacement mln_web_gpu_surface_replacement

A new WebGPU surface for mln_render_session_set_web_gpu_surface_target().

The session configures it with the context and format that it attached with. It uses the surface until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.

Function Documentation

◆ mln_map_attach_metal_surface()

mln_status mln_map_attach_metal_surface ( mln_map map,
const mln_metal_surface_descriptor * descriptor,
const mln_render_session_attach_options * options,
mln_render_session * out_session,
const mln_completion * completion,
mln_diagnostic * out_diagnostic )

Creates a session that renders the map to a Metal layer.

Returns:

◆ mln_map_attach_open_gl_surface()

mln_status mln_map_attach_open_gl_surface ( mln_map map,
const mln_open_gl_surface_descriptor * descriptor,
const mln_render_session_attach_options * options,
mln_render_session * out_session,
const mln_completion * completion,
mln_diagnostic * out_diagnostic )

Creates a session that renders the map to an OpenGL surface.

Returns:

◆ mln_map_attach_vulkan_surface()

mln_status mln_map_attach_vulkan_surface ( mln_map map,
const mln_vulkan_surface_descriptor * descriptor,
const mln_render_session_attach_options * options,
mln_render_session * out_session,
const mln_completion * completion,
mln_diagnostic * out_diagnostic )

Creates a session that renders the map to a Vulkan surface.

Returns:

◆ mln_map_attach_web_gpu_surface()

mln_status mln_map_attach_web_gpu_surface ( mln_map map,
const mln_web_gpu_surface_descriptor * descriptor,
const mln_render_session_attach_options * options,
mln_render_session * out_session,
const mln_completion * completion,
mln_diagnostic * out_diagnostic )

Creates a session that renders the map to a WebGPU surface.

Returns:

◆ mln_render_session_set_metal_surface_target()

mln_status mln_render_session_set_metal_surface_target ( mln_render_session session,
const mln_metal_surface_replacement * replacement,
const mln_completion * completion,
mln_diagnostic * out_diagnostic )

Replaces the Metal layer that the session renders to.

Use it to give the session a layer again after mln_render_session_release_target(), to move it to another layer, or to resize it. Once the replacement completes, the session no longer uses the old layer.

◆ mln_render_session_set_open_gl_surface_target()

mln_status mln_render_session_set_open_gl_surface_target ( mln_render_session session,
const mln_open_gl_surface_replacement * replacement,
const mln_completion * completion,
mln_diagnostic * out_diagnostic )

Replaces the OpenGL surface that the session presents to.

Use it to give the session a surface again after mln_render_session_release_target(), to move it to another surface, or to resize it. Once the replacement completes, the session no longer uses the old surface.

◆ mln_render_session_set_vulkan_surface_target()

mln_status mln_render_session_set_vulkan_surface_target ( mln_render_session session,
const mln_vulkan_surface_replacement * replacement,
const mln_completion * completion,
mln_diagnostic * out_diagnostic )

Replaces the Vulkan surface that the session presents to.

Use it to give the session a surface again after mln_render_session_release_target(), to move it to another surface, or to resize it. Once the replacement completes, the session no longer uses the old surface.

Completes with:

  • MLN_STATUS_UNSUPPORTED when the new surface needs a different color format or pre-rotation support than the old one. Attach a new session instead.

◆ mln_render_session_set_web_gpu_surface_target()

mln_status mln_render_session_set_web_gpu_surface_target ( mln_render_session session,
const mln_web_gpu_surface_replacement * replacement,
const mln_completion * completion,
mln_diagnostic * out_diagnostic )

Replaces the WebGPU surface that the session presents to.

Use it to give the session a surface again after mln_render_session_release_target(), to move it to another surface, or to resize it. Once the replacement completes, the session no longer uses the old surface.