| Flutter Impeller |

pipeline_library.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_PIPELINE_LIBRARY_H_
6 #define FLUTTER_IMPELLER_RENDERER_PIPELINE_LIBRARY_H_
7
8 #include <optional>
9 #include <unordered_map>
10
11 #include "compute_pipeline_descriptor.h"
12 #include "impeller/renderer/pipeline.h"
13 #include "impeller/renderer/pipeline_descriptor.h"
14
15 namespace impeller {
16
17 class Context;
18
19 using PipelineMap = std::unordered_map<PipelineDescriptor,
20 PipelineFuture<PipelineDescriptor>,
21 ComparableHash<PipelineDescriptor>,
22 ComparableEqual<PipelineDescriptor>>;
23
24 using ComputePipelineMap =
25 std::unordered_map<ComputePipelineDescriptor,
26 PipelineFuture<ComputePipelineDescriptor>,
27 ComparableHash<ComputePipelineDescriptor>,
28 ComparableEqual<ComputePipelineDescriptor>>;
29
30 class PipelineLibrary : public std::enable_shared_from_this<PipelineLibrary> {
31 public:
32 virtual ~PipelineLibrary();
33
34 PipelineFuture<PipelineDescriptor> GetPipeline(
35 std::optional<PipelineDescriptor> descriptor,
36 bool async = true);
37
38 PipelineFuture<ComputePipelineDescriptor> GetPipeline(
39 std::optional<ComputePipelineDescriptor> descriptor,
40 bool async = true);
41
42 virtual bool IsValid() const = 0;
43
44 virtual PipelineFuture<PipelineDescriptor> GetPipeline(
45 PipelineDescriptor descriptor,
46 bool async = true) = 0;
47
48 virtual PipelineFuture<ComputePipelineDescriptor> GetPipeline(
49 ComputePipelineDescriptor descriptor,
50 bool async = true) = 0;
51
52 virtual bool HasPipeline(const PipelineDescriptor& descriptor) = 0;
53
54 virtual void RemovePipelinesWithEntryPoint(
55 std::shared_ptr<const ShaderFunction> function) = 0;
56
57 protected:
58 PipelineLibrary();
59
60 private:
61 PipelineLibrary(const PipelineLibrary&) = delete;
62
63 PipelineLibrary& operator=(const PipelineLibrary&) = delete;
64 };
65
66 } // namespace impeller
67
68 #endif // FLUTTER_IMPELLER_RENDERER_PIPELINE_LIBRARY_H_
impeller::ComputePipelineDescriptor
Definition: compute_pipeline_descriptor.h:21
impeller::PipelineDescriptor
Definition: pipeline_descriptor.h:24
impeller::PipelineLibrary
Definition: pipeline_library.h:30
impeller::PipelineLibrary::PipelineLibrary
PipelineLibrary()
impeller::PipelineLibrary::HasPipeline
virtual bool HasPipeline(const PipelineDescriptor &descriptor)=0
impeller::PipelineLibrary::RemovePipelinesWithEntryPoint
virtual void RemovePipelinesWithEntryPoint(std::shared_ptr< const ShaderFunction > function)=0
impeller::PipelineLibrary::GetPipeline
virtual PipelineFuture< ComputePipelineDescriptor > GetPipeline(ComputePipelineDescriptor descriptor, bool async=true)=0
impeller::PipelineLibrary::IsValid
virtual bool IsValid() const =0
impeller::PipelineLibrary::~PipelineLibrary
virtual ~PipelineLibrary()
impeller::PipelineLibrary::GetPipeline
virtual PipelineFuture< PipelineDescriptor > GetPipeline(PipelineDescriptor descriptor, bool async=true)=0
impeller::PipelineLibrary::GetPipeline
PipelineFuture< PipelineDescriptor > GetPipeline(std::optional< PipelineDescriptor > descriptor, bool async=true)
Definition: pipeline_library.cc:13
compute_pipeline_descriptor.h
impeller
Definition: allocation.cc:12
impeller::ComputePipelineMap
std::unordered_map< ComputePipelineDescriptor, PipelineFuture< ComputePipelineDescriptor >, ComparableHash< ComputePipelineDescriptor >, ComparableEqual< ComputePipelineDescriptor > > ComputePipelineMap
Definition: pipeline_library.h:28
impeller::PipelineMap
std::unordered_map< PipelineDescriptor, PipelineFuture< PipelineDescriptor >, ComparableHash< PipelineDescriptor >, ComparableEqual< PipelineDescriptor > > PipelineMap
Definition: pipeline_library.h:22
pipeline.h
pipeline_descriptor.h
impeller::ComparableEqual
Definition: comparable.h:48
impeller::ComparableHash
Definition: comparable.h:39
impeller::PipelineFuture
Definition: pipeline.h:28