attachIoSurfaceRing method
- IoSurfaceRingDescriptor descriptor,
- RenderSessionAttachOptions options
Creates a session that renders the map into a ring of IOSurfaces that the library allocates.
Acquire each frame with RenderSessionHandle.acquireFrame(), and get its
surface with AcquiredFrameHandle.withIoSurface().
RenderSessionHandle.resize() gives the ring new surfaces of the new
size. Attach with RenderDriverKind.coreWorker.
To hand frames to a reader that can't wait on an event, such as Flutter's
copyPixelBuffer, attach without GpuSyncKindFlag.metalSharedEvent in
RenderSessionAttachOptions.producerSyncKinds, so that each frame
finishes before you acquire it. Release a frame with
GpuSyncKind.cpuComplete only once the reader has finished with its
surface.
See mln_map_attach_io_surface_ring in the
C API reference.
Errors:
Status.unsupportedwhensupportedRenderBackendMask()lacksRenderBackendFlag.metal.Status.nativeErrorwhencontextnames no device and the system has no Metal device.
Implementation
RenderSessionHandle attachIoSurfaceRing(
IoSurfaceRingDescriptor descriptor,
RenderSessionAttachOptions options,
) {
final registrations = _NativeRegistrations(_CallbackRoots());
return _attach(
(arena, completion, outSession) => registrations.run(
() => raw.mln_map_attach_io_surface_ring(
_handle.raw,
_writeIoSurfaceRingDescriptor(descriptor, arena),
_writeRenderSessionAttachOptions(options, arena, registrations),
outSession,
completion,
nativeDiagnostic,
),
),
(handle, ready) => _adoptOwned(
handle,
() =>
(RenderSessionHandle._(this, _NativeRenderSession(handle), ready)
.._state.retain(registrations)),
(handle) {
_check(raw.mln_render_session_dispose(handle, nativeDiagnostic));
},
),
);
}