| 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 #pragma once
6
7 #include "flutter/fml/macros.h"
8 #include "impeller/base/backend_cast.h"
9 #include "impeller/renderer/backend/gles/allocator_gles.h"
10 #include "impeller/renderer/backend/gles/command_buffer_gles.h"
11 #include "impeller/renderer/backend/gles/pipeline_library_gles.h"
12 #include "impeller/renderer/backend/gles/reactor_gles.h"
13 #include "impeller/renderer/backend/gles/sampler_library_gles.h"
14 #include "impeller/renderer/backend/gles/shader_library_gles.h"
15 #include "impeller/renderer/capabilities.h"
16 #include "impeller/renderer/context.h"
17
18 namespace impeller {
19
20 class ContextGLES final : public Context,
21 public BackendCast<ContextGLES, Context>,
22 public std::enable_shared_from_this<ContextGLES> {
23 public:
24 static std::shared_ptr<ContextGLES> Create(
25 std::unique_ptr<ProcTableGLES> gl,
26 const std::vector<std::shared_ptr<fml::Mapping>>& shader_libraries);
27
28 // |Context|
29 ~ContextGLES() override;
30
31 // |Context|
32 BackendType GetBackendType() const override;
33
34 const ReactorGLES::Ref& GetReactor() const;
35
36 std::optional<ReactorGLES::WorkerID> AddReactorWorker(
37 const std::shared_ptr<ReactorGLES::Worker>& worker);
38
39 bool RemoveReactorWorker(ReactorGLES::WorkerID id);
40
41 private:
42 ReactorGLES::Ref reactor_;
43 std::shared_ptr<ShaderLibraryGLES> shader_library_;
44 std::shared_ptr<PipelineLibraryGLES> pipeline_library_;
45 std::shared_ptr<SamplerLibraryGLES> sampler_library_;
46 std::shared_ptr<AllocatorGLES> resource_allocator_;
47 std::shared_ptr<const Capabilities> device_capabilities_;
48 bool is_valid_ = false;
49
50 ContextGLES(
51 std::unique_ptr<ProcTableGLES> gl,
52 const std::vector<std::shared_ptr<fml::Mapping>>& shader_libraries);
53
54 // |Context|
55 std::string DescribeGpuModel() const override;
56
57 // |Context|
58 bool IsValid() const override;
59
60 // |Context|
61 std::shared_ptr<Allocator> GetResourceAllocator() const override;
62
63 // |Context|
64 std::shared_ptr<ShaderLibrary> GetShaderLibrary() const override;
65
66 // |Context|
67 std::shared_ptr<SamplerLibrary> GetSamplerLibrary() const override;
68
69 // |Context|
70 std::shared_ptr<PipelineLibrary> GetPipelineLibrary() const override;
71
72 // |Context|
73 std::shared_ptr<CommandBuffer> CreateCommandBuffer() const override;
74
75 // |Context|
76 const std::shared_ptr<const Capabilities>& GetCapabilities() const override;
77
78 // |Context|
79 void Shutdown() override;
80
81 FML_DISALLOW_COPY_AND_ASSIGN(ContextGLES);
82 };
83
84 } // namespace impeller
impeller::ContextGLES::RemoveReactorWorker
bool RemoveReactorWorker(ReactorGLES::WorkerID id)
Definition: context_gles.cc:104
impeller::Context::BackendType
BackendType
Definition: context.h:49
impeller::ContextGLES::AddReactorWorker
std::optional< ReactorGLES::WorkerID > AddReactorWorker(const std::shared_ptr< ReactorGLES::Worker > &worker)
Definition: context_gles.cc:96
impeller::ReactorGLES::Ref
std::shared_ptr< ReactorGLES > Ref
Definition: reactor_gles.h:31
impeller::ContextGLES::GetReactor
const ReactorGLES::Ref & GetReactor() const
Definition: context_gles.cc:92
impeller::ContextGLES
Definition: context_gles.h:20
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:88
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:47
impeller::BackendCast
Definition: backend_cast.h:12
shader_library_gles.h
impeller::ContextGLES::~ContextGLES
~ContextGLES() override
context.h
impeller::ContextGLES::Create
static std::shared_ptr< ContextGLES > Create(std::unique_ptr< ProcTableGLES > gl, const std::vector< std::shared_ptr< fml::Mapping >> &shader_libraries)
Definition: context_gles.cc:12
impeller::UniqueID
Definition: comparable.h:19
command_buffer_gles.h
impeller
Definition: aiks_context.cc:10