Flutter Engine
 
Loading...
Searching...
No Matches
embedder_test_context_gl.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_TEST_CONTEXT_GL_H_
6#define FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_TEST_CONTEXT_GL_H_
7
9
12
13namespace flutter {
14namespace testing {
15
17 public:
18 using GLGetFBOCallback = std::function<void(FlutterFrameInfo frame_info)>;
20 std::function<void(intptr_t id, FlutterDamage* existing_damage)>;
22 std::function<void(FlutterPresentInfo present_info)>;
23
24 explicit EmbedderTestContextGL(std::string assets_path = "");
25
26 ~EmbedderTestContextGL() override;
27
28 size_t GetSurfacePresentCount() const override;
29
30 // |EmbedderTestContext|
32
33 // Used to explicitly set an `open_gl.fbo_callback`. Using this method will
34 // cause your test to fail since the ctor for this class sets
35 // `open_gl.fbo_callback_with_frame_info`. This method exists as a utility to
36 // explicitly test this behavior.
38
39 // Used to explicitly set an `open_gl.present`. Using this method will cause
40 // your test to fail since the ctor for this class sets
41 // `open_gl.present_with_info`. This method exists as a utility to explicitly
42 // test this behavior.
44
45 //----------------------------------------------------------------------------
46 /// @brief Sets a callback that will be invoked (on the raster task
47 /// runner) when the engine asks the embedder for a new FBO ID at
48 /// the updated size.
49 ///
50 /// @attention The callback will be invoked on the raster task runner. The
51 /// callback can be set on the tests host thread.
52 ///
53 /// @param[in] callback The callback to set. The previous callback will be
54 /// un-registered.
55 ///
57
60
61 uint32_t GetWindowFBOId() const;
62
63 //----------------------------------------------------------------------------
64 /// @brief Sets a callback that will be invoked (on the raster task
65 /// runner) when the engine presents an fbo that was given by the
66 /// embedder.
67 ///
68 /// @attention The callback will be invoked on the raster task runner. The
69 /// callback can be set on the tests host thread.
70 ///
71 /// @param[in] callback The callback to set. The previous callback will be
72 /// un-registered.
73 ///
75
76 void GLPopulateExistingDamage(const intptr_t id,
77 FlutterDamage* existing_damage);
78
79 void* GLGetProcAddress(const char* name);
80
81 private:
82 // |EmbedderTestContext|
83 void SetSurface(DlISize surface_size) override;
84
85 // |EmbedderTestContext|
86 void SetupCompositor() override;
87
88 std::shared_ptr<TestEGLContext> egl_context_;
89 std::unique_ptr<TestGLSurface> gl_surface_;
90 size_t gl_surface_present_count_ = 0;
91 std::mutex gl_callback_mutex_;
92 GLGetFBOCallback gl_get_fbo_callback_;
93 GLPresentCallback gl_present_callback_;
94 GLPopulateExistingDamageCallback gl_populate_existing_damage_callback_;
95
96 bool GLMakeCurrent();
97
98 bool GLClearCurrent();
99
100 bool GLPresent(FlutterPresentInfo present_info);
101
102 uint32_t GLGetFramebuffer(FlutterFrameInfo frame_info);
103
104 bool GLMakeResourceCurrent();
105
107};
108
109} // namespace testing
110} // namespace flutter
111
112#endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_TEST_CONTEXT_GL_H_
std::function< void(FlutterPresentInfo present_info)> GLPresentCallback
void GLPopulateExistingDamage(const intptr_t id, FlutterDamage *existing_damage)
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
FlutterDesktopBinaryReply callback
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
DEF_SWITCHES_START aot vmservice shared library name
Definition switch_defs.h:27
A structure to represent a damage region.
Definition embedder.h:664