Flutter Impeller
impeller::interop::Context Class Referencefinal

#include <context.h>

Inheritance diagram for impeller::interop::Context:
impeller::interop::Object< Context, IMPELLER_INTERNAL_HANDLE_NAME(ImpellerContext)> impeller::interop::ObjectBase

Classes

class  BackendData
 

Public Member Functions

 Context (std::shared_ptr< impeller::Context > context, std::shared_ptr< BackendData > backend_data)
 
 ~Context () override
 
 Context (const Context &)=delete
 
Contextoperator= (const Context &)=delete
 
bool IsValid () const
 
std::shared_ptr< impeller::ContextGetContext () const
 
AiksContextGetAiksContext ()
 
- Public Member Functions inherited from impeller::interop::ObjectBase
 ObjectBase ()=default
 
virtual ~ObjectBase ()=default
 
 ObjectBase (const ObjectBase &)=delete
 
 ObjectBase (ObjectBase &&)=delete
 
ObjectBaseoperator= (const ObjectBase &)=delete
 
ObjectBaseoperator= (ObjectBase &&)=delete
 
void Retain ()
 
void Release ()
 
uint64_t GetRefCountForTests () const
 

Static Public Member Functions

static ScopedObject< ContextCreateOpenGLES (std::function< void *(const char *gl_proc_name)> proc_address_callback)
 
- Static Public Member Functions inherited from impeller::interop::ObjectBase
static void SafeRetain (void *ptr)
 
static void SafeRelease (void *ptr)
 

Additional Inherited Members

- Public Types inherited from impeller::interop::Object< Context, IMPELLER_INTERNAL_HANDLE_NAME(ImpellerContext)>
using InteropClass = Context
 
using InteropCSibling = IMPELLER_INTERNAL_HANDLE_NAME(ImpellerContext)
 

Detailed Description

Definition at line 17 of file context.h.

Constructor & Destructor Documentation

◆ Context() [1/2]

impeller::interop::Context::Context ( std::shared_ptr< impeller::Context context,
std::shared_ptr< BackendData backend_data 
)
explicit

Definition at line 26 of file context.cc.

28  : context_(std::move(context), TypographerContextSkia::Make()),
29  backend_data_(std::move(backend_data)) {}

◆ ~Context()

impeller::interop::Context::~Context ( )
overridedefault

◆ Context() [2/2]

impeller::interop::Context::Context ( const Context )
delete

Member Function Documentation

◆ CreateOpenGLES()

ScopedObject< Context > impeller::interop::Context::CreateOpenGLES ( std::function< void *(const char *gl_proc_name)>  proc_address_callback)
static

Definition at line 65 of file context.cc.

66  {
67 #if IMPELLER_ENABLE_OPENGLES
68  auto proc_table = std::make_unique<ProcTableGLES>(
69  impeller::ProcTableGLES(std::move(proc_address_callback)));
70  if (!proc_table || !proc_table->IsValid()) {
71  VALIDATION_LOG << "Could not create valid OpenGL ES proc. table.";
72  return {};
73  }
74  std::vector<std::shared_ptr<fml::Mapping>> shader_mappings = {
75  std::make_shared<fml::NonOwnedMapping>(
76  impeller_entity_shaders_gles_data,
77  impeller_entity_shaders_gles_length),
78  std::make_shared<fml::NonOwnedMapping>(
79  impeller_framebuffer_blend_shaders_gles_data,
80  impeller_framebuffer_blend_shaders_gles_length),
81  };
82  auto impeller_context =
83  ContextGLES::Create(std::move(proc_table), shader_mappings, false);
84  if (!impeller_context) {
85  VALIDATION_LOG << "Could not create Impeller context.";
86  return {};
87  }
88  auto reactor_worker = std::make_shared<ReactorWorker>();
89  auto worker_id = impeller_context->AddReactorWorker(reactor_worker);
90  if (!worker_id.has_value()) {
91  VALIDATION_LOG << "Could not add reactor worker.";
92  return {};
93  }
94  auto context =
95  Create<Context>(std::move(impeller_context), std::move(reactor_worker));
96  if (!context->IsValid()) {
97  VALIDATION_LOG << "Could not create valid context.";
98  return {};
99  }
100  return context;
101 #else // IMPELLER_ENABLE_OPENGLES
102  VALIDATION_LOG << "This build does not support OpenGL ES contexts.";
103  return {};
104 #endif // IMPELLER_ENABLE_OPENGLES
105 }

References impeller::ContextGLES::Create(), and VALIDATION_LOG.

Referenced by impeller::interop::ImpellerContextCreateOpenGLESNew().

◆ GetAiksContext()

AiksContext & impeller::interop::Context::GetAiksContext ( )

Definition at line 107 of file context.cc.

107  {
108  return context_;
109 }

◆ GetContext()

std::shared_ptr< impeller::Context > impeller::interop::Context::GetContext ( ) const

Definition at line 37 of file context.cc.

37  {
38  return context_.GetContext();
39 }

References impeller::AiksContext::GetContext().

Referenced by impeller::interop::Texture::Texture(), and impeller::interop::Surface::WrapFBO().

◆ IsValid()

bool impeller::interop::Context::IsValid ( ) const

Definition at line 33 of file context.cc.

33  {
34  return context_.IsValid();
35 }

References impeller::AiksContext::IsValid().

Referenced by impeller::interop::Texture::Texture().

◆ operator=()

Context& impeller::interop::Context::operator= ( const Context )
delete

The documentation for this class was generated from the following files:
impeller::ContextGLES::Create
static std::shared_ptr< ContextGLES > Create(std::unique_ptr< ProcTableGLES > gl, const std::vector< std::shared_ptr< fml::Mapping >> &shader_libraries, bool enable_gpu_tracing)
Definition: context_gles.cc:16
impeller::ProcTableGLES
Definition: proc_table_gles.h:226
impeller::AiksContext::GetContext
std::shared_ptr< Context > GetContext() const
Definition: aiks_context.cc:38
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:91
impeller::TypographerContextSkia::Make
static std::shared_ptr< TypographerContext > Make()
Definition: typographer_context_skia.cc:75
impeller::AiksContext::IsValid
bool IsValid() const
Definition: aiks_context.cc:34