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 (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 28 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 ( std::function< void(T &desc)>  descriptor_callback) const

Definition at line 54 of file pipeline.cc.

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

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

◆ library_

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

Definition at line 67 of file pipeline.h.


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