setMetalBorrowedTextureTarget method

Future<void> setMetalBorrowedTextureTarget(
  1. MetalBorrowedTextureReplacement replacement
)

Replaces the Metal textures that a borrowed ring renders into.

Use it to resize the ring, or to give the session textures again after RenderSessionHandle.releaseTarget(). Release every acquired frame first. Once the replacement completes, the session no longer uses the old textures.

See mln_render_session_set_metal_borrowed_texture_target in the C API reference.

Errors:

  • Status.unsupported when the new textures have a different pixel format than the old ones. Attach a new session to change it.

Implementation

Future<void> setMetalBorrowedTextureTarget(
  MetalBorrowedTextureReplacement replacement,
) => _run(
  (arena, completion) =>
      raw.mln_render_session_set_metal_borrowed_texture_target(
        _handle.raw,
        _writeMetalBorrowedTextureReplacement(replacement, arena),
        completion,
        nativeDiagnostic,
      ),
);