| Flutter Impeller |

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
8 #include "impeller/base/backend_cast.h"
9 #include "impeller/renderer/backend/gles/allocator_gles.h"
10 #include "impeller/renderer/backend/gles/capabilities_gles.h"
11 #include "impeller/renderer/backend/gles/gpu_tracer_gles.h"
12 #include "impeller/renderer/backend/gles/pipeline_library_gles.h"
13 #include "impeller/renderer/backend/gles/reactor_gles.h"
14 #include "impeller/renderer/backend/gles/sampler_library_gles.h"
15 #include "impeller/renderer/backend/gles/shader_library_gles.h"
16 #include "impeller/renderer/capabilities.h"
17 #include "impeller/renderer/command_queue.h"
18 #include "impeller/renderer/context.h"
19
20 namespace impeller {
21
22 class ContextGLES final : public Context,
23 public BackendCast<ContextGLES, Context>,
24 public std::enable_shared_from_this<ContextGLES> {
25 public:
26 static std::shared_ptr<ContextGLES> Create(
27 std::unique_ptr<ProcTableGLES> gl,
28 const std::vector<std::shared_ptr<fml::Mapping>>& shader_libraries,
29 bool enable_gpu_tracing);
30
31 // |Context|
32 ~ContextGLES() override;
33
34 // |Context|
35 BackendType GetBackendType() const override;
36
37 const ReactorGLES::Ref& GetReactor() const;
38
39 std::optional<ReactorGLES::WorkerID> AddReactorWorker(
40 const std::shared_ptr<ReactorGLES::Worker>& worker);
41
42 bool RemoveReactorWorker(ReactorGLES::WorkerID id);
43
44 std::shared_ptr<GPUTracerGLES> GetGPUTracer() const { return gpu_tracer_; }
45
46 private:
47 ReactorGLES::Ref reactor_;
48 std::shared_ptr<ShaderLibraryGLES> shader_library_;
49 std::shared_ptr<PipelineLibraryGLES> pipeline_library_;
50 std::shared_ptr<SamplerLibraryGLES> sampler_library_;
51 std::shared_ptr<AllocatorGLES> resource_allocator_;
52 std::shared_ptr<CommandQueue> command_queue_;
53 std::shared_ptr<GPUTracerGLES> gpu_tracer_;
54
55 // Note: This is stored separately from the ProcTableGLES CapabilitiesGLES
56 // in order to satisfy the Context::GetCapabilities signature which returns
57 // a reference.
58 std::shared_ptr<const Capabilities> device_capabilities_;
59 bool is_valid_ = false;
60
61 ContextGLES(
62 std::unique_ptr<ProcTableGLES> gl,
63 const std::vector<std::shared_ptr<fml::Mapping>>& shader_libraries,
64 bool enable_gpu_tracing);
65
66 // |Context|
67 std::string DescribeGpuModel() const override;
68
69 // |Context|
70 bool IsValid() const override;
71
72 // |Context|
73 std::shared_ptr<Allocator> GetResourceAllocator() const override;
74
75 // |Context|
76 std::shared_ptr<ShaderLibrary> GetShaderLibrary() const override;
77
78 // |Context|
79 std::shared_ptr<SamplerLibrary> GetSamplerLibrary() const override;
80
81 // |Context|
82 std::shared_ptr<PipelineLibrary> GetPipelineLibrary() const override;
83
84 // |Context|
85 std::shared_ptr<CommandBuffer> CreateCommandBuffer() const override;
86
87 // |Context|
88 const std::shared_ptr<const Capabilities>& GetCapabilities() const override;
89
90 // |Context|
91 std::shared_ptr<CommandQueue> GetCommandQueue() const override;
92
93 // |Context|
94 void Shutdown() override;
95
96 ContextGLES(const ContextGLES&) = delete;
97
98 ContextGLES& operator=(const ContextGLES&) = delete;
99 };
100
101 } // namespace impeller
102
103 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_CONTEXT_GLES_H_
impeller::ContextGLES::RemoveReactorWorker
bool RemoveReactorWorker(ReactorGLES::WorkerID id)
Definition: context_gles.cc:93
impeller::Context::BackendType
BackendType
Definition: context.h:47
impeller::ContextGLES::AddReactorWorker
std::optional< ReactorGLES::WorkerID > AddReactorWorker(const std::shared_ptr< ReactorGLES::Worker > &worker)
Definition: context_gles.cc:85
command_queue.h
impeller::ReactorGLES::Ref
std::shared_ptr< ReactorGLES > Ref
Definition: reactor_gles.h:86
impeller::ContextGLES::GetReactor
const ReactorGLES::Ref & GetReactor() const
Definition: context_gles.cc:81
impeller::ContextGLES
Definition: context_gles.h:22
impeller::ContextGLES::Create
static std::shared_ptr< ContextGLES > Create(std::unique_ptr< ProcTableGLES > gl, const std::vector< std::shared_ptr< fml::Mapping >> &shader_libraries, bool enable_gpu_tracing)
Definition: context_gles.cc:16
gpu_tracer_gles.h
sampler_library_gles.h
backend_cast.h
impeller::ContextGLES::GetBackendType
BackendType GetBackendType() const override
Get the graphics backend of an Impeller context.
Definition: context_gles.cc:77
capabilities.h
reactor_gles.h
pipeline_library_gles.h
allocator_gles.h
impeller::Context
To do anything rendering related with Impeller, you need a context.
Definition: context.h:45
impeller::BackendCast
Definition: backend_cast.h:11
shader_library_gles.h
impeller::ContextGLES::~ContextGLES
~ContextGLES() override
context.h
impeller::ContextGLES::GetGPUTracer
std::shared_ptr< GPUTracerGLES > GetGPUTracer() const
Definition: context_gles.h:44
impeller::UniqueID
Definition: comparable.h:16
capabilities_gles.h
impeller
Definition: aiks_blend_unittests.cc:18