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 <compute_pipeline_descriptor.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 18 of file compute_pipeline_descriptor.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)) {}

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 54 of file pipeline.cc.

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

◆ 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 49 of file pipeline.cc.

49  {
50  return desc_;
51 }

◆ 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 71 of file pipeline.h.

◆ library_

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

Definition at line 69 of file pipeline.h.


The documentation for this class was generated from the following files:
impeller::Pipeline::desc_
const T desc_
Definition: pipeline.h:71
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:91
impeller::Pipeline::library_
const std::weak_ptr< PipelineLibrary > library_
Definition: pipeline.h:69