Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
flutter::EmbedderSurfaceGLImpeller Class Referencefinal

#include <embedder_surface_gl_impeller.h>

Inheritance diagram for flutter::EmbedderSurfaceGLImpeller:
flutter::EmbedderSurface flutter::GPUSurfaceGLDelegate

Public Member Functions

 EmbedderSurfaceGLImpeller (EmbedderSurfaceGLSkia::GLDispatchTable gl_dispatch_table, bool fbo_reset_after_present, std::shared_ptr< EmbedderExternalViewEmbedder > external_view_embedder)
 
 ~EmbedderSurfaceGLImpeller () override
 
- Public Member Functions inherited from flutter::EmbedderSurface
 EmbedderSurface ()
 
virtual ~EmbedderSurface ()
 
virtual bool IsValid () const =0
 
virtual std::unique_ptr< SurfaceCreateGPUSurface ()=0
 
virtual std::shared_ptr< impeller::ContextCreateImpellerContext () const
 
virtual sk_sp< GrDirectContextCreateResourceContext () const
 
- Public Member Functions inherited from flutter::GPUSurfaceGLDelegate
 ~GPUSurfaceGLDelegate ()
 
virtual std::unique_ptr< GLContextResultGLContextMakeCurrent ()=0
 
virtual bool GLContextClearCurrent ()=0
 
virtual void GLContextSetDamageRegion (const std::optional< SkIRect > &region)
 
virtual bool GLContextPresent (const GLPresentInfo &present_info)=0
 
virtual GLFBOInfo GLContextFBO (GLFrameInfo frame_info) const =0
 
virtual bool GLContextFBOResetAfterPresent () const
 
virtual SurfaceFrame::FramebufferInfo GLContextFramebufferInfo () const
 
virtual SkMatrix GLContextSurfaceTransformation () const
 
virtual sk_sp< const GrGLInterfaceGetGLInterface () const
 
virtual GLProcResolver GetGLProcResolver () const
 
virtual bool AllowsDrawingWhenGpuDisabled () const
 

Additional Inherited Members

- Public Types inherited from flutter::GPUSurfaceGLDelegate
using GLProcResolver = std::function< void *(const char *)>
 
- Static Public Member Functions inherited from flutter::GPUSurfaceGLDelegate
static sk_sp< const GrGLInterfaceGetDefaultPlatformGLInterface ()
 

Detailed Description

Definition at line 22 of file embedder_surface_gl_impeller.h.

Constructor & Destructor Documentation

◆ EmbedderSurfaceGLImpeller()

flutter::EmbedderSurfaceGLImpeller::EmbedderSurfaceGLImpeller ( EmbedderSurfaceGLSkia::GLDispatchTable  gl_dispatch_table,
bool  fbo_reset_after_present,
std::shared_ptr< EmbedderExternalViewEmbedder external_view_embedder 
)

Definition at line 48 of file embedder_surface_gl_impeller.cc.

52 : gl_dispatch_table_(std::move(gl_dispatch_table)),
53 fbo_reset_after_present_(fbo_reset_after_present),
54 external_view_embedder_(std::move(external_view_embedder)),
55 worker_(std::make_shared<ReactorWorker>()) {
56 // Make sure all required members of the dispatch table are checked.
57 if (!gl_dispatch_table_.gl_make_current_callback ||
58 !gl_dispatch_table_.gl_clear_current_callback ||
59 !gl_dispatch_table_.gl_present_callback ||
60 !gl_dispatch_table_.gl_fbo_callback ||
61 !gl_dispatch_table_.gl_populate_existing_damage ||
62 !gl_dispatch_table_.gl_proc_resolver) {
63 return;
64 }
65 // Certain GL backends need to made current before any GL
66 // state can be accessed.
67 gl_dispatch_table_.gl_make_current_callback();
68
69 std::vector<std::shared_ptr<fml::Mapping>> shader_mappings = {
70 std::make_shared<fml::NonOwnedMapping>(
71 impeller_entity_shaders_gles_data,
72 impeller_entity_shaders_gles_length),
73 std::make_shared<fml::NonOwnedMapping>(
74 impeller_modern_shaders_gles_data,
75 impeller_modern_shaders_gles_length),
76 std::make_shared<fml::NonOwnedMapping>(
77 impeller_framebuffer_blend_shaders_gles_data,
78 impeller_framebuffer_blend_shaders_gles_length),
79#if IMPELLER_ENABLE_3D
80 std::make_shared<fml::NonOwnedMapping>(
81 impeller_scene_shaders_gles_data, impeller_scene_shaders_gles_length),
82#endif // IMPELLER_ENABLE_3D
83 };
84 auto gl = std::make_unique<impeller::ProcTableGLES>(
85 gl_dispatch_table_.gl_proc_resolver);
86 if (!gl->IsValid()) {
87 return;
88 }
89
90 impeller_context_ = impeller::ContextGLES::Create(
91 std::move(gl), shader_mappings, /*enable_gpu_tracing=*/false);
92
93 if (!impeller_context_) {
94 FML_LOG(ERROR) << "Could not create Impeller context.";
95 return;
96 }
97
98 auto worker_id = impeller_context_->AddReactorWorker(worker_);
99 if (!worker_id.has_value()) {
100 FML_LOG(ERROR) << "Could not add reactor worker.";
101 return;
102 }
103
104 gl_dispatch_table_.gl_clear_current_callback();
105 FML_LOG(IMPORTANT) << "Using the Impeller rendering backend (OpenGL).";
106 valid_ = true;
107}
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
#define FML_LOG(severity)
Definition: logging.h:82
gl
Definition: malisc.py:41
std::function< GLFBOInfo(intptr_t)> gl_populate_existing_damage
std::function< intptr_t(GLFrameInfo)> gl_fbo_callback
std::function< bool(GLPresentInfo)> gl_present_callback
std::function< void *(const char *)> gl_proc_resolver
#define ERROR(message)
Definition: elf_loader.cc:260

◆ ~EmbedderSurfaceGLImpeller()

flutter::EmbedderSurfaceGLImpeller::~EmbedderSurfaceGLImpeller ( )
overridedefault

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