17#include "third_party/dart/runtime/bin/elf_loader.h"
27 .make_current = [](
void* context) ->
bool {
31 .clear_current = [](
void* context) ->
bool {
35 .make_resource_current = [](
void* context) ->
bool {
37 ->GLMakeResourceCurrent();
39 .fbo_reset_after_present =
true,
44 .gl_proc_resolver = [](
void* context,
const char*
name) ->
void* {
48 .fbo_with_frame_info_callback =
51 ->GLGetFramebuffer(*frame_info);
53 .present_with_info = [](
void* context,
58 .populate_existing_damage =
nullptr,
95bool EmbedderTestContextGL::GLMakeCurrent() {
96 FML_CHECK(gl_surface_) <<
"GL surface must be initialized.";
97 return gl_surface_->MakeCurrent();
100bool EmbedderTestContextGL::GLClearCurrent() {
101 FML_CHECK(gl_surface_) <<
"GL surface must be initialized.";
102 return gl_surface_->ClearCurrent();
106 FML_CHECK(gl_surface_) <<
"GL surface must be initialized.";
107 gl_surface_present_count_++;
111 std::scoped_lock lock(gl_callback_mutex_);
120 [&]() {
return gl_surface_->GetRasterSurfaceSnapshot(); });
122 return gl_surface_->Present();
127 std::scoped_lock lock(gl_callback_mutex_);
133 std::scoped_lock lock(gl_callback_mutex_);
134 gl_populate_existing_damage_callback_ = std::move(
callback);
138 std::scoped_lock lock(gl_callback_mutex_);
139 gl_present_callback_ = std::move(
callback);
142uint32_t EmbedderTestContextGL::GLGetFramebuffer(
FlutterFrameInfo frame_info) {
143 FML_CHECK(gl_surface_) <<
"GL surface must be initialized.";
147 std::scoped_lock lock(gl_callback_mutex_);
156 return gl_surface_->GetFramebuffer(
size.width,
size.height);
162 FML_CHECK(gl_surface_) <<
"GL surface must be initialized.";
166 std::scoped_lock lock(gl_callback_mutex_);
167 callback = gl_populate_existing_damage_callback_;
175bool EmbedderTestContextGL::GLMakeResourceCurrent() {
176 FML_CHECK(gl_surface_) <<
"GL surface must be initialized.";
177 return gl_surface_->MakeResourceCurrent();
181 FML_CHECK(gl_surface_) <<
"GL surface must be initialized.";
182 return gl_surface_->GetProcAddress(
name);
186 return gl_surface_present_count_;
195 return gl_surface_->GetWindowFBOId();
198void EmbedderTestContextGL::SetSurface(
DlISize surface_size) {
200 gl_surface_ = std::make_unique<TestGLSurface>(egl_context_, surface_size);
203void EmbedderTestContextGL::SetupCompositor() {
206 <<
"Set up the GL surface before setting up a compositor.";
207 compositor_ = std::make_unique<EmbedderTestCompositorGL>(
208 egl_context_, gl_surface_->GetSurfaceSize(), gl_surface_->GetGrContext());
void SetOpenGLPresentCallBack()
std::function< void(FlutterPresentInfo present_info)> GLPresentCallback
void * GLGetProcAddress(const char *name)
void SetOpenGLFBOCallBack()
size_t GetSurfacePresentCount() const override
void GLPopulateExistingDamage(const intptr_t id, FlutterDamage *existing_damage)
uint32_t GetWindowFBOId() const
~EmbedderTestContextGL() override
EmbedderTestContextType GetContextType() const override
void SetGLPopulateExistingDamageCallback(GLPopulateExistingDamageCallback callback)
std::function< void(FlutterFrameInfo frame_info)> GLGetFBOCallback
void SetGLGetFBOCallback(const GLGetFBOCallback &callback)
Sets a callback that will be invoked (on the raster task runner) when the engine asks the embedder fo...
void SetGLPresentCallback(GLPresentCallback callback)
Sets a callback that will be invoked (on the raster task runner) when the engine presents an fbo that...
std::function< void(intptr_t id, FlutterDamage *existing_damage)> GLPopulateExistingDamageCallback
EmbedderTestContextGL(std::string assets_path="")
FlutterTransformation GetRootSurfaceTransformation()
FlutterRendererConfig renderer_config_
std::unique_ptr< EmbedderTestCompositor > compositor_
void FireRootSurfacePresentCallbackIfPresent(const std::function< sk_sp< SkImage >(void)> &image_callback)
FlutterDesktopBinaryReply callback
#define FML_CHECK(condition)
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
DEF_SWITCHES_START aot vmservice shared library name
A structure to represent a damage region.
size_t struct_size
The size of this struct. Must be sizeof(FlutterFrameInfo).
FlutterUIntSize size
The size of the surface that will be backed by the fbo.
UIntCallback fbo_callback
size_t struct_size
The size of this struct. Must be sizeof(FlutterOpenGLRendererConfig).
uint32_t fbo_id
Id of the fbo backing the surface that was presented.
FlutterOpenGLRendererConfig open_gl