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