Constructor

MaplibreNativeFfiOffscreenDevicecreate

Declaration [src]

MaplibreNativeFfiOffscreenDevice*
maplibre_native_ffi_offscreen_device_create (
  MaplibreNativeFfiOffscreenDeviceOptions* options,
  GError** error
)

Description [src]

Creates a GPU device for rendering maps offscreen.

maplibre_native_ffi_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.

See mln_offscreen_device_create in the C API reference.

It fails with these errors:

  • MAPLIBRE_NATIVE_FFI_ERROR_UNSUPPORTED in a browser WebGPU build, or when the device can’t render with client_api.
  • MAPLIBRE_NATIVE_FFI_ERROR_NATIVE_ERROR when adapter_index names no GPU, or the platform can’t create the device.

Parameters

options

Type: MaplibreNativeFfiOffscreenDeviceOptions

The value, or NULL.

The argument can be NULL.
The data is owned by the caller of the function.
error

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will be left initialized to NULL by the constructor if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: MaplibreNativeFfiOffscreenDevice

The object.

The caller of the function takes ownership of the data, and is responsible for freeing it.