Flutter Impeller
impeller::ImpellerMetalCaptureManager Class Reference

Creates and manages a Metal capture scope that supports frame capture when using the FlutterMetalLayer backed drawable. More...

#include <context_mtl.h>

Public Member Functions

 ImpellerMetalCaptureManager (id< MTLDevice > device)
 Construct a new capture manager from the provided Metal device. More...
 
 ~ImpellerMetalCaptureManager ()=default
 
bool CaptureScopeActive () const
 
void StartCapture ()
 Begin a new capture scope, no-op if the scope has already started. More...
 
void FinishCapture ()
 End the current capture scope. More...
 

Detailed Description

Creates and manages a Metal capture scope that supports frame capture when using the FlutterMetalLayer backed drawable.

Definition at line 37 of file context_mtl.h.

Constructor & Destructor Documentation

◆ ImpellerMetalCaptureManager()

impeller::ImpellerMetalCaptureManager::ImpellerMetalCaptureManager ( id< MTLDevice >  device)
explicit

Construct a new capture manager from the provided Metal device.

Definition at line 520 of file context_mtl.mm.

520  {
521  current_capture_scope_ = [[MTLCaptureManager sharedCaptureManager]
522  newCaptureScopeWithDevice:device];
523  [current_capture_scope_ setLabel:@"Impeller Frame"];
524  [[MTLCaptureManager sharedCaptureManager]
525  setDefaultCaptureScope:current_capture_scope_];
526 }

◆ ~ImpellerMetalCaptureManager()

impeller::ImpellerMetalCaptureManager::~ImpellerMetalCaptureManager ( )
default

Member Function Documentation

◆ CaptureScopeActive()

bool impeller::ImpellerMetalCaptureManager::CaptureScopeActive ( ) const

Whether or not the Impeller capture scope is active.

This is distinct from whether or not there is a session recording the capture. That can be checked with [[MTLCaptureManager sharedCaptureManager] isCapturing].

Definition at line 528 of file context_mtl.mm.

528  {
529  return scope_active_;
530 }

◆ FinishCapture()

void impeller::ImpellerMetalCaptureManager::FinishCapture ( )

End the current capture scope.

Definition at line 540 of file context_mtl.mm.

540  {
541  FML_DCHECK(scope_active_);
542  [current_capture_scope_ endScope];
543  scope_active_ = false;
544 }

◆ StartCapture()

void impeller::ImpellerMetalCaptureManager::StartCapture ( )

Begin a new capture scope, no-op if the scope has already started.

Definition at line 532 of file context_mtl.mm.

532  {
533  if (scope_active_) {
534  return;
535  }
536  scope_active_ = true;
537  [current_capture_scope_ beginScope];
538 }

The documentation for this class was generated from the following files: