Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
impeller::PipelineDescriptor Class Referencefinal

#include <pipeline_descriptor.h>

Inheritance diagram for impeller::PipelineDescriptor:
impeller::Comparable< PipelineDescriptor > impeller::ComparableBase

Public Member Functions

 PipelineDescriptor ()
 
 ~PipelineDescriptor ()
 
PipelineDescriptorSetLabel (std::string label)
 
const std::string & GetLabel () const
 
PipelineDescriptorSetSampleCount (SampleCount samples)
 
SampleCount GetSampleCount () const
 
PipelineDescriptorAddStageEntrypoint (std::shared_ptr< const ShaderFunction > function)
 
const std::map< ShaderStage, std::shared_ptr< const ShaderFunction > > & GetStageEntrypoints () const
 
std::shared_ptr< const ShaderFunctionGetEntrypointForStage (ShaderStage stage) const
 
PipelineDescriptorSetVertexDescriptor (std::shared_ptr< VertexDescriptor > vertex_descriptor)
 
const std::shared_ptr< VertexDescriptor > & GetVertexDescriptor () const
 
size_t GetMaxColorAttacmentBindIndex () const
 
PipelineDescriptorSetColorAttachmentDescriptor (size_t index, ColorAttachmentDescriptor desc)
 
PipelineDescriptorSetColorAttachmentDescriptors (std::map< size_t, ColorAttachmentDescriptor > descriptors)
 
const ColorAttachmentDescriptorGetColorAttachmentDescriptor (size_t index) const
 
const std::map< size_t, ColorAttachmentDescriptor > & GetColorAttachmentDescriptors () const
 
const ColorAttachmentDescriptorGetLegacyCompatibleColorAttachment () const
 
PipelineDescriptorSetDepthStencilAttachmentDescriptor (std::optional< DepthAttachmentDescriptor > desc)
 
std::optional< DepthAttachmentDescriptorGetDepthStencilAttachmentDescriptor () const
 
PipelineDescriptorSetStencilAttachmentDescriptors (std::optional< StencilAttachmentDescriptor > front_and_back)
 
PipelineDescriptorSetStencilAttachmentDescriptors (std::optional< StencilAttachmentDescriptor > front, std::optional< StencilAttachmentDescriptor > back)
 
void ClearStencilAttachments ()
 
void ClearDepthAttachment ()
 
void ClearColorAttachment (size_t index)
 
std::optional< StencilAttachmentDescriptorGetFrontStencilAttachmentDescriptor () const
 
std::optional< StencilAttachmentDescriptorGetBackStencilAttachmentDescriptor () const
 
bool HasStencilAttachmentDescriptors () const
 
PipelineDescriptorSetDepthPixelFormat (PixelFormat format)
 
PixelFormat GetDepthPixelFormat () const
 
PipelineDescriptorSetStencilPixelFormat (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
 
void SetSpecializationConstants (std::vector< Scalar > values)
 
const std::vector< Scalar > & GetSpecializationConstants () const
 

Detailed Description

Definition at line 24 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 81 of file pipeline_descriptor.cc.

82 {
83 if (!function) {
84 return *this;
85 }
86
87 if (function->GetStage() == ShaderStage::kUnknown) {
88 return *this;
89 }
90
91 entrypoints_[function->GetStage()] = std::move(function);
92
93 return *this;
94}
Dart_NativeFunction function
Definition fuchsia.cc:51

◆ ClearColorAttachment()

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

Definition at line 181 of file pipeline_descriptor.cc.

181 {
182 if (color_attachment_descriptors_.find(index) ==
183 color_attachment_descriptors_.end()) {
184 return;
185 }
186
187 color_attachment_descriptors_.erase(index);
188}

◆ ClearDepthAttachment()

void impeller::PipelineDescriptor::ClearDepthAttachment ( )

Definition at line 176 of file pipeline_descriptor.cc.

176 {
177 depth_attachment_descriptor_.reset();
179}
PipelineDescriptor & SetDepthPixelFormat(PixelFormat format)

◆ ClearStencilAttachments()

void impeller::PipelineDescriptor::ClearStencilAttachments ( )

Definition at line 170 of file pipeline_descriptor.cc.

170 {
171 back_stencil_attachment_descriptor_.reset();
172 front_stencil_attachment_descriptor_.reset();
174}
PipelineDescriptor & SetStencilPixelFormat(PixelFormat format)

◆ GetBackStencilAttachmentDescriptor()

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

Definition at line 243 of file pipeline_descriptor.cc.

243 {
244 return back_stencil_attachment_descriptor_;
245}

◆ GetColorAttachmentDescriptor()

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

Definition at line 124 of file pipeline_descriptor.cc.

124 {
125 auto found = color_attachment_descriptors_.find(index);
126 return found == color_attachment_descriptors_.end() ? nullptr
127 : &found->second;
128}

◆ GetColorAttachmentDescriptors()

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

Definition at line 212 of file pipeline_descriptor.cc.

212 {
213 return color_attachment_descriptors_;
214}

◆ GetCullMode()

CullMode impeller::PipelineDescriptor::GetCullMode ( ) const

Definition at line 256 of file pipeline_descriptor.cc.

256 {
257 return cull_mode_;
258}

◆ GetDepthPixelFormat()

PixelFormat impeller::PipelineDescriptor::GetDepthPixelFormat ( ) const

Definition at line 238 of file pipeline_descriptor.cc.

238 {
239 return depth_pixel_format_;
240}

◆ GetDepthStencilAttachmentDescriptor()

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

Definition at line 207 of file pipeline_descriptor.cc.

207 {
208 return depth_attachment_descriptor_;
209}

◆ GetEntrypointForStage()

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

Definition at line 226 of file pipeline_descriptor.cc.

227 {
228 if (auto found = entrypoints_.find(stage); found != entrypoints_.end()) {
229 return found->second;
230 }
231 return nullptr;
232}

◆ GetFrontStencilAttachmentDescriptor()

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

Definition at line 202 of file pipeline_descriptor.cc.

202 {
203 return front_stencil_attachment_descriptor_;
204}

◆ GetHash()

std::size_t impeller::PipelineDescriptor::GetHash ( ) const
overridevirtual

Implements impeller::Comparable< PipelineDescriptor >.

Definition at line 22 of file pipeline_descriptor.cc.

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

◆ GetLabel()

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

Definition at line 234 of file pipeline_descriptor.cc.

234 {
235 return label_;
236}

◆ GetLegacyCompatibleColorAttachment()

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

Definition at line 131 of file pipeline_descriptor.cc.

131 {
132 // Legacy renderers may only render to a single color attachment at index 0u.
133 if (color_attachment_descriptors_.size() != 1u) {
134 return nullptr;
135 }
137}
const ColorAttachmentDescriptor * GetColorAttachmentDescriptor(size_t index) const

◆ GetMaxColorAttacmentBindIndex()

size_t impeller::PipelineDescriptor::GetMaxColorAttacmentBindIndex ( ) const

Definition at line 102 of file pipeline_descriptor.cc.

102 {
103 size_t max = 0;
104 for (const auto& color : color_attachment_descriptors_) {
105 max = std::max(color.first, max);
106 }
107 return max;
108}
SkColor4f color
static float max(float r, float g, float b)
Definition hsl.cpp:49

◆ GetPolygonMode()

PolygonMode impeller::PipelineDescriptor::GetPolygonMode ( ) const

Definition at line 280 of file pipeline_descriptor.cc.

280 {
281 return polygon_mode_;
282}

◆ GetPrimitiveType()

PrimitiveType impeller::PipelineDescriptor::GetPrimitiveType ( ) const

Definition at line 272 of file pipeline_descriptor.cc.

272 {
273 return primitive_type_;
274}

◆ GetSampleCount()

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

Definition at line 36 of file pipeline_descriptor.h.

36{ return sample_count_; }

◆ GetSpecializationConstants()

const std::vector< Scalar > & impeller::PipelineDescriptor::GetSpecializationConstants ( ) const

Definition at line 289 of file pipeline_descriptor.cc.

290 {
291 return specialization_constants_;
292}

◆ GetStageEntrypoints()

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

Definition at line 222 of file pipeline_descriptor.cc.

222 {
223 return entrypoints_;
224}

◆ GetStencilPixelFormat()

PixelFormat impeller::PipelineDescriptor::GetStencilPixelFormat ( ) const

Definition at line 197 of file pipeline_descriptor.cc.

197 {
198 return stencil_pixel_format_;
199}

◆ GetVertexDescriptor()

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

Definition at line 217 of file pipeline_descriptor.cc.

217 {
218 return vertex_descriptor_;
219}

◆ GetWindingOrder()

WindingOrder impeller::PipelineDescriptor::GetWindingOrder ( ) const

Definition at line 264 of file pipeline_descriptor.cc.

264 {
265 return winding_order_;
266}

◆ HasStencilAttachmentDescriptors()

bool impeller::PipelineDescriptor::HasStencilAttachmentDescriptors ( ) const

Definition at line 247 of file pipeline_descriptor.cc.

247 {
248 return front_stencil_attachment_descriptor_.has_value() ||
249 back_stencil_attachment_descriptor_.has_value();
250}

◆ IsEqual()

bool impeller::PipelineDescriptor::IsEqual ( const PipelineDescriptor other) const
overridevirtual

Implements impeller::Comparable< PipelineDescriptor >.

Definition at line 52 of file pipeline_descriptor.cc.

52 {
53 return label_ == other.label_ && sample_count_ == other.sample_count_ &&
54 DeepCompareMap(entrypoints_, other.entrypoints_) &&
55 color_attachment_descriptors_ == other.color_attachment_descriptors_ &&
56 DeepComparePointer(vertex_descriptor_, other.vertex_descriptor_) &&
57 stencil_pixel_format_ == other.stencil_pixel_format_ &&
58 depth_pixel_format_ == other.depth_pixel_format_ &&
59 depth_attachment_descriptor_ == other.depth_attachment_descriptor_ &&
60 front_stencil_attachment_descriptor_ ==
61 other.front_stencil_attachment_descriptor_ &&
62 back_stencil_attachment_descriptor_ ==
63 other.back_stencil_attachment_descriptor_ &&
64 winding_order_ == other.winding_order_ &&
65 cull_mode_ == other.cull_mode_ &&
66 primitive_type_ == other.primitive_type_ &&
67 polygon_mode_ == other.polygon_mode_ &&
68 specialization_constants_ == other.specialization_constants_;
69}
bool DeepComparePointer(const std::shared_ptr< ComparableType > &lhs, const std::shared_ptr< ComparableType > &rhs)
Definition comparable.h:57
bool DeepCompareMap(const std::map< Key, std::shared_ptr< ComparableType > > &lhs, const std::map< Key, std::shared_ptr< ComparableType > > &rhs)
Definition comparable.h:74

◆ ResetAttachments()

void impeller::PipelineDescriptor::ResetAttachments ( )

Definition at line 190 of file pipeline_descriptor.cc.

190 {
191 color_attachment_descriptors_.clear();
192 depth_attachment_descriptor_.reset();
193 front_stencil_attachment_descriptor_.reset();
194 back_stencil_attachment_descriptor_.reset();
195}

◆ SetColorAttachmentDescriptor()

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

Definition at line 110 of file pipeline_descriptor.cc.

112 {
113 color_attachment_descriptors_[index] = desc;
114 return *this;
115}

◆ SetColorAttachmentDescriptors()

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

Definition at line 117 of file pipeline_descriptor.cc.

118 {
119 color_attachment_descriptors_ = std::move(descriptors);
120 return *this;
121}

◆ SetCullMode()

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

Definition at line 252 of file pipeline_descriptor.cc.

252 {
253 cull_mode_ = mode;
254}
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition switches.h:228

◆ SetDepthPixelFormat()

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

Definition at line 139 of file pipeline_descriptor.cc.

140 {
141 depth_pixel_format_ = format;
142 return *this;
143}
uint32_t uint32_t * format

◆ SetDepthStencilAttachmentDescriptor()

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

Definition at line 151 of file pipeline_descriptor.cc.

152 {
153 depth_attachment_descriptor_ = desc;
154 return *this;
155}

◆ SetLabel()

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

Definition at line 71 of file pipeline_descriptor.cc.

71 {
72 label_ = std::move(label);
73 return *this;
74}

◆ SetPolygonMode()

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

Definition at line 276 of file pipeline_descriptor.cc.

276 {
277 polygon_mode_ = mode;
278}

◆ SetPrimitiveType()

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

Definition at line 268 of file pipeline_descriptor.cc.

268 {
269 primitive_type_ = type;
270}

◆ SetSampleCount()

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

Definition at line 76 of file pipeline_descriptor.cc.

76 {
77 sample_count_ = samples;
78 return *this;
79}

◆ SetSpecializationConstants()

void impeller::PipelineDescriptor::SetSpecializationConstants ( std::vector< Scalar values)

Definition at line 284 of file pipeline_descriptor.cc.

285 {
286 specialization_constants_ = std::move(values);
287}

◆ SetStencilAttachmentDescriptors() [1/2]

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

Definition at line 162 of file pipeline_descriptor.cc.

164 {
165 front_stencil_attachment_descriptor_ = front;
166 back_stencil_attachment_descriptor_ = back;
167 return *this;
168}

◆ SetStencilAttachmentDescriptors() [2/2]

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

Definition at line 157 of file pipeline_descriptor.cc.

158 {
159 return SetStencilAttachmentDescriptors(front_and_back, front_and_back);
160}
PipelineDescriptor & SetStencilAttachmentDescriptors(std::optional< StencilAttachmentDescriptor > front_and_back)

◆ SetStencilPixelFormat()

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

Definition at line 145 of file pipeline_descriptor.cc.

146 {
147 stencil_pixel_format_ = format;
148 return *this;
149}

◆ SetVertexDescriptor()

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

Definition at line 96 of file pipeline_descriptor.cc.

97 {
98 vertex_descriptor_ = std::move(vertex_descriptor);
99 return *this;
100}

◆ SetWindingOrder()

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

Definition at line 260 of file pipeline_descriptor.cc.

260 {
261 winding_order_ = order;
262}

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