| Flutter Impeller |

Public Member Functions | List of all members
impeller::PipelineDescriptor Class Referencefinal

`#include <pipeline_descriptor.h>`

Inheritance diagram for impeller::PipelineDescriptor:

## Public Member Functions
| PipelineDescriptor ()
| ~PipelineDescriptor ()
PipelineDescriptor & | SetLabel (std::string label)
const std::string & | GetLabel () const
PipelineDescriptor & | SetSampleCount (SampleCount samples)
SampleCount | GetSampleCount () const
PipelineDescriptor & | AddStageEntrypoint (std::shared_ptr< const ShaderFunction > function)
const std::map< ShaderStage, std::shared_ptr< const ShaderFunction > > & | GetStageEntrypoints () const
std::shared_ptr< const ShaderFunction > | GetEntrypointForStage (ShaderStage stage) const
PipelineDescriptor & | SetVertexDescriptor (std::shared_ptr< VertexDescriptor > vertex_descriptor)
const std::shared_ptr< VertexDescriptor > & | GetVertexDescriptor () const
size_t | GetMaxColorAttacmentBindIndex () const
PipelineDescriptor & | SetColorAttachmentDescriptor (size_t index, ColorAttachmentDescriptor desc)
PipelineDescriptor & | SetColorAttachmentDescriptors (std::map< size_t, ColorAttachmentDescriptor > descriptors)
const ColorAttachmentDescriptor * | GetColorAttachmentDescriptor (size_t index) const
const std::map< size_t, ColorAttachmentDescriptor > & | GetColorAttachmentDescriptors () const
const ColorAttachmentDescriptor * | GetLegacyCompatibleColorAttachment () const
PipelineDescriptor & | SetDepthStencilAttachmentDescriptor (std::optional< DepthAttachmentDescriptor > desc)
std::optional< DepthAttachmentDescriptor > | GetDepthStencilAttachmentDescriptor () const
PipelineDescriptor & | SetStencilAttachmentDescriptors (std::optional< StencilAttachmentDescriptor > front_and_back)
PipelineDescriptor & | SetStencilAttachmentDescriptors (std::optional< StencilAttachmentDescriptor > front, std::optional< StencilAttachmentDescriptor > back)
void | ClearStencilAttachments ()
void | ClearDepthAttachment ()
void | ClearColorAttachment (size_t index)
std::optional< StencilAttachmentDescriptor > | GetFrontStencilAttachmentDescriptor () const
std::optional< StencilAttachmentDescriptor > | GetBackStencilAttachmentDescriptor () const
bool | HasStencilAttachmentDescriptors () const
PipelineDescriptor & | SetDepthPixelFormat (PixelFormat format)
PixelFormat | GetDepthPixelFormat () const
PipelineDescriptor & | SetStencilPixelFormat (PixelFormat format)
PixelFormat | GetStencilPixelFormat () const
std::size_t | GetHash () const override
bool | IsEqual (const PipelineDescriptor &other) const override
void | ResetAttachments ()
void | SetCullMode (CullMode mode)
CullMode | GetCullMode () const
void | SetWindingOrder (WindingOrder order)
WindingOrder | GetWindingOrder () const
void | SetPrimitiveType (PrimitiveType type)
PrimitiveType | GetPrimitiveType () const
void | SetPolygonMode (PolygonMode mode)
PolygonMode | GetPolygonMode () const
Public Member Functions inherited from impeller::Comparable< PipelineDescriptor >
virtual std::size_t | GetHash () const=0

## Detailed Description

Definition at line 30 of file pipeline_descriptor.h.

## Constructor & Destructor Documentation

## ◆ PipelineDescriptor()

impeller::PipelineDescriptor::PipelineDescriptor | ( |  | ) |
| default

## ◆ ~PipelineDescriptor()

impeller::PipelineDescriptor::~PipelineDescriptor | ( |  | ) |
| default

## Member Function Documentation

## ◆ AddStageEntrypoint()

PipelineDescriptor & impeller::PipelineDescriptor::AddStageEntrypoint | ( | std::shared_ptr< const ShaderFunction > | function | ) |

Definition at line 77 of file pipeline_descriptor.cc.

78 {
79 if (!function) {
80 return *this;
81 }
82
83 if (function->GetStage() == ShaderStage::kUnknown) {
84 return *this;
85 }
86
87 entrypoints_[function->GetStage()] = std::move(function);
88
89 return *this;
90 }

References impeller::kUnknown.

Referenced by impeller::PipelineBuilder< VertexShader_, FragmentShader_ >::InitializePipelineDescriptorDefaults(), impeller::RuntimeEffectContents::Render(), and impeller::testing::TEST_P().

## ◆ ClearColorAttachment()

void impeller::PipelineDescriptor::ClearColorAttachment | ( | size_t | index | ) |

Definition at line 177 of file pipeline_descriptor.cc.

177 {
178 if (color_attachment_descriptors_.find(index) ==
179 color_attachment_descriptors_.end()) {
180 return;
181 }
182
183 color_attachment_descriptors_.erase(index);
184 }

## ◆ ClearDepthAttachment()

void impeller::PipelineDescriptor::ClearDepthAttachment | ( |  | ) |

Definition at line 172 of file pipeline_descriptor.cc.

172 {
173 depth_attachment_descriptor_.reset();
174 SetDepthPixelFormat(impeller::PixelFormat::kUnknown);
175 }

References impeller::kUnknown, and SetDepthPixelFormat().

## ◆ ClearStencilAttachments()

void impeller::PipelineDescriptor::ClearStencilAttachments | ( |  | ) |

Definition at line 166 of file pipeline_descriptor.cc.

166 {
167 back_stencil_attachment_descriptor_.reset();
168 front_stencil_attachment_descriptor_.reset();
169 SetStencilPixelFormat(impeller::PixelFormat::kUnknown);
170 }

References impeller::kUnknown, and SetStencilPixelFormat().

Referenced by impeller::ContentContextOptions::ApplyToPipelineDescriptor().

## ◆ GetBackStencilAttachmentDescriptor()

std::optional< StencilAttachmentDescriptor > impeller::PipelineDescriptor::GetBackStencilAttachmentDescriptor | ( |  | ) | const

Definition at line 239 of file pipeline_descriptor.cc.

239 {
240 return back_stencil_attachment_descriptor_;
241 }

Referenced by impeller::ConfigureStencil(), and impeller::CreateDepthStencilDescriptor().

## ◆ GetColorAttachmentDescriptor()

const ColorAttachmentDescriptor * impeller::PipelineDescriptor::GetColorAttachmentDescriptor | ( | size_t | index | ) | const

Definition at line 120 of file pipeline_descriptor.cc.

120 {
121 auto found = color_attachment_descriptors_.find(index);
122 return found == color_attachment_descriptors_.end() ? nullptr
123 : &found->second;
124 }

Referenced by impeller::ContentContextOptions::ApplyToPipelineDescriptor(), and GetLegacyCompatibleColorAttachment().

## ◆ GetColorAttachmentDescriptors()

const std::map< size_t, ColorAttachmentDescriptor > & impeller::PipelineDescriptor::GetColorAttachmentDescriptors | ( |  | ) | const

Definition at line 208 of file pipeline_descriptor.cc.

208 {
209 return color_attachment_descriptors_;
210 }

Referenced by impeller::CreateCompatRenderPassForPipeline(), and impeller::GetMTLRenderPipelineDescriptor().

## ◆ GetCullMode()

CullMode impeller::PipelineDescriptor::GetCullMode | ( |  | ) | const

Definition at line 252 of file pipeline_descriptor.cc.

252 {
253 return cull_mode_;
254 }

## ◆ GetDepthPixelFormat()

PixelFormat impeller::PipelineDescriptor::GetDepthPixelFormat | ( |  | ) | const

Definition at line 234 of file pipeline_descriptor.cc.

234 {
235 return depth_pixel_format_;
236 }

Referenced by impeller::CreateCompatRenderPassForPipeline(), and impeller::GetMTLRenderPipelineDescriptor().

## ◆ GetDepthStencilAttachmentDescriptor()

std::optional< DepthAttachmentDescriptor > impeller::PipelineDescriptor::GetDepthStencilAttachmentDescriptor | ( |  | ) | const

Definition at line 203 of file pipeline_descriptor.cc.

203 {
204 return depth_attachment_descriptor_;
205 }

Referenced by impeller::CreateCompatRenderPassForPipeline(), and impeller::CreateDepthStencilDescriptor().

## ◆ GetEntrypointForStage()

std::shared_ptr< const ShaderFunction > impeller::PipelineDescriptor::GetEntrypointForStage | ( | ShaderStage | stage | ) | const

Definition at line 222 of file pipeline_descriptor.cc.

223 {
224 if (auto found = entrypoints_.find(stage); found != entrypoints_.end()) {
225 return found->second;
226 }
227 return nullptr;
228 }

## ◆ GetFrontStencilAttachmentDescriptor()

std::optional< StencilAttachmentDescriptor > impeller::PipelineDescriptor::GetFrontStencilAttachmentDescriptor | ( |  | ) | const

Definition at line 198 of file pipeline_descriptor.cc.

198 {
199 return front_stencil_attachment_descriptor_;
200 }

Referenced by impeller::ContentContextOptions::ApplyToPipelineDescriptor(), impeller::ConfigureStencil(), and impeller::CreateDepthStencilDescriptor().

## ◆ GetHash()

std::size_t impeller::PipelineDescriptor::GetHash | ( |  | ) | const
| override

Definition at line 19 of file pipeline_descriptor.cc.

19 {
20 auto seed = fml::HashCombine();
21 fml::HashCombineSeed(seed, label_);
22 fml::HashCombineSeed(seed, sample_count_);
23 for (const auto& entry : entrypoints_) {
24 fml::HashCombineSeed(seed, entry.first);
25 if (auto second = entry.second) {
26 fml::HashCombineSeed(seed, second->GetHash());
27 }
28 }
29 for (const auto& des : color_attachment_descriptors_) {
30 fml::HashCombineSeed(seed, des.first);
31 fml::HashCombineSeed(seed, des.second.Hash());
32 }
33 if (vertex_descriptor_) {
34 fml::HashCombineSeed(seed, vertex_descriptor_->GetHash());
35 }
36 fml::HashCombineSeed(seed, depth_pixel_format_);
37 fml::HashCombineSeed(seed, stencil_pixel_format_);
38 fml::HashCombineSeed(seed, depth_attachment_descriptor_);
39 fml::HashCombineSeed(seed, front_stencil_attachment_descriptor_);
40 fml::HashCombineSeed(seed, back_stencil_attachment_descriptor_);
41 fml::HashCombineSeed(seed, winding_order_);
42 fml::HashCombineSeed(seed, cull_mode_);
43 fml::HashCombineSeed(seed, primitive_type_);
44 fml::HashCombineSeed(seed, polygon_mode_);
45 return seed;
46 }

Referenced by impeller::testing::TEST().

## ◆ GetLabel()

const std::string & impeller::PipelineDescriptor::GetLabel | ( |  | ) | const

Definition at line 230 of file pipeline_descriptor.cc.

230 {
231 return label_;
232 }

Referenced by impeller::CreateCompatRenderPassForPipeline(), impeller::GetMTLRenderPipelineDescriptor(), and impeller::ReportPipelineCreationFeedbackToLog().

## ◆ GetLegacyCompatibleColorAttachment()

const ColorAttachmentDescriptor * impeller::PipelineDescriptor::GetLegacyCompatibleColorAttachment | ( |  | ) | const

Definition at line 127 of file pipeline_descriptor.cc.

127 {
128 // Legacy renderers may only render to a single color attachment at index 0u.
129 if (color_attachment_descriptors_.size() != 1u) {
130 return nullptr;
131 }
132 return GetColorAttachmentDescriptor(0u);
133 }

References GetColorAttachmentDescriptor().

## ◆ GetMaxColorAttacmentBindIndex()

size_t impeller::PipelineDescriptor::GetMaxColorAttacmentBindIndex | ( |  | ) | const

Definition at line 98 of file pipeline_descriptor.cc.

98 {
99 size_t max = 0;
100 for (const auto& color : color_attachment_descriptors_) {
101 max = std::max(color.first, max);
102 }
103 return max;
104 }

Referenced by impeller::CreateCompatRenderPassForPipeline().

## ◆ GetPolygonMode()

PolygonMode impeller::PipelineDescriptor::GetPolygonMode | ( |  | ) | const

Definition at line 276 of file pipeline_descriptor.cc.

276 {
277 return polygon_mode_;
278 }

## ◆ GetPrimitiveType()

PrimitiveType impeller::PipelineDescriptor::GetPrimitiveType | ( |  | ) | const

Definition at line 268 of file pipeline_descriptor.cc.

268 {
269 return primitive_type_;
270 }

## ◆ GetSampleCount()

SampleCount impeller::PipelineDescriptor::GetSampleCount | ( |  | ) | const
| inline

Definition at line 42 of file pipeline_descriptor.h.

42 { return sample_count_; }

Referenced by impeller::CreateCompatRenderPassForPipeline(), and impeller::GetMTLRenderPipelineDescriptor().

## ◆ GetStageEntrypoints()

const std::map< ShaderStage, std::shared_ptr< const ShaderFunction > > & impeller::PipelineDescriptor::GetStageEntrypoints | ( |  | ) | const

Definition at line 218 of file pipeline_descriptor.cc.

218 {
219 return entrypoints_;
220 }

Referenced by impeller::GetMTLRenderPipelineDescriptor().

## ◆ GetStencilPixelFormat()

PixelFormat impeller::PipelineDescriptor::GetStencilPixelFormat | ( |  | ) | const

Definition at line 193 of file pipeline_descriptor.cc.

193 {
194 return stencil_pixel_format_;
195 }

Referenced by impeller::CreateCompatRenderPassForPipeline(), and impeller::GetMTLRenderPipelineDescriptor().

## ◆ GetVertexDescriptor()

const std::shared_ptr< VertexDescriptor > & impeller::PipelineDescriptor::GetVertexDescriptor | ( |  | ) | const

Definition at line 213 of file pipeline_descriptor.cc.

213 {
214 return vertex_descriptor_;
215 }

Referenced by impeller::AllocateAndBindDescriptorSets(), and impeller::GetMTLRenderPipelineDescriptor().

## ◆ GetWindingOrder()

WindingOrder impeller::PipelineDescriptor::GetWindingOrder | ( |  | ) | const

Definition at line 260 of file pipeline_descriptor.cc.

260 {
261 return winding_order_;
262 }

## ◆ HasStencilAttachmentDescriptors()

bool impeller::PipelineDescriptor::HasStencilAttachmentDescriptors | ( |  | ) | const

Definition at line 243 of file pipeline_descriptor.cc.

243 {
244 return front_stencil_attachment_descriptor_.has_value() ||
245 back_stencil_attachment_descriptor_.has_value();
246 }

Referenced by impeller::ConfigureStencil(), and impeller::CreateCompatRenderPassForPipeline().

## ◆ IsEqual()

bool impeller::PipelineDescriptor::IsEqual | ( | const PipelineDescriptor & | other | ) | const
| override virtual

Implements impeller::Comparable< PipelineDescriptor >.

Definition at line 49 of file pipeline_descriptor.cc.

49 {
50 return label_ == other.label_ && sample_count_ == other.sample_count_ &&
51 DeepCompareMap(entrypoints_, other.entrypoints_) &&
52 color_attachment_descriptors_ == other.color_attachment_descriptors_ &&
53 DeepComparePointer(vertex_descriptor_, other.vertex_descriptor_) &&
54 stencil_pixel_format_ == other.stencil_pixel_format_ &&
55 depth_pixel_format_ == other.depth_pixel_format_ &&
56 depth_attachment_descriptor_ == other.depth_attachment_descriptor_ &&
57 front_stencil_attachment_descriptor_ ==
58 other.front_stencil_attachment_descriptor_ &&
59 back_stencil_attachment_descriptor_ ==
60 other.back_stencil_attachment_descriptor_ &&
61 winding_order_ == other.winding_order_ &&
62 cull_mode_ == other.cull_mode_ &&
63 primitive_type_ == other.primitive_type_ &&
64 polygon_mode_ == other.polygon_mode_;
65 }

References impeller::DeepCompareMap(), and impeller::DeepComparePointer().

Referenced by impeller::testing::TEST().

## ◆ ResetAttachments()

void impeller::PipelineDescriptor::ResetAttachments | ( |  | ) |

Definition at line 186 of file pipeline_descriptor.cc.

186 {
187 color_attachment_descriptors_.clear();
188 depth_attachment_descriptor_.reset();
189 front_stencil_attachment_descriptor_.reset();
190 back_stencil_attachment_descriptor_.reset();
191 }

## ◆ SetColorAttachmentDescriptor()

PipelineDescriptor & impeller::PipelineDescriptor::SetColorAttachmentDescriptor | ( | size_t | index,
|  | ColorAttachmentDescriptor | desc
| ) |  |

Definition at line 106 of file pipeline_descriptor.cc.

108 {
109 color_attachment_descriptors_[index] = desc;
110 return *this;
111 }

Referenced by impeller::ContentContextOptions::ApplyToPipelineDescriptor(), impeller::PipelineBuilder< VertexShader_, FragmentShader_ >::InitializePipelineDescriptorDefaults(), impeller::RuntimeEffectContents::Render(), and impeller::testing::TEST_P().

## ◆ SetColorAttachmentDescriptors()

PipelineDescriptor & impeller::PipelineDescriptor::SetColorAttachmentDescriptors | ( | std::map< size_t, ColorAttachmentDescriptor > | descriptors | ) |

Definition at line 113 of file pipeline_descriptor.cc.

114 {
115 color_attachment_descriptors_ = std::move(descriptors);
116 return *this;
117 }

## ◆ SetCullMode()

void impeller::PipelineDescriptor::SetCullMode | ( | CullMode | mode | ) |

Definition at line 248 of file pipeline_descriptor.cc.

248 {
249 cull_mode_ = mode;
250 }

Referenced by impeller::scene::SceneContextOptions::ApplyToPipelineDescriptor().

## ◆ SetDepthPixelFormat()

PipelineDescriptor & impeller::PipelineDescriptor::SetDepthPixelFormat | ( | PixelFormat | format | ) |

Definition at line 135 of file pipeline_descriptor.cc.

136 {
137 depth_pixel_format_ = format;
138 return *this;
139 }

Referenced by impeller::scene::SceneContextOptions::ApplyToPipelineDescriptor(), and ClearDepthAttachment().

## ◆ SetDepthStencilAttachmentDescriptor()

PipelineDescriptor & impeller::PipelineDescriptor::SetDepthStencilAttachmentDescriptor | ( | std::optional< DepthAttachmentDescriptor > | desc | ) |

Definition at line 147 of file pipeline_descriptor.cc.

148 {
149 depth_attachment_descriptor_ = desc;
150 return *this;
151 }

Referenced by impeller::scene::SceneContextOptions::ApplyToPipelineDescriptor().

## ◆ SetLabel()

PipelineDescriptor & impeller::PipelineDescriptor::SetLabel | ( | std::string | label | ) |

Definition at line 67 of file pipeline_descriptor.cc.

67 {
68 label_ = std::move(label);
69 return *this;
70 }

Referenced by impeller::PipelineBuilder< VertexShader_, FragmentShader_ >::InitializePipelineDescriptorDefaults(), impeller::RuntimeEffectContents::Render(), and impeller::testing::TEST_P().

## ◆ SetPolygonMode()

void impeller::PipelineDescriptor::SetPolygonMode | ( | PolygonMode | mode | ) |

Definition at line 272 of file pipeline_descriptor.cc.

272 {
273 polygon_mode_ = mode;
274 }

Referenced by impeller::ContentContextOptions::ApplyToPipelineDescriptor().

## ◆ SetPrimitiveType()

void impeller::PipelineDescriptor::SetPrimitiveType | ( | PrimitiveType | type | ) |

Definition at line 264 of file pipeline_descriptor.cc.

264 {
265 primitive_type_ = type;
266 }

Referenced by impeller::scene::SceneContextOptions::ApplyToPipelineDescriptor(), impeller::ContentContextOptions::ApplyToPipelineDescriptor(), and impeller::testing::TEST().

## ◆ SetSampleCount()

PipelineDescriptor & impeller::PipelineDescriptor::SetSampleCount | ( | SampleCount | samples | ) |

Definition at line 72 of file pipeline_descriptor.cc.

72 {
73 sample_count_ = samples;
74 return *this;
75 }

Referenced by impeller::scene::SceneContextOptions::ApplyToPipelineDescriptor(), and impeller::ContentContextOptions::ApplyToPipelineDescriptor().

## ◆ SetStencilAttachmentDescriptors() [1/2]

PipelineDescriptor & impeller::PipelineDescriptor::SetStencilAttachmentDescriptors | ( | std::optional< StencilAttachmentDescriptor > | front,
|  | std::optional< StencilAttachmentDescriptor > | back
| ) |  |

Definition at line 158 of file pipeline_descriptor.cc.

160 {
161 front_stencil_attachment_descriptor_ = front;
162 back_stencil_attachment_descriptor_ = back;
163 return *this;
164 }

## ◆ SetStencilAttachmentDescriptors() [2/2]

PipelineDescriptor & impeller::PipelineDescriptor::SetStencilAttachmentDescriptors | ( | std::optional< StencilAttachmentDescriptor > | front_and_back | ) |

Definition at line 153 of file pipeline_descriptor.cc.

154 {
155 return SetStencilAttachmentDescriptors(front_and_back, front_and_back);
156 }

Referenced by impeller::scene::SceneContextOptions::ApplyToPipelineDescriptor(), impeller::ContentContextOptions::ApplyToPipelineDescriptor(), impeller::PipelineBuilder< VertexShader_, FragmentShader_ >::InitializePipelineDescriptorDefaults(), impeller::RuntimeEffectContents::Render(), and impeller::testing::TEST_P().

## ◆ SetStencilPixelFormat()

PipelineDescriptor & impeller::PipelineDescriptor::SetStencilPixelFormat | ( | PixelFormat | format | ) |

Definition at line 141 of file pipeline_descriptor.cc.

142 {
143 stencil_pixel_format_ = format;
144 return *this;
145 }

Referenced by impeller::scene::SceneContextOptions::ApplyToPipelineDescriptor(), ClearStencilAttachments(), impeller::PipelineBuilder< VertexShader_, FragmentShader_ >::InitializePipelineDescriptorDefaults(), impeller::RuntimeEffectContents::Render(), and impeller::testing::TEST_P().

## ◆ SetVertexDescriptor()

PipelineDescriptor & impeller::PipelineDescriptor::SetVertexDescriptor | ( | std::shared_ptr< VertexDescriptor > | vertex_descriptor | ) |

Definition at line 92 of file pipeline_descriptor.cc.

93 {
94 vertex_descriptor_ = std::move(vertex_descriptor);
95 return *this;
96 }

Referenced by impeller::PipelineBuilder< VertexShader_, FragmentShader_ >::InitializePipelineDescriptorDefaults(), impeller::RuntimeEffectContents::Render(), impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ SetWindingOrder()

void impeller::PipelineDescriptor::SetWindingOrder | ( | WindingOrder | order | ) |

Definition at line 256 of file pipeline_descriptor.cc.

256 {
257 winding_order_ = order;
258 }

Referenced by impeller::scene::SceneContextOptions::ApplyToPipelineDescriptor().

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

- impeller/renderer/pipeline_descriptor.h
- impeller/renderer/pipeline_descriptor.cc

impeller::DeepComparePointer
bool DeepComparePointer(const std::shared_ptr< ComparableType > &lhs, const std::shared_ptr< ComparableType > &rhs)
Definition: comparable.h:60
impeller::ShaderStage::kUnknown
@ kUnknown
impeller::PipelineDescriptor::SetStencilAttachmentDescriptors
PipelineDescriptor & SetStencilAttachmentDescriptors(std::optional< StencilAttachmentDescriptor > front_and_back)
Definition: pipeline_descriptor.cc:153
impeller::PipelineDescriptor::SetStencilPixelFormat
PipelineDescriptor & SetStencilPixelFormat(PixelFormat format)
Definition: pipeline_descriptor.cc:141
impeller::PipelineDescriptor::GetColorAttachmentDescriptor
const ColorAttachmentDescriptor * GetColorAttachmentDescriptor(size_t index) const
Definition: pipeline_descriptor.cc:120
impeller::PixelFormat::kUnknown
@ kUnknown
impeller::PipelineDescriptor::SetDepthPixelFormat
PipelineDescriptor & SetDepthPixelFormat(PixelFormat format)
Definition: pipeline_descriptor.cc:135
impeller::DeepCompareMap
bool DeepCompareMap(const std::map< Key, std::shared_ptr< ComparableType >> &lhs, const std::map< Key, std::shared_ptr< ComparableType >> &rhs)
Definition: comparable.h:77