Flutter Impeller
impeller::Pipeline< T > Class Template Referenceabstract

Describes the fixed function and programmable aspects of rendering and compute operations performed by commands submitted to the GPU via a command buffer. More...

#include <pipeline.h>

Public Member Functions

virtual ~Pipeline ()
 
virtual bool IsValid () const =0
 
const T & GetDescriptor () const
 Get the descriptor that was responsible for creating this pipeline. It may be copied and modified to create a pipeline variant. More...
 
PipelineFuture< T > CreateVariant (bool async, std::function< void(T &desc)> descriptor_callback) const
 

Protected Member Functions

 Pipeline (std::weak_ptr< PipelineLibrary > library, T desc)
 

Protected Attributes

const std::weak_ptr< PipelineLibrarylibrary_
 
const T desc_
 

Detailed Description

template<typename T>
class impeller::Pipeline< T >

Describes the fixed function and programmable aspects of rendering and compute operations performed by commands submitted to the GPU via a command buffer.

A pipeline handle must be allocated upfront and kept alive for as long as possible. Do not create a pipeline object within a frame workload.

This pipeline object is almost never used directly as it is untyped. Use reflected shader information generated by the Impeller offline shader compiler to generate a typed pipeline object.

Definition at line 52 of file pipeline.h.

Constructor & Destructor Documentation

◆ ~Pipeline()

template<typename T >
impeller::Pipeline< T >::~Pipeline ( )
virtualdefault

◆ Pipeline()

template<typename T >
impeller::Pipeline< T >::Pipeline ( std::weak_ptr< PipelineLibrary library,
desc 
)
protected

Definition at line 18 of file pipeline.cc.

19  : library_(std::move(library)), desc_(std::move(desc)) {}
const std::weak_ptr< PipelineLibrary > library_
Definition: pipeline.h:72

Member Function Documentation

◆ CreateVariant()

template<typename T >
PipelineFuture< T > impeller::Pipeline< T >::CreateVariant ( bool  async,
std::function< void(T &desc)>  descriptor_callback 
) const

Definition at line 56 of file pipeline.cc.

58  {
59  if (!descriptor_callback) {
60  return {std::nullopt,
61  RealizedFuture<std::shared_ptr<Pipeline<T>>>(nullptr)};
62  }
63 
64  auto copied_desc = desc_;
65 
66  descriptor_callback(copied_desc);
67 
68  auto library = library_.lock();
69  if (!library) {
70  VALIDATION_LOG << "The library from which this pipeline was created was "
71  "already collected.";
72  return {desc_, RealizedFuture<std::shared_ptr<Pipeline<T>>>(nullptr)};
73  }
74 
75  return library->GetPipeline(std::move(copied_desc), async);
76 }
#define VALIDATION_LOG
Definition: validation.h:91

References desc_.

◆ GetDescriptor()

template<typename T >
const T & impeller::Pipeline< T >::GetDescriptor

Get the descriptor that was responsible for creating this pipeline. It may be copied and modified to create a pipeline variant.

Returns
The descriptor.

Definition at line 51 of file pipeline.cc.

51  {
52  return desc_;
53 }

References desc_.

◆ IsValid()

template<typename T >
virtual bool impeller::Pipeline< T >::IsValid ( ) const
pure virtual

Member Data Documentation

◆ desc_

template<typename T >
const T impeller::Pipeline< T >::desc_
protected

Definition at line 74 of file pipeline.h.

◆ library_

template<typename T >
const std::weak_ptr<PipelineLibrary> impeller::Pipeline< T >::library_
protected

Definition at line 72 of file pipeline.h.


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