| Flutter Impeller |

Public Member Functions | Protected Member Functions | List of all members
impeller::PipelineLibrary Class Referenceabstract

`#include <pipeline_library.h>`

Inheritance diagram for impeller::PipelineLibrary:

## Public Member Functions
virtual | ~PipelineLibrary ()
PipelineFuture< PipelineDescriptor > | GetPipeline (std::optional< PipelineDescriptor > descriptor, bool async=true)
PipelineFuture< ComputePipelineDescriptor > | GetPipeline (std::optional< ComputePipelineDescriptor > descriptor, bool async=true)
virtual bool | IsValid () const =0
virtual PipelineFuture< PipelineDescriptor > | GetPipeline (PipelineDescriptor descriptor, bool async=true, bool threadsafe=false)=0
| Creates a pipeline. More...
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)
void | LogPipelineCreation (const PipelineDescriptor &p)
std::unordered_map< PipelineDescriptor, int, ComparableHash< PipelineDescriptor >, ComparableEqual< PipelineDescriptor > > | GetPipelineUseCounts () const

## Protected Member Functions
| PipelineLibrary ()

## Detailed Description

Definition at line 32 of file pipeline_library.h.

## Constructor & Destructor Documentation

## ◆ ~PipelineLibrary()

impeller::PipelineLibrary::~PipelineLibrary | ( |  | ) |
| virtualdefault

## ◆ PipelineLibrary()

impeller::PipelineLibrary::PipelineLibrary | ( |  | ) |
| protecteddefault

## Member Function Documentation

## ◆ GetPipeline() [1/4]

virtual PipelineFuture<ComputePipelineDescriptor> impeller::PipelineLibrary::GetPipeline | ( | ComputePipelineDescriptor | descriptor,
|  | bool | async = `true`
| ) |  |
| pure virtual

## ◆ GetPipeline() [2/4]

virtual PipelineFuture<PipelineDescriptor> impeller::PipelineLibrary::GetPipeline | ( | PipelineDescriptor | descriptor,
|  | bool | async = `true`,
|  | bool | threadsafe = `false`
| ) |  |
| pure virtual

Creates a pipeline.

Parameters

  [in] | descriptor | The descriptor of the texture to create.
  [in] | async | Whether to allow pipeline creation to be deferred. If `false`, pipeline creation will block on the current thread.
  [in] | threadsafe | Whether mutations to this texture should be protected with a threadsafe barrier.

This parameter only affects the OpenGLES rendering backend.

If any interaction with this texture (including creation) will be done on a thread other than where the OpenGLES context resides, then `threadsafe`, must be set to `true`.

## ◆ GetPipeline() [3/4]

PipelineFuture< ComputePipelineDescriptor > impeller::PipelineLibrary::GetPipeline | ( | std::optional< ComputePipelineDescriptor > | descriptor,
|  | bool | async = `true`
| ) |  |

Definition at line 29 of file pipeline_library.cc.

31 {
32 if (descriptor.has_value()) {
33 return GetPipeline(descriptor.value(), async);
34 }
35 auto promise = std::make_shared<
36 std::promise<std::shared_ptr<Pipeline<ComputePipelineDescriptor>>>>();
37 promise->set_value(nullptr);
38 return {descriptor, promise->get_future()};
39 }
impeller::PipelineLibrary::GetPipeline
PipelineFuture< PipelineDescriptor > GetPipeline(std::optional< PipelineDescriptor > descriptor, bool async=true)
Definition: pipeline_library.cc:17

References GetPipeline().

## ◆ GetPipeline() [4/4]

PipelineFuture< PipelineDescriptor > impeller::PipelineLibrary::GetPipeline | ( | std::optional< PipelineDescriptor > | descriptor,
|  | bool | async = `true`
| ) |  |

Definition at line 17 of file pipeline_library.cc.

19 {
20 if (descriptor.has_value()) {
21 return GetPipeline(descriptor.value(), async);
22 }
23 auto promise = std::make_shared<
24 std::promise<std::shared_ptr<Pipeline<PipelineDescriptor>>>>();
25 promise->set_value(nullptr);
26 return {descriptor, promise->get_future()};
27 }

Referenced by GetPipeline().

## ◆ GetPipelineUseCounts()

std::unordered_map< PipelineDescriptor, int, ComparableHash< PipelineDescriptor >, ComparableEqual< PipelineDescriptor > > impeller::PipelineLibrary::GetPipelineUseCounts | ( |  | ) | const

Definition at line 63 of file pipeline_library.cc.

63 {
64 std::unordered_map<PipelineDescriptor, int,
65 ComparableHash<PipelineDescriptor>,
66 ComparableEqual<PipelineDescriptor>>
67 counts;
68
69 #if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG || \
70 FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_PROFILE
71 ReaderLock lock(pipeline_use_counts_mutex_);
72 counts = pipeline_use_counts_;
73 #endif
74 return counts;
75 }

## ◆ HasPipeline()

virtual bool impeller::PipelineLibrary::HasPipeline | ( | const PipelineDescriptor & | descriptor | ) |
| pure virtual

## ◆ IsValid()

virtual bool impeller::PipelineLibrary::IsValid | ( |  | ) | const
| pure virtual

## ◆ LogPipelineCreation()

void impeller::PipelineLibrary::LogPipelineCreation | ( | const PipelineDescriptor & | p | ) |

Definition at line 41 of file pipeline_library.cc.

41 {
42 #if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG || \
43 FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_PROFILE
44 WriterLock lock(pipeline_use_counts_mutex_);
45 if (!pipeline_use_counts_.contains(p)) {
46 pipeline_use_counts_[p] = 0;
47 }
48 #endif
49 }

## ◆ LogPipelineUsage()

void impeller::PipelineLibrary::LogPipelineUsage | ( | const PipelineDescriptor & | p | ) |

Definition at line 51 of file pipeline_library.cc.

51 {
52 #if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG || \
53 FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_PROFILE
54 WriterLock lock(pipeline_use_counts_mutex_);
55 ++pipeline_use_counts_[p];
56 #endif
57 }

## ◆ RemovePipelinesWithEntryPoint()

virtual void impeller::PipelineLibrary::RemovePipelinesWithEntryPoint | ( | std::shared_ptr< const ShaderFunction > | function | ) |
| pure virtual

The documentation for this class was generated from the following files:

- impeller/renderer/pipeline_library.h
- impeller/renderer/pipeline_library.cc