Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
context_gles.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_IMPELLER_RENDERER_BACKEND_GLES_CONTEXT_GLES_H_
6#define FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_CONTEXT_GLES_H_
7
20
21namespace impeller {
22
23class ContextGLES final : public Context,
24 public BackendCast<ContextGLES, Context>,
25 public std::enable_shared_from_this<ContextGLES> {
26 public:
27 static std::shared_ptr<ContextGLES> Create(
28 const Flags& flags,
29 std::unique_ptr<ProcTableGLES> gl,
30 const std::vector<std::shared_ptr<fml::Mapping>>& shader_libraries,
31 bool enable_gpu_tracing,
32 std::shared_ptr<fml::BasicTaskRunner> io_task_runner = nullptr);
33
34 // |Context|
35 ~ContextGLES() override;
36
37 // |Context|
38 BackendType GetBackendType() const override;
39
40 const std::shared_ptr<ReactorGLES>& GetReactor() const;
41
42 std::optional<ReactorGLES::WorkerID> AddReactorWorker(
43 const std::shared_ptr<ReactorGLES::Worker>& worker);
44
46
47 std::shared_ptr<GPUTracerGLES> GetGPUTracer() const { return gpu_tracer_; }
48
49 // Mutable tracker for command buffer submission bookkeeping.
50 const std::shared_ptr<GpuSubmissionTracker>& GetMutableSubmissionTracker()
51 const;
52
53 private:
54 std::shared_ptr<ReactorGLES> reactor_;
55 std::shared_ptr<GpuSubmissionTracker> submission_tracker_ =
56 std::make_shared<GpuSubmissionTracker>();
57 std::shared_ptr<ShaderLibraryGLES> shader_library_;
58 std::shared_ptr<PipelineLibraryGLES> pipeline_library_;
59 std::shared_ptr<SamplerLibraryGLES> sampler_library_;
60 std::shared_ptr<AllocatorGLES> resource_allocator_;
61 std::shared_ptr<CommandQueue> command_queue_;
62 std::shared_ptr<GPUTracerGLES> gpu_tracer_;
63
64 // Note: This is stored separately from the ProcTableGLES CapabilitiesGLES
65 // in order to satisfy the Context::GetCapabilities signature which returns
66 // a reference.
67 std::shared_ptr<const Capabilities> device_capabilities_;
68 bool is_valid_ = false;
69
71 const Flags& flags,
72 std::unique_ptr<ProcTableGLES> gl,
73 const std::vector<std::shared_ptr<fml::Mapping>>& shader_libraries,
74 bool enable_gpu_tracing,
75 std::shared_ptr<fml::BasicTaskRunner> io_task_runner = nullptr);
76
77 // |Context|
78 std::string DescribeGpuModel() const override;
79
80 // |Context|
81 bool IsValid() const override;
82
83 // |Context|
84 std::shared_ptr<Allocator> GetResourceAllocator() const override;
85
86 // |Context|
87 std::shared_ptr<const GpuSubmissionTracker> GetSubmissionTracker()
88 const override;
89
90 // |Context|
91 std::shared_ptr<ShaderLibrary> GetShaderLibrary() const override;
92
93 // |Context|
94 std::shared_ptr<SamplerLibrary> GetSamplerLibrary() const override;
95
96 // |Context|
97 std::shared_ptr<PipelineLibrary> GetPipelineLibrary() const override;
98
99 // |Context|
100 std::shared_ptr<CommandBuffer> CreateCommandBuffer() const override;
101
102 // |Context|
103 const std::shared_ptr<const Capabilities>& GetCapabilities() const override;
104
105 // |Context|
106 std::shared_ptr<CommandQueue> GetCommandQueue() const override;
107
108 // |Context|
109 void Shutdown() override;
110
111 // |Context|
112 bool AddTrackingFence(const std::shared_ptr<Texture>& texture) const override;
113
114 // |Context|
115 void ResetThreadLocalState() const override;
116
117 // |Context|
118 [[nodiscard]] bool EnqueueCommandBuffer(
119 std::shared_ptr<CommandBuffer> command_buffer) override;
120
121 // |Context|
122 [[nodiscard]] bool FlushCommandBuffers() override;
123
124 // |Context|
125 [[nodiscard]] bool FinishQueue() override;
126
127 // |Context|
128 RuntimeStageBackend GetRuntimeStageBackend() const override;
129
130 ContextGLES(const ContextGLES&) = delete;
131
132 ContextGLES& operator=(const ContextGLES&) = delete;
133};
134
135} // namespace impeller
136
137#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_CONTEXT_GLES_H_
std::shared_ptr< GPUTracerGLES > GetGPUTracer() const
const std::shared_ptr< GpuSubmissionTracker > & GetMutableSubmissionTracker() const
BackendType GetBackendType() const override
Get the graphics backend of an Impeller context.
bool RemoveReactorWorker(ReactorGLES::WorkerID id)
static std::shared_ptr< ContextGLES > Create(const Flags &flags, std::unique_ptr< ProcTableGLES > gl, const std::vector< std::shared_ptr< fml::Mapping > > &shader_libraries, bool enable_gpu_tracing, std::shared_ptr< fml::BasicTaskRunner > io_task_runner=nullptr)
const std::shared_ptr< ReactorGLES > & GetReactor() const
std::optional< ReactorGLES::WorkerID > AddReactorWorker(const std::shared_ptr< ReactorGLES::Worker > &worker)
To do anything rendering related with Impeller, you need a context.
Definition context.h:70
FlTexture * texture
std::shared_ptr< CommandBuffer > command_buffer