#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_engine_private.h"
#include "flutter/shell/platform/linux/fl_framebuffer.h"
#include "flutter/shell/platform/linux/fl_view_private.h"
Go to the source code of this file.
Classes | |
struct | FlRendererPrivate |
Functions | |
static gboolean | is_nvidia () |
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 | initialize (FlRenderer *self) |
static void | fl_renderer_unblock_main_thread (FlRenderer *self) |
static void | setup_shader (FlRenderer *self) |
static void | render_with_blit (FlRenderer *self, GPtrArray *framebuffers) |
static void | render_with_textures (FlRenderer *self, GPtrArray *framebuffers, int width, int height) |
static void | fl_renderer_dispose (GObject *object) |
static void | fl_renderer_class_init (FlRendererClass *klass) |
static void | fl_renderer_init (FlRenderer *self) |
void | fl_renderer_set_engine (FlRenderer *self, FlEngine *engine) |
void | fl_renderer_add_view (FlRenderer *self, FlutterViewId view_id, FlView *view) |
void | fl_renderer_remove_view (FlRenderer *self, FlutterViewId view_id) |
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 *self, 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, FlutterViewId view_id, const FlutterLayer **layers, size_t layers_count) |
void | fl_renderer_setup (FlRenderer *self) |
void | fl_renderer_render (FlRenderer *self, FlutterViewId view_id, int width, int height, const GdkRGBA *background_color) |
void | fl_renderer_cleanup (FlRenderer *self) |
Variables | |
static const char * | vertex_shader_src |
static const char * | fragment_shader_src |
void fl_renderer_add_view | ( | FlRenderer * | renderer, |
FlutterViewId | view_id, | ||
FlView * | view | ||
) |
fl_renderer_add_view: @renderer: an #FlRenderer. @view_id: the ID of the view. @view: the view Flutter is renderering to.
Add a view to render on.
Definition at line 314 of file fl_renderer.cc.
Referenced by fl_view_new_for_engine(), realize_cb(), and TEST().
|
static |
Definition at line 291 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 528 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 350 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 399 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 367 of file fl_renderer.cc.
References fl_framebuffer_get_id(), fl_framebuffer_new(), fl_renderer_make_current(), initialize(), priv, and TRUE.
Referenced by compositor_create_backing_store_callback(), and TEST().
|
static |
Definition at line 277 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 360 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 355 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 340 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 345 of file fl_renderer.cc.
Referenced by fl_engine_gl_make_resource_current().
gboolean fl_renderer_present_layers | ( | FlRenderer * | renderer, |
FlutterViewId | view_id, | ||
const FlutterLayer ** | layers, | ||
size_t | layers_count | ||
) |
fl_renderer_present_layers: @renderer: an #FlRenderer. @view_id: view to present. @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 429 of file fl_renderer.cc.
References fl_renderer_unblock_main_thread(), fl_view_redraw(), i, priv, TRUE, and view.
Referenced by compositor_present_view_callback(), and TEST().
void fl_renderer_remove_view | ( | FlRenderer * | renderer, |
FlutterViewId | view_id | ||
) |
fl_renderer_remove_view: @renderer: an #FlRenderer. @view_id: the ID of the view.
Remove a view from the renderer.
Definition at line 325 of file fl_renderer.cc.
References priv.
Referenced by fl_view_dispose().
void fl_renderer_render | ( | FlRenderer * | renderer, |
FlutterViewId | view_id, | ||
int | width, | ||
int | height, | ||
const GdkRGBA * | background_color | ||
) |
fl_renderer_render: @renderer: an #FlRenderer. @view_id: view to render. @width: width of the window in pixels. @height: height of the window in pixels. @background_color: color to use for background.
Performs OpenGL commands to render current Flutter view.
Definition at line 501 of file fl_renderer.cc.
References height, priv, render_with_blit(), render_with_textures(), and width.
Referenced by render_cb(), and TEST().
void fl_renderer_set_engine | ( | FlRenderer * | renderer, |
FlEngine * | engine | ||
) |
fl_renderer_set_engine: @renderer: an #FlRenderer. @engine: an #FlEngine.
Called when the renderer is connected to an engine.
Definition at line 305 of file fl_renderer.cc.
References priv.
Referenced by fl_engine_new_with_renderer().
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 484 of file fl_renderer.cc.
References is_nvidia(), priv, and setup_shader().
Referenced by realize_cb(), and TEST().
|
static |
Definition at line 136 of file fl_renderer.cc.
References fl_engine_get_task_runner(), fl_task_runner_release_main_thread(), 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 409 of file fl_renderer.cc.
References fl_engine_get_task_runner(), fl_task_runner_block_main_thread(), and priv.
Referenced by handle_geometry_changed(), and TEST().
|
static |
|
static |
|
static |
|
static |
|
static |
Converts a pixel co-ordinate from 0..pixels to OpenGL -1..1.
Definition at line 113 of file fl_renderer.cc.
Referenced by render_with_textures().
|
static |
Definition at line 189 of file fl_renderer.cc.
References fl_framebuffer_get_height(), fl_framebuffer_get_id(), fl_framebuffer_get_width(), height, i, and width.
Referenced by fl_renderer_render().
|
static |
Definition at line 209 of file fl_renderer.cc.
References fl_framebuffer_get_height(), fl_framebuffer_get_texture_id(), fl_framebuffer_get_width(), height, i, pixels_to_gl_coords(), priv, texture_id, and width.
Referenced by fl_renderer_render().
|
static |
Definition at line 149 of file fl_renderer.cc.
References fragment_shader_src, get_program_log(), get_shader_log(), priv, and vertex_shader_src.
Referenced by fl_renderer_setup().
|
static |
Definition at line 27 of file fl_renderer.cc.
Referenced by setup_shader().
|
static |
Definition at line 16 of file fl_renderer.cc.
Referenced by setup_shader().