create static method
- OffscreenDeviceOptions? options,
Creates a GPU device for rendering maps offscreen.
MapHandle.attachOffscreen() 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.
Errors:
Status.unsupportedin a browser WebGPU build, or when the device can't render withclient_api.Status.nativeErrorwhenadapter_indexnames no GPU, or the platform can't create the device.
Implementation
static OffscreenDeviceHandle create({OffscreenDeviceOptions? options}) =>
withNativeArena((arena) {
ensureAbiVersion();
final outDevice = arena<Uint64>();
_check(
raw.mln_offscreen_device_create(
options == null
? nullptr
: _writeOffscreenDeviceOptions(options, arena),
outDevice,
nativeDiagnostic,
),
);
return _adoptOwned(
outDevice.value,
() =>
OffscreenDeviceHandle._(_NativeOffscreenDevice(outDevice.value)),
(handle) {
raw.mln_offscreen_device_release(handle);
},
);
});