Flutter Linux Embedder
fl_framebuffer.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_FRAMEBUFFER_H_
6 #define FLUTTER_SHELL_PLATFORM_LINUX_FL_FRAMEBUFFER_H_
7 
8 #include <epoxy/gl.h>
9 #include <glib-object.h>
10 
11 G_BEGIN_DECLS
12 
13 G_DECLARE_FINAL_TYPE(FlFramebuffer, fl_framebuffer, FL, FRAMEBUFFER, GObject)
14 
15 /**
16  * FlFramebuffer:
17  *
18  * #FlFramebuffer creates framebuffers and their backing textures
19  * for use by the Flutter compositor.
20  */
21 
22 /**
23  * fl_framebuffer_new:
24  * @format: format, e.g. GL_RGB, GL_BGR
25  * @width: width of texture.
26  * @height: height of texture.
27  * @depth_stencil: %TRUE to attach a depth/stencil buffer, which is required to
28  * render into this framebuffer.
29  *
30  * Creates a new frame buffer. Requires a valid OpenGL context to create.
31  *
32  * Returns: a new #FlFramebuffer.
33  */
34 FlFramebuffer* fl_framebuffer_new(GLint format,
35  size_t width,
36  size_t height,
37  gboolean depth_stencil);
38 
39 /**
40  * fl_framebuffer_new_multisample:
41  * @format: texture format, e.g. GL_RGBA, GL_BGRA_EXT.
42  * @width: width of framebuffer in pixels.
43  * @height: height of framebuffer in pixels.
44  * @use_msaa: %TRUE to enable multisample anti-aliasing (MSAA) attachments.
45  *
46  * Creates a new frame buffer, configuring MSAA attachments if supported and
47  * @use_msaa is %TRUE.
48  *
49  * When @use_msaa is %TRUE, the framebuffer will configure 4x MSAA attachments
50  * using either implicit MSAA (multisampled texture via
51  * GL_EXT_multisampled_render_to_texture) with the requested @format or
52  * offscreen MSAA (multisample color renderbuffer). If offscreen MSAA is used,
53  * the framebuffer is backed by a GL_RGBA8 renderbuffer instead of a texture
54  * (fl_framebuffer_get_texture_id() returns 0) and must be resolved into a
55  * single-sample texture via glBlitFramebuffer before compositing.
56  *
57  * If @use_msaa is %FALSE or MSAA is not supported by the OpenGL context, a
58  * standard single-sample texture with @format and depth/stencil renderbuffer
59  * are created.
60  *
61  * Returns: a new #FlFramebuffer.
62  */
63 FlFramebuffer* fl_framebuffer_new_multisample(GLint format,
64  size_t width,
65  size_t height,
66  gboolean use_msaa);
67 
68 /**
69  * fl_framebuffer_get_id:
70  * @framebuffer: an #FlFramebuffer.
71  *
72  * Gets the ID for this framebuffer.
73  *
74  * Returns: OpenGL framebuffer id or 0 if creation failed.
75  */
76 GLuint fl_framebuffer_get_id(FlFramebuffer* framebuffer);
77 
78 /**
79  * fl_framebuffer_get_texture_id:
80  * @framebuffer: an #FlFramebuffer.
81  *
82  * Gets the ID of the texture associated with this framebuffer.
83  *
84  * Returns: OpenGL texture id or 0 if creation failed.
85  */
86 GLuint fl_framebuffer_get_texture_id(FlFramebuffer* framebuffer);
87 
88 /**
89  * fl_framebuffer_get_width:
90  * @framebuffer: an #FlFramebuffer.
91  *
92  * Gets the width of the framebuffer in pixels.
93  *
94  * Returns: width in pixels.
95  */
96 size_t fl_framebuffer_get_width(FlFramebuffer* framebuffer);
97 
98 /**
99  * fl_framebuffer_get_height:
100  * @framebuffer: an #FlFramebuffer.
101  *
102  * Gets the height of the framebuffer in pixels.
103  *
104  * Returns: height in pixels.
105  */
106 size_t fl_framebuffer_get_height(FlFramebuffer* framebuffer);
107 
108 G_END_DECLS
109 
110 #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_FRAMEBUFFER_H_
G_BEGIN_DECLS G_DECLARE_FINAL_TYPE(FlAccessibilityChannel, fl_accessibility_channel, FL, ACCESSIBILITY_CHANNEL, GObject)
size_t fl_framebuffer_get_height(FlFramebuffer *framebuffer)
size_t fl_framebuffer_get_width(FlFramebuffer *framebuffer)
GLuint fl_framebuffer_get_texture_id(FlFramebuffer *framebuffer)
G_BEGIN_DECLS FlFramebuffer * fl_framebuffer_new(GLint format, size_t width, size_t height, gboolean depth_stencil)
FlFramebuffer * fl_framebuffer_new_multisample(GLint format, size_t width, size_t height, gboolean use_msaa)
GLuint fl_framebuffer_get_id(FlFramebuffer *framebuffer)
const uint8_t uint32_t uint32_t * height
const uint8_t uint32_t * width
uint32_t uint32_t * format