Flutter Engine
 
Loading...
Searching...
No Matches
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
14
15namespace impeller {
16
17class Context;
18
19using PipelineMap = std::unordered_map<PipelineDescriptor,
23
25 std::unordered_map<ComputePipelineDescriptor,
29
30class PipelineLibrary : public std::enable_shared_from_this<PipelineLibrary> {
31 public:
33
35 std::optional<PipelineDescriptor> descriptor,
36 bool async = true);
37
39 std::optional<ComputePipelineDescriptor> descriptor,
40 bool async = true);
41
42 virtual bool IsValid() const = 0;
43
44 //------------------------------------------------------------------------------
45 /// @brief Creates a pipeline.
46 ///
47 /// @param[in] descriptor The descriptor of the texture to create.
48 /// @param[in] async Whether to allow pipeline creation to be deferred.
49 /// If `false`, pipeline creation will block on the
50 /// current thread.
51 ///
52 /// @param[in] threadsafe Whether mutations to this texture should be
53 /// protected with a threadsafe barrier.
54 ///
55 /// This parameter only affects the OpenGLES rendering
56 /// backend.
57 ///
58 /// If any interaction with this texture (including
59 /// creation) will be done on a thread other than
60 /// where the OpenGLES context resides, then
61 /// `threadsafe`, must be set to `true`.
62 ///
64 PipelineDescriptor descriptor,
65 bool async = true,
66 bool threadsafe = false) = 0;
67
70 bool async = true) = 0;
71
72 virtual bool HasPipeline(const PipelineDescriptor& descriptor) = 0;
73
75 std::shared_ptr<const ShaderFunction> function) = 0;
76
77 protected:
79
80 private:
81 PipelineLibrary(const PipelineLibrary&) = delete;
82
83 PipelineLibrary& operator=(const PipelineLibrary&) = delete;
84};
85
86} // namespace impeller
87
88#endif // FLUTTER_IMPELLER_RENDERER_PIPELINE_LIBRARY_H_
virtual PipelineFuture< ComputePipelineDescriptor > GetPipeline(ComputePipelineDescriptor descriptor, bool async=true)=0
virtual bool HasPipeline(const PipelineDescriptor &descriptor)=0
virtual void RemovePipelinesWithEntryPoint(std::shared_ptr< const ShaderFunction > function)=0
virtual bool IsValid() const =0
PipelineFuture< PipelineDescriptor > GetPipeline(std::optional< PipelineDescriptor > descriptor, bool async=true)
virtual PipelineFuture< PipelineDescriptor > GetPipeline(PipelineDescriptor descriptor, bool async=true, bool threadsafe=false)=0
Creates a pipeline.
std::unordered_map< ComputePipelineDescriptor, PipelineFuture< ComputePipelineDescriptor >, ComparableHash< ComputePipelineDescriptor >, ComparableEqual< ComputePipelineDescriptor > > ComputePipelineMap
std::unordered_map< PipelineDescriptor, PipelineFuture< PipelineDescriptor >, ComparableHash< PipelineDescriptor >, ComparableEqual< PipelineDescriptor > > PipelineMap