Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
flutter::TesterContextMTL Class Reference
Inheritance diagram for flutter::TesterContextMTL:
flutter::TesterContext

Public Member Functions

 TesterContextMTL ()=default
 
 ~TesterContextMTL () override
 
bool Initialize ()
 
std::shared_ptr< impeller::ContextGetImpellerContext () const override
 
std::unique_ptr< SurfaceCreateRenderingSurface () override
 
- Public Member Functions inherited from flutter::TesterContext
virtual ~TesterContext ()=default
 

Detailed Description

Definition at line 73 of file tester_context_mtl_factory.mm.

Constructor & Destructor Documentation

◆ TesterContextMTL()

flutter::TesterContextMTL::TesterContextMTL ( )
default

◆ ~TesterContextMTL()

flutter::TesterContextMTL::~TesterContextMTL ( )
inlineoverride

Definition at line 77 of file tester_context_mtl_factory.mm.

77 {
78 if (context_) {
79 context_->Shutdown();
80 }
81 }

Member Function Documentation

◆ CreateRenderingSurface()

std::unique_ptr< Surface > flutter::TesterContextMTL::CreateRenderingSurface ( )
inlineoverridevirtual

Implements flutter::TesterContext.

Definition at line 111 of file tester_context_mtl_factory.mm.

111 {
112 auto surface = std::make_unique<GPUSurfaceMetalImpeller>(delegate_.get(), aiks_context_);
113 if (!surface->IsValid()) {
114 return nullptr;
115 }
116 return surface;
117 }
VkSurfaceKHR surface
Definition main.cc:65

References surface.

◆ GetImpellerContext()

std::shared_ptr< impeller::Context > flutter::TesterContextMTL::GetImpellerContext ( ) const
inlineoverridevirtual

Implements flutter::TesterContext.

Definition at line 108 of file tester_context_mtl_factory.mm.

108{ return context_; }

◆ Initialize()

bool flutter::TesterContextMTL::Initialize ( )
inline

Definition at line 83 of file tester_context_mtl_factory.mm.

83 {
84 std::vector<std::shared_ptr<fml::Mapping>> shader_mappings = ShaderLibraryMappings();
85 auto sync_switch = std::make_shared<fml::SyncSwitch>(false);
86 context_ = impeller::ContextMTL::Create(impeller::Flags{}, shader_mappings, sync_switch,
87 "Impeller Library");
88
89 if (!context_ || !context_->IsValid()) {
90 VALIDATION_LOG << "Could not create Metal context.";
91 return false;
92 }
93
94 auto device = context_->GetMTLDevice();
95 if (!device) {
96 VALIDATION_LOG << "Could not get Metal device.";
97 return false;
98 }
99
100 delegate_ = std::make_unique<TesterGPUSurfaceMetalDelegate>(device);
101 aiks_context_ = std::make_shared<impeller::AiksContext>(
102 context_, /*typographer_context=*/impeller::TypographerContextSkia::Make());
103
104 return true;
105 }
static std::shared_ptr< ContextMTL > Create(const Flags &flags, const std::vector< std::string > &shader_library_paths, std::shared_ptr< const fml::SyncSwitch > is_gpu_disabled_sync_switch)
static std::shared_ptr< TypographerContext > Make()
VkDevice device
Definition main.cc:69
#define VALIDATION_LOG
Definition validation.h:91

References impeller::ContextMTL::Create(), device, impeller::TypographerContextSkia::Make(), and VALIDATION_LOG.


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