drainFrameResults method

List<RenderFrameResult> drainFrameResults()

Takes the frame results that the session has queued.

When no result is queued, it succeeds and writes the null handle and an empty view.

See mln_render_session_drain_frame_results in the C API reference.

Implementation

List<RenderFrameResult> drainFrameResults() => withNativeArena((arena) {
  final outBatch = arena<Uint64>();
  final outView = arena<raw.mln_render_frame_batch_view>();
  outView.ref.size = sizeOf<raw.mln_render_frame_batch_view>();
  _check(
    raw.mln_render_session_drain_frame_results(
      _handle.raw,
      outBatch,
      outView,
      nativeDiagnostic,
    ),
  );
  if (outBatch.value == 0) {
    return const [];
  }
  return _drain(outBatch.value, (batch) {
    raw.mln_render_frame_batch_release(batch);
  }, () => _readRenderFrameBatchView(outView.ref));
});