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

Go to the source code of this file.

Data Structures

struct  mln_offscreen_device_options
struct  mln_offscreen_descriptor

Typedefs

typedef enum mln_offscreen_device_option_field mln_offscreen_device_option_field
typedef uint32_t mln_offscreen_device_option_fields
typedef struct mln_offscreen_device_options mln_offscreen_device_options
typedef struct mln_offscreen_descriptor mln_offscreen_descriptor

Enumerations

enum  mln_offscreen_device_option_field : uint32_t { MLN_OFFSCREEN_DEVICE_OPTION_ADAPTER_INDEX = 1U << 0U , MLN_OFFSCREEN_DEVICE_OPTION_SINGLE_CONTEXT = 1U << 1U , MLN_OFFSCREEN_DEVICE_OPTION_CLIENT_API = 1U << 2U }

Functions

mln_status mln_offscreen_device_create (const mln_offscreen_device_options *options, mln_offscreen_device *out_device, mln_diagnostic *out_diagnostic)
void mln_offscreen_device_release (mln_offscreen_device device)
mln_status mln_map_attach_offscreen (mln_map map, const mln_offscreen_descriptor *descriptor, const mln_render_session_attach_options *options, mln_offscreen_device device, mln_render_session *out_session, const mln_completion *completion, mln_diagnostic *out_diagnostic)

Detailed Description

Render maps offscreen on a GPU device that the library creates.

Typedef Documentation

◆ mln_offscreen_descriptor

typedef struct mln_offscreen_descriptor mln_offscreen_descriptor

The image that mln_map_attach_offscreen() renders. The session renders it at the map's scale factor.

◆ mln_offscreen_device_option_field

◆ mln_offscreen_device_option_fields

◆ mln_offscreen_device_options

typedef struct mln_offscreen_device_options mln_offscreen_device_options

Enumeration Type Documentation

◆ mln_offscreen_device_option_field

The fields that mln_offscreen_device_options sets.

Enumerator
MLN_OFFSCREEN_DEVICE_OPTION_ADAPTER_INDEX 
MLN_OFFSCREEN_DEVICE_OPTION_SINGLE_CONTEXT 
MLN_OFFSCREEN_DEVICE_OPTION_CLIENT_API 

Function Documentation

◆ mln_map_attach_offscreen()

mln_status mln_map_attach_offscreen ( mln_map map,
const mln_offscreen_descriptor * descriptor,
const mln_render_session_attach_options * options,
mln_offscreen_device device,
mln_render_session * out_session,
const mln_completion * completion,
mln_diagnostic * out_diagnostic )

Attaches a render session that renders the map offscreen.

Read each image's pixels with mln_render_session_read_texture().

The session renders on device. When device is null, the session creates a device with the default options, and releases it when the session ends.

Returns:

  • MLN_STATUS_INVALID_STATE when the map already has a render session.

Completes with:

  • MLN_STATUS_NATIVE_ERROR when device is null and the platform can't create a device.

◆ mln_offscreen_device_create()

mln_status mln_offscreen_device_create ( const mln_offscreen_device_options * options,
mln_offscreen_device * out_device,
mln_diagnostic * out_diagnostic )

Creates a GPU device for rendering maps offscreen.

mln_map_attach_offscreen() creates a device of its own when it gets none. Create one to share it among the sessions on many maps, or to pick a GPU.

In a browser WebGPU build, attach without a device instead.

Returns:

  • MLN_STATUS_UNSUPPORTED in a browser WebGPU build, or when the device can't render with client_api.
  • MLN_STATUS_NATIVE_ERROR when adapter_index names no GPU, or the platform can't create the device.

◆ mln_offscreen_device_release()

void mln_offscreen_device_release ( mln_offscreen_device device)

Releases an offscreen device.

Render sessions on the device keep working until they detach.