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

Go to the source code of this file.

Data Structures

struct  mln_diagnostic
struct  mln_buffer_view

Macros

#define MLN_DIAGNOSTIC_MESSAGE_CAPACITY   4096u
#define MLN_HANDLE_NULL   ((uint64_t)0)
#define MLN_C_VERSION   0u
#define MLN_STRIDED_AT(type, items, stride, index)

Typedefs

typedef enum mln_status mln_status
typedef struct mln_diagnostic mln_diagnostic
typedef enum mln_render_backend_flag mln_render_backend_flag
typedef uint32_t mln_render_backend_flags
typedef uint64_t mln_runtime
typedef uint64_t mln_map
typedef uint64_t mln_style_expression
typedef uint64_t mln_offscreen_device
typedef uint64_t mln_vulkan_device
typedef uint64_t mln_map_projection
typedef uint64_t mln_resource_request
typedef uint64_t mln_resource_transform_request
typedef uint64_t mln_render_session
typedef uint64_t mln_acquired_frame
typedef uint64_t mln_render_frame_batch
typedef uint64_t mln_frame_pacer
typedef uint64_t mln_delivery_queue
typedef struct mln_buffer_view mln_buffer_view
typedef void(*) mln_user_data_release(void *user_data)

Enumerations

enum  mln_status : int32_t {
  MLN_STATUS_OK = 0 , MLN_STATUS_INVALID_ARGUMENT = -1 , MLN_STATUS_INVALID_STATE = -2 , MLN_STATUS_WRONG_THREAD = -3 ,
  MLN_STATUS_UNSUPPORTED = -4 , MLN_STATUS_NATIVE_ERROR = -5 , MLN_STATUS_CANCELLED = -6 , MLN_STATUS_BUSY = -7 ,
  MLN_STATUS_TARGET_LOST = -8 , MLN_STATUS_NOT_FOUND = -10 , MLN_STATUS_ALREADY_EXISTS = -11
}
enum  mln_render_backend_flag : uint32_t { MLN_RENDER_BACKEND_FLAG_METAL = 1u << 0u , MLN_RENDER_BACKEND_FLAG_VULKAN = 1u << 1u , MLN_RENDER_BACKEND_FLAG_OPEN_GL = 1u << 2u , MLN_RENDER_BACKEND_FLAG_WEB_GPU = 1u << 3u }

Functions

uint32_t mln_c_version (void)
mln_render_backend_flags mln_supported_render_backend_mask (void)

Detailed Description

Statuses, diagnostics, handles, and other types that every header uses.

Macro Definition Documentation

◆ MLN_C_VERSION

#define MLN_C_VERSION   0u

The API epoch of these headers.

◆ MLN_DIAGNOSTIC_MESSAGE_CAPACITY

#define MLN_DIAGNOSTIC_MESSAGE_CAPACITY   4096u

The size of a diagnostic message in bytes, with its terminator.

◆ MLN_HANDLE_NULL

#define MLN_HANDLE_NULL   ((uint64_t)0)

The handle that names no object.

◆ MLN_STRIDED_AT

#define MLN_STRIDED_AT ( type,
items,
stride,
index )
Value:
((const type*)((const unsigned char*)(items) + \
((size_t)(index) * (size_t)(stride))))

Points at item index of an array whose items are stride bytes apart.

Use it to read arrays whose item size native reports, such as a completion's value, because a newer library can return larger items.

Typedef Documentation

◆ mln_acquired_frame

typedef uint64_t mln_acquired_frame

A rendered frame that the caller holds to read or show.

◆ mln_buffer_view

typedef struct mln_buffer_view mln_buffer_view

A range of bytes, such as UTF-8 text.

Lifetimes: data can be null when size is 0. Text ends at size and needs no NUL terminator.

◆ mln_delivery_queue

typedef uint64_t mln_delivery_queue

A queue that holds callback calls until the caller dispatches them.

◆ mln_diagnostic

typedef struct mln_diagnostic mln_diagnostic

A message that explains why a call failed.

Lifetimes: A function writes a NUL-terminated message, or an empty one when it succeeds. Pass null as out_diagnostic to skip the message.

◆ mln_frame_pacer

typedef uint64_t mln_frame_pacer

Demands render sessions' frames at a display's refreshes.

◆ mln_map

typedef uint64_t mln_map

A map, with its style and camera.

◆ mln_map_projection

typedef uint64_t mln_map_projection

A camera view for converting between screen points and coordinates.

◆ mln_offscreen_device

typedef uint64_t mln_offscreen_device

A GPU device that the library creates to render maps offscreen.

◆ mln_render_backend_flag

A render backend, as a bit in a set.

◆ mln_render_backend_flags

typedef uint32_t mln_render_backend_flags

A set of mln_render_backend_flag bits.

◆ mln_render_frame_batch

typedef uint64_t mln_render_frame_batch

The frame results that mln_render_session_drain_frame_results() took.

◆ mln_render_session

typedef uint64_t mln_render_session

A render session draws a map into a surface or a texture.

◆ mln_resource_request

typedef uint64_t mln_resource_request

A resource load that a resource provider answers.

◆ mln_resource_transform_request

A URL rewrite that a resource transform answers with the URL to load.

◆ mln_runtime

typedef uint64_t mln_runtime

A runtime owns maps and the network and cache settings that they share.

◆ mln_status

typedef enum mln_status mln_status

The result of a call or of asynchronous work.

◆ mln_style_expression

typedef uint64_t mln_style_expression

A parsed style expression.

◆ mln_user_data_release

typedef void(*) mln_user_data_release(void *user_data)

Frees the user_data of a callback registration.

Lifetimes: Native calls it once, after the last call to the registration's callback. When the function that takes the registration fails, native never calls it, and the caller still owns user_data.

◆ mln_vulkan_device

typedef uint64_t mln_vulkan_device

A Vulkan instance, device, and queue that the library creates and owns.

Enumeration Type Documentation

◆ mln_render_backend_flag

enum mln_render_backend_flag : uint32_t

A render backend, as a bit in a set.

Enumerator
MLN_RENDER_BACKEND_FLAG_METAL 
MLN_RENDER_BACKEND_FLAG_VULKAN 
MLN_RENDER_BACKEND_FLAG_OPEN_GL 
MLN_RENDER_BACKEND_FLAG_WEB_GPU 

◆ mln_status

enum mln_status : int32_t

The result of a call or of asynchronous work.

Enumerator
MLN_STATUS_OK 
MLN_STATUS_INVALID_ARGUMENT 

An argument is invalid, such as malformed JSON or a value out of range.

MLN_STATUS_INVALID_STATE 

The call doesn't fit the current state, such as removing a source that a layer still uses.

MLN_STATUS_WRONG_THREAD 

The call came from a thread that can't make it.

MLN_STATUS_UNSUPPORTED 

The platform, the build, or the render target lacks the feature.

MLN_STATUS_NATIVE_ERROR 

The library or the platform hit an error, such as a failed graphics driver call.

MLN_STATUS_CANCELLED 

The work stopped before it finished, such as when its handle was released.

MLN_STATUS_BUSY 

Another call is still using the same object.

MLN_STATUS_TARGET_LOST 

The render target can't be drawn to anymore.

MLN_STATUS_NOT_FOUND 

Nothing has the given ID.

MLN_STATUS_ALREADY_EXISTS 

Something already has the given ID.

Function Documentation

◆ mln_c_version()

uint32_t mln_c_version ( void )

Returns the API epoch of the library.

Headers and a library with different epochs aren't compatible. Compare the result with MLN_C_VERSION.

◆ mln_supported_render_backend_mask()

mln_render_backend_flags mln_supported_render_backend_mask ( void )

Returns the render backends that this build of the library draws with.