Flutter Engine
 
Loading...
Searching...
No Matches
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_WINDOWS_COMPOSITOR_OPENGL_H_
6#define FLUTTER_SHELL_PLATFORM_WINDOWS_COMPOSITOR_OPENGL_H_
7
8#include <memory>
9
10#include "flutter/fml/macros.h"
15
16namespace flutter {
17
18// Enables the Flutter engine to render content on Windows using OpenGL.
20 public:
23 bool enable_impeller);
24
25 /// |Compositor|
27 FlutterBackingStore* result) override;
28
29 /// |Compositor|
30 bool CollectBackingStore(const FlutterBackingStore* store) override;
31
32 /// |Compositor|
34 const FlutterLayer** layers,
35 size_t layers_count) override;
36
37 private:
38 // The Flutter engine that manages the views to render.
39 FlutterWindowsEngine* engine_;
40
41 private:
42 struct TextureFormat {
43 // The format passed to the engine using `FlutterOpenGLFramebuffer.target`.
44 uint32_t sized_format = 0;
45 // The format used to create textures. Passed to `glTexImage2D`.
46 uint32_t general_format = 0;
47 };
48
49 // The compositor initializes itself lazily once |CreateBackingStore| is
50 // called. True if initialization completed successfully.
51 bool is_initialized_ = false;
52
53 // Function used to resolve GLES functions.
54 impeller::ProcTableGLES::Resolver resolver_ = nullptr;
55
56 // Table of resolved GLES functions. Null until the compositor is initialized.
57 std::unique_ptr<impeller::ProcTableGLES> gl_ = nullptr;
58
59 // The OpenGL texture format for backing stores. Invalid value until
60 // the compositor is initialized.
61 TextureFormat format_;
62
63 // Whether the Impeller rendering backend is enabled.
64 bool enable_impeller_ = false;
65
66 // Initialize the compositor. This must run on the raster thread.
67 bool Initialize();
68
69 // Clear the view's surface and removes any previously presented layers.
70 bool Clear(FlutterWindowsView* view);
71
73};
74
75} // namespace flutter
76
77#endif // FLUTTER_SHELL_PLATFORM_WINDOWS_COMPOSITOR_OPENGL_H_
bool Present(FlutterWindowsView *view, const FlutterLayer **layers, size_t layers_count) override
|Compositor|
bool CreateBackingStore(const FlutterBackingStoreConfig &config, FlutterBackingStore *result) override
|Compositor|
bool CollectBackingStore(const FlutterBackingStore *store) override
|Compositor|
std::function< void *(const char *function_name)> Resolver
FlutterEngine engine
Definition main.cc:84
FlView * view
const FlutterLayer size_t layers_count
const FlutterLayer ** layers
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27