Flutter Linux Embedder
fl_compositor_opengl.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_LINUX_FL_COMPOSITOR_OPENGL_H_
6 #define FLUTTER_SHELL_PLATFORM_LINUX_FL_COMPOSITOR_OPENGL_H_
7 
8 #include <gtk/gtk.h>
9 
10 #include "flutter/shell/platform/embedder/embedder.h"
13 
14 G_BEGIN_DECLS
15 
16 G_DECLARE_FINAL_TYPE(FlCompositorOpenGL,
17  fl_compositor_opengl,
18  FL,
19  COMPOSITOR_OPENGL,
20  GObject)
21 
22 /**
23  * FlCompositorOpenGL:
24  *
25  * #FlCompositorOpenGL is a class that implements compositing using OpenGL.
26  *
27  * Layers are composited into the OpenGL framebuffer bound to the current
28  * OpenGL context. The caller is responsible for binding the target framebuffer
29  * and for reading the composited frame back if required.
30  */
31 
32 /**
33  * fl_compositor_opengl_new:
34  * @opengl_manager: an #FlOpenGLManager
35  *
36  * Creates a new OpenGL compositor.
37  *
38  * Returns: a new #FlCompositorOpenGL.
39  */
40 FlCompositorOpenGL* fl_compositor_opengl_new(FlOpenGLManager* opengl_manager);
41 
42 /**
43  * fl_compositor_opengl_get_opengl_manager:
44  * @compositor: an #FlCompositorOpenGL.
45  *
46  * Gets the OpenGL manager the frames are composited with.
47  *
48  * Returns: an #FlOpenGLManager.
49  */
51  FlCompositorOpenGL* compositor);
52 
53 /**
54  * fl_compositor_opengl_can_fence:
55  * @compositor: an #FlCompositorOpenGL.
56  *
57  * Checks whether fences can be used to synchronize a composited frame with the
58  * context that presents it. Callers have to fall back to waiting for the
59  * rendering to complete, e.g. with glFinish(), when this returns %FALSE.
60  *
61  * Returns: %TRUE if fences are available.
62  */
63 gboolean fl_compositor_opengl_can_fence(FlCompositorOpenGL* compositor);
64 
65 /**
66  * fl_compositor_opengl_composite_layers:
67  * @compositor: an #FlCompositorOpenGL.
68  * @layers: layers to be composited.
69  * @layers_count: number of layers.
70  *
71  * Composite @layers into the OpenGL framebuffer bound to the current OpenGL
72  * context. The caller is responsible for binding the target framebuffer before
73  * calling this function.
74  */
75 void fl_compositor_opengl_composite_layers(FlCompositorOpenGL* compositor,
76  const FlutterLayer** layers,
77  size_t layers_count);
78 
79 /**
80  * fl_compositor_opengl_get_frame_format:
81  * @layers: layers the frame is composited from.
82  * @layers_count: number of layers.
83  *
84  * Gets the texture format to composite @layers into. This matches the format
85  * the engine rendered them with, so the composited frame can be read back
86  * correctly. Compositing into a mismatched format produces an empty frame.
87  *
88  * Returns: a texture format, e.g. GL_RGBA or GL_BGRA_EXT.
89  */
90 GLint fl_compositor_opengl_get_frame_format(const FlutterLayer** layers,
91  size_t layers_count);
92 
93 G_END_DECLS
94 
95 #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_COMPOSITOR_OPENGL_H_
FlCompositorOpenGL * fl_compositor_opengl_new(FlOpenGLManager *opengl_manager)
G_BEGIN_DECLS G_DECLARE_FINAL_TYPE(FlCompositorOpenGL, fl_compositor_opengl, FL, COMPOSITOR_OPENGL, GObject) FlCompositorOpenGL *fl_compositor_opengl_new(FlOpenGLManager *opengl_manager)
void fl_compositor_opengl_composite_layers(FlCompositorOpenGL *compositor, const FlutterLayer **layers, size_t layers_count)
gboolean fl_compositor_opengl_can_fence(FlCompositorOpenGL *compositor)
FlOpenGLManager * fl_compositor_opengl_get_opengl_manager(FlCompositorOpenGL *compositor)
GLint fl_compositor_opengl_get_frame_format(const FlutterLayer **layers, size_t layers_count)
const FlutterLayer size_t layers_count
const FlutterLayer ** layers