#include "fl_renderer.h"
#include <epoxy/egl.h>
#include <epoxy/gl.h>
#include "flutter/shell/platform/embedder/embedder.h"
#include "flutter/shell/platform/linux/fl_backing_store_provider.h"
#include "flutter/shell/platform/linux/fl_engine_private.h"
#include "flutter/shell/platform/linux/fl_view_private.h"
Go to the source code of this file.
Classes | |
struct | FlRendererPrivate |
Functions | |
static gchar * | get_shader_log (GLuint shader) |
static gchar * | get_program_log (GLuint program) |
static GLfloat | pixels_to_gl_coords (GLfloat position, GLfloat pixels) |
Converts a pixel co-ordinate from 0..pixels to OpenGL -1..1. More... | |
static void | fl_renderer_unblock_main_thread (FlRenderer *self) |
static void | fl_renderer_dispose (GObject *object) |
static void | fl_renderer_class_init (FlRendererClass *klass) |
static void | fl_renderer_init (FlRenderer *self) |
gboolean | fl_renderer_start (FlRenderer *self, FlView *view) |
void * | fl_renderer_get_proc_address (FlRenderer *self, const char *name) |
void | fl_renderer_make_current (FlRenderer *self) |
void | fl_renderer_make_resource_current (FlRenderer *self) |
void | fl_renderer_clear_current (FlRenderer *self) |
gdouble | fl_renderer_get_refresh_rate (FlRenderer *self) |
guint32 | fl_renderer_get_fbo (FlRenderer *self) |
gboolean | fl_renderer_create_backing_store (FlRenderer *renderer, const FlutterBackingStoreConfig *config, FlutterBackingStore *backing_store_out) |
gboolean | fl_renderer_collect_backing_store (FlRenderer *self, const FlutterBackingStore *backing_store) |
void | fl_renderer_wait_for_frame (FlRenderer *self, int target_width, int target_height) |
gboolean | fl_renderer_present_layers (FlRenderer *self, const FlutterLayer **layers, size_t layers_count) |
void | fl_renderer_setup (FlRenderer *self) |
void | fl_renderer_render (FlRenderer *self, int width, int height) |
void | fl_renderer_cleanup (FlRenderer *self) |
Variables | |
static const char * | vertex_shader_src |
static const char * | fragment_shader_src |
|
static |
Definition at line 119 of file fl_renderer.cc.
References fl_renderer_dispose().
void fl_renderer_cleanup | ( | FlRenderer * | renderer | ) |
fl_renderer_cleanup:
Removes OpenGL resources used for rendering. Requires an active OpenGL context.
Definition at line 392 of file fl_renderer.cc.
References priv.
Referenced by unrealize_cb().
void fl_renderer_clear_current | ( | FlRenderer * | renderer | ) |
fl_renderer_clear_current: @renderer: an #FlRenderer.
Clears the current rendering context.
Definition at line 155 of file fl_renderer.cc.
Referenced by fl_engine_gl_clear_current().
gboolean fl_renderer_collect_backing_store | ( | FlRenderer * | renderer, |
const FlutterBackingStore * | backing_store | ||
) |
fl_renderer_collect_backing_store: @renderer: an #FlRenderer. @backing_store: backing store to be released.
A callback invoked by the engine to release the backing store. The embedder may collect any resources associated with the backing store.
Returns TRUE if successful.
Definition at line 201 of file fl_renderer.cc.
References fl_renderer_make_current(), and TRUE.
Referenced by compositor_collect_backing_store_callback().
gboolean fl_renderer_create_backing_store | ( | FlRenderer * | renderer, |
const FlutterBackingStoreConfig * | config, | ||
FlutterBackingStore * | backing_store_out | ||
) |
fl_renderer_create_backing_store: @renderer: an #FlRenderer. @config: backing store config. @backing_store_out: saves created backing store.
Obtain a backing store for a specific #FlutterLayer.
Returns TRUE if successful.
Definition at line 172 of file fl_renderer.cc.
References fl_backing_store_provider_get_gl_format(), fl_backing_store_provider_get_gl_framebuffer_id(), fl_backing_store_provider_new(), fl_renderer_make_current(), format, and TRUE.
Referenced by compositor_create_backing_store_callback().
|
static |
Definition at line 107 of file fl_renderer.cc.
References fl_renderer_unblock_main_thread(), and priv.
Referenced by fl_renderer_class_init().
guint32 fl_renderer_get_fbo | ( | FlRenderer * | renderer | ) |
fl_renderer_get_fbo: @renderer: an #FlRenderer.
Gets the frame buffer object to render to.
Returns: a frame buffer object index.
Definition at line 165 of file fl_renderer.cc.
Referenced by fl_engine_gl_get_fbo().
void* fl_renderer_get_proc_address | ( | FlRenderer * | self, |
const char * | name | ||
) |
gdouble fl_renderer_get_refresh_rate | ( | FlRenderer * | renderer | ) |
fl_renderer_get_refresh_rate: @renderer: an #FlRenderer.
Returns: The refresh rate of the display in Hz. If the refresh rate is not available, returns -1.0.
Definition at line 160 of file fl_renderer.cc.
Referenced by fl_engine_start(), and TEST().
|
static |
void fl_renderer_make_current | ( | FlRenderer * | renderer | ) |
fl_renderer_make_current: @renderer: an #FlRenderer.
Makes the rendering context current.
Definition at line 145 of file fl_renderer.cc.
Referenced by fl_engine_gl_make_current(), fl_renderer_collect_backing_store(), fl_renderer_create_backing_store(), realize_cb(), and unrealize_cb().
void fl_renderer_make_resource_current | ( | FlRenderer * | renderer | ) |
fl_renderer_make_resource_current: @renderer: an #FlRenderer.
Makes the resource rendering context current.
Definition at line 150 of file fl_renderer.cc.
Referenced by fl_engine_gl_make_resource_current().
gboolean fl_renderer_present_layers | ( | FlRenderer * | renderer, |
const FlutterLayer ** | layers, | ||
size_t | layers_count | ||
) |
fl_renderer_present_layers: @renderer: an #FlRenderer. @layers: layers to be composited. @layers_count: number of layers.
Callback invoked by the engine to composite the contents of each layer onto the screen.
Returns TRUE if successful.
Definition at line 230 of file fl_renderer.cc.
References fl_renderer_unblock_main_thread(), fl_view_redraw(), i, priv, and TRUE.
Referenced by compositor_present_layers_callback(), and TEST().
void fl_renderer_render | ( | FlRenderer * | renderer, |
int | width, | ||
int | height | ||
) |
fl_renderer_render: @renderer: an #FlRenderer. @width: width of the window in pixels. @height: height of the window in pixels.
Performs OpenGL commands to render current Flutter view.
Definition at line 320 of file fl_renderer.cc.
References fl_backing_store_provider_get_geometry(), fl_backing_store_provider_get_gl_texture_id(), height, i, pixels_to_gl_coords(), priv, texture_id, and width.
Referenced by render_cb(), and TEST().
void fl_renderer_setup | ( | FlRenderer * | renderer | ) |
fl_renderer_setup: @renderer: an #FlRenderer.
Creates OpenGL resources required before rendering. Requires an active OpenGL context.
Definition at line 278 of file fl_renderer.cc.
References fragment_shader_src, get_program_log(), get_shader_log(), priv, and vertex_shader_src.
Referenced by realize_cb().
gboolean fl_renderer_start | ( | FlRenderer * | renderer, |
FlView * | view | ||
) |
fl_renderer_start: @renderer: an #FlRenderer. @view: the view Flutter is renderering to.
Start the renderer.
Returns: TRUE if successfully started.
Definition at line 129 of file fl_renderer.cc.
Referenced by realize_cb(), and TEST().
|
static |
Definition at line 95 of file fl_renderer.cc.
References fl_engine_get_task_runner(), fl_task_runner_release_main_thread(), fl_view_get_engine(), and priv.
Referenced by fl_renderer_dispose(), and fl_renderer_present_layers().
void fl_renderer_wait_for_frame | ( | FlRenderer * | renderer, |
int | target_width, | ||
int | target_height | ||
) |
fl_renderer_wait_for_frame: @renderer: an #FlRenderer. @target_width: width of frame being waited for @target_height: height of frame being waited for
Holds the thread until frame with requested dimensions is presented. While waiting for frame Flutter platform and raster tasks are being processed.
Definition at line 211 of file fl_renderer.cc.
References fl_engine_get_task_runner(), fl_task_runner_block_main_thread(), fl_view_get_engine(), and priv.
Referenced by handle_geometry_changed(), and TEST().
|
static |
|
static |
|
static |
Converts a pixel co-ordinate from 0..pixels to OpenGL -1..1.
Definition at line 91 of file fl_renderer.cc.
Referenced by fl_renderer_render().
|
static |
Definition at line 27 of file fl_renderer.cc.
Referenced by fl_renderer_setup().
|
static |
Definition at line 16 of file fl_renderer.cc.
Referenced by fl_renderer_setup().