Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
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
17
18namespace impeller {
19
20class Context;
21
22using PipelineMap = std::unordered_map<PipelineDescriptor,
26
28 std::unordered_map<ComputePipelineDescriptor,
32
33class PipelineLibrary : public std::enable_shared_from_this<PipelineLibrary> {
34 public:
36
38 std::optional<PipelineDescriptor> descriptor,
39 bool async = true);
40
42 std::optional<ComputePipelineDescriptor> descriptor,
43 bool async = true);
44
45 virtual bool IsValid() const = 0;
46
47 //------------------------------------------------------------------------------
48 /// @brief Creates a pipeline.
49 ///
50 /// @param[in] descriptor The descriptor of the texture to create.
51 /// @param[in] async Whether to allow pipeline creation to be deferred.
52 /// If `false`, pipeline creation will block on the
53 /// current thread.
54 ///
55 /// @param[in] threadsafe Whether mutations to this texture should be
56 /// protected with a threadsafe barrier.
57 ///
58 /// This parameter only affects the OpenGLES rendering
59 /// backend.
60 ///
61 /// If any interaction with this texture (including
62 /// creation) will be done on a thread other than
63 /// where the OpenGLES context resides, then
64 /// `threadsafe`, must be set to `true`.
65 ///
67 PipelineDescriptor descriptor,
68 bool async = true,
69 bool threadsafe = false) = 0;
70
73 bool async = true) = 0;
74
75 virtual bool HasPipeline(const PipelineDescriptor& descriptor) = 0;
76
78 std::shared_ptr<const ShaderFunction> function) = 0;
79
81
83
84 std::unordered_map<PipelineDescriptor,
85 int,
89
90 //----------------------------------------------------------------------------
91 /// @brief If this library has a configurable compile queue, return a
92 /// pointer to it.
93 ///
94 /// @return The pipeline compile queue if one is present.
95 ///
97
98 protected:
100
101 private:
102 PipelineLibrary(const PipelineLibrary&) = delete;
103
104 PipelineLibrary& operator=(const PipelineLibrary&) = delete;
105#if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG || \
106 FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_PROFILE
107 mutable RWMutex pipeline_use_counts_mutex_;
108
109 std::unordered_map<PipelineDescriptor,
110 int,
113 pipeline_use_counts_ IPLR_GUARDED_BY(pipeline_use_counts_mutex_);
114
115#endif
116};
117
118} // namespace impeller
119
120#endif // FLUTTER_IMPELLER_RENDERER_PIPELINE_LIBRARY_H_
A task queue designed for managing compilation of pipeline state objects.
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
void LogPipelineUsage(const PipelineDescriptor &p)
std::unordered_map< PipelineDescriptor, int, ComparableHash< PipelineDescriptor >, ComparableEqual< PipelineDescriptor > > GetPipelineUseCounts() const
virtual bool IsValid() const =0
virtual PipelineCompileQueue * GetPipelineCompileQueue() const
If this library has a configurable compile queue, return a pointer to it.
void LogPipelineCreation(const PipelineDescriptor &p)
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
#define IPLR_GUARDED_BY(x)