-
Notifications
You must be signed in to change notification settings - Fork 6k
[embedder] Add FBO callback that takes frame info #20617
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -306,12 +306,46 @@ typedef bool (*TextureFrameCallback)(void* /* user data */, | |
| FlutterOpenGLTexture* /* texture out */); | ||
| typedef void (*VsyncCallback)(void* /* user data */, intptr_t /* baton */); | ||
|
|
||
| /// A structure to represent the width and height. | ||
| typedef struct { | ||
| double width; | ||
| double height; | ||
| } FlutterSize; | ||
|
|
||
| /// A structure to represent the width and height. | ||
| /// | ||
| /// See: \ref FlutterSize when the value are not integers. | ||
| typedef struct { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needs a declaration comment.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This struct should start with a size in case we want to add more information to it in the future.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| uint32_t width; | ||
| uint32_t height; | ||
| } FlutterUIntSize; | ||
|
|
||
| /// This information is passed to the embedder when requesting a frame buffer | ||
| /// object. | ||
| /// | ||
| /// See: \ref FlutterSoftwareRendererConfig.fbo_with_frame_info_callback. | ||
| typedef struct { | ||
| /// The size of this struct. Must be sizeof(FlutterFrameInfo). | ||
| size_t struct_size; | ||
| /// The size of the surface that will be backed by the fbo. | ||
| FlutterUIntSize size; | ||
| } FlutterFrameInfo; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like something we can reuse later. How about
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you foresee a case where this object will be need to expanded? If so,
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
|
||
| typedef uint32_t (*UIntFrameInfoCallback)( | ||
| void* /* user data */, | ||
| const FlutterFrameInfo* /* frame info */); | ||
|
|
||
| typedef struct { | ||
| /// The size of this struct. Must be sizeof(FlutterOpenGLRendererConfig). | ||
| size_t struct_size; | ||
| BoolCallback make_current; | ||
| BoolCallback clear_current; | ||
| BoolCallback present; | ||
| /// Specifying one (and only one) of the `fbo_callback` or | ||
| /// `fbo_with_frame_info_callback` is required. Specifying both is an error | ||
| /// and engine intialization will be terminated. The return value indicates | ||
| /// the id of the frame buffer object that flutter will obtain the gl surface | ||
| /// from. | ||
| UIntCallback fbo_callback; | ||
| /// This is an optional callback. Flutter will ask the emebdder to create a GL | ||
| /// context current on a background thread. If the embedder is able to do so, | ||
|
|
@@ -342,6 +376,14 @@ typedef struct { | |
| /// that external texture details can be supplied to the engine for subsequent | ||
| /// composition. | ||
| TextureFrameCallback gl_external_texture_frame_callback; | ||
| /// Specifying one (and only one) of the `fbo_callback` or | ||
| /// `fbo_with_frame_info_callback` is required. Specifying both is an error | ||
| /// and engine intialization will be terminated. The return value indicates | ||
| /// the id of the frame buffer object (fbo) that flutter will obtain the gl | ||
| /// surface from. When using this variant, the embedder is passed a | ||
| /// `FlutterFrameInfo` struct that indicates the properties of the surface | ||
| /// that flutter will acquire from the returned fbo. | ||
| UIntFrameInfoCallback fbo_with_frame_info_callback; | ||
| } FlutterOpenGLRendererConfig; | ||
|
|
||
| typedef struct { | ||
|
|
@@ -502,11 +544,6 @@ typedef struct { | |
| double y; | ||
| } FlutterPoint; | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: maybe move FlutterRect, FlutterPoint, and FLutterRoundedRect up as well so these similar structs all remain together. |
||
| typedef struct { | ||
| double width; | ||
| double height; | ||
| } FlutterSize; | ||
|
|
||
| typedef struct { | ||
| FlutterRect rect; | ||
| FlutterSize upper_left_corner_radius; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,6 +79,9 @@ class EmbedderTestContext { | |
|
|
||
| size_t GetSoftwareSurfacePresentCount() const; | ||
|
|
||
| // Returns the frame information for all the frames that were rendered. | ||
| std::vector<FlutterFrameInfo> GetGLFBOFrameInfos(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a declaration comment, since the implementation isn't inline to make it obvious what it does. (Or, alternately, comment the ivar.)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
|
||
| private: | ||
| // This allows the builder to access the hooks. | ||
| friend class EmbedderConfigBuilder; | ||
|
|
@@ -101,6 +104,7 @@ class EmbedderTestContext { | |
| std::unique_ptr<EmbedderTestCompositor> compositor_; | ||
| NextSceneCallback next_scene_callback_; | ||
| SkMatrix root_surface_transformation_; | ||
| std::vector<FlutterFrameInfo> gl_surface_fbo_frame_infos_; | ||
| size_t gl_surface_present_count_ = 0; | ||
| size_t software_surface_present_count_ = 0; | ||
|
|
||
|
|
@@ -133,7 +137,7 @@ class EmbedderTestContext { | |
|
|
||
| bool GLPresent(); | ||
|
|
||
| uint32_t GLGetFramebuffer(); | ||
| uint32_t GLGetFramebuffer(FlutterFrameInfo frame_info); | ||
|
|
||
| bool GLMakeResourceCurrent(); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a declaration comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done