Flutter Linux Embedder
fl_gl_fence.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_GL_FENCE_H_
6 #define FLUTTER_SHELL_PLATFORM_LINUX_FL_GL_FENCE_H_
7 
8 #include <epoxy/egl.h>
9 #include <glib-object.h>
10 
12 
13 G_BEGIN_DECLS
14 
15 G_DECLARE_FINAL_TYPE(FlGLFence, fl_gl_fence, FL, GL_FENCE, GObject)
16 
17 /**
18  * FlGLFence:
19  *
20  * #FlGLFence marks a point in the OpenGL command stream that can be waited on,
21  * which is how rendering done in one context is made visible to another.
22  * Flushing a context only guarantees its commands have been submitted, not that
23  * they have completed, so a texture rendered in one context can't be used in
24  * another until a fence taken after the rendering has been reached.
25  */
26 
27 /**
28  * fl_gl_fence_new:
29  * @opengl_manager: an #FlOpenGLManager.
30  *
31  * Creates a fence that is reached when the commands submitted to the current
32  * OpenGL context so far have completed. Requires the context that did the
33  * rendering to be current.
34  *
35  * Only use this if fl_opengl_manager_can_fence() returns %TRUE; drivers without
36  * fences have to fall back to waiting for the rendering to complete, e.g. with
37  * glFinish().
38  *
39  * If the fence can't be created a warning is generated and an #FlGLFence that
40  * is not waited for is returned.
41  *
42  * Returns: a new #FlGLFence.
43  */
44 FlGLFence* fl_gl_fence_new(FlOpenGLManager* opengl_manager);
45 
46 /**
47  * fl_gl_fence_wait:
48  * @fence: an #FlGLFence.
49  *
50  * Makes the current OpenGL context wait for @fence before executing any
51  * commands submitted after this point. Requires the context that is going to
52  * use the rendered texture to be current.
53  *
54  * This doesn't block the calling thread, the waiting is done by OpenGL. Falls
55  * back to blocking the calling thread if the driver can't wait this way.
56  */
57 void fl_gl_fence_wait(FlGLFence* fence);
58 
59 G_END_DECLS
60 
61 #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_GL_FENCE_H_
G_BEGIN_DECLS G_DECLARE_FINAL_TYPE(FlAccessibilityChannel, fl_accessibility_channel, FL, ACCESSIBILITY_CHANNEL, GObject)
G_BEGIN_DECLS FlGLFence * fl_gl_fence_new(FlOpenGLManager *opengl_manager)
Definition: fl_gl_fence.cc:50
void fl_gl_fence_wait(FlGLFence *fence)
Definition: fl_gl_fence.cc:84