27 for (
const auto& entry : entrypoints_) {
29 if (
auto second = entry.second) {
33 for (
const auto& des : color_attachment_descriptors_) {
37 if (vertex_descriptor_) {
54 return label_ == other.label_ && sample_count_ == other.sample_count_ &&
56 color_attachment_descriptors_ == other.color_attachment_descriptors_ &&
58 stencil_pixel_format_ == other.stencil_pixel_format_ &&
59 depth_pixel_format_ == other.depth_pixel_format_ &&
60 depth_attachment_descriptor_ == other.depth_attachment_descriptor_ &&
61 front_stencil_attachment_descriptor_ ==
62 other.front_stencil_attachment_descriptor_ &&
63 back_stencil_attachment_descriptor_ ==
64 other.back_stencil_attachment_descriptor_ &&
65 winding_order_ == other.winding_order_ &&
66 cull_mode_ == other.cull_mode_ &&
67 primitive_type_ == other.primitive_type_ &&
68 polygon_mode_ == other.polygon_mode_ &&
69 specialization_constants_ == other.specialization_constants_;
73 label_ = std::string(label);
78 sample_count_ = samples;
83 std::shared_ptr<const ShaderFunction> function) {
98 std::shared_ptr<VertexDescriptor> vertex_descriptor) {
99 vertex_descriptor_ = std::move(vertex_descriptor);
105 for (
const auto& color : color_attachment_descriptors_) {
106 max = std::max(color.first, max);
114 color_attachment_descriptors_[index] = desc;
119 std::map<size_t /* index */, ColorAttachmentDescriptor> descriptors) {
120 color_attachment_descriptors_ = std::move(descriptors);
126 auto found = color_attachment_descriptors_.find(index);
127 return found == color_attachment_descriptors_.end() ? nullptr
134 if (color_attachment_descriptors_.size() != 1u) {
142 depth_pixel_format_ =
format;
148 stencil_pixel_format_ =
format;
153 std::optional<DepthAttachmentDescriptor> desc) {
154 depth_attachment_descriptor_ = desc;
159 std::optional<StencilAttachmentDescriptor> front_and_back) {
164 std::optional<StencilAttachmentDescriptor> front,
165 std::optional<StencilAttachmentDescriptor> back) {
166 front_stencil_attachment_descriptor_ = front;
167 back_stencil_attachment_descriptor_ = back;
172 back_stencil_attachment_descriptor_.reset();
173 front_stencil_attachment_descriptor_.reset();
178 depth_attachment_descriptor_.reset();
183 if (color_attachment_descriptors_.find(index) ==
184 color_attachment_descriptors_.end()) {
188 color_attachment_descriptors_.erase(index);
192 color_attachment_descriptors_.clear();
193 depth_attachment_descriptor_.reset();
194 front_stencil_attachment_descriptor_.reset();
195 back_stencil_attachment_descriptor_.reset();
199 return stencil_pixel_format_;
202std::optional<StencilAttachmentDescriptor>
204 return front_stencil_attachment_descriptor_;
207std::optional<DepthAttachmentDescriptor>
209 return depth_attachment_descriptor_;
214 return color_attachment_descriptors_;
217const std::shared_ptr<VertexDescriptor>&
219 return vertex_descriptor_;
222const std::map<ShaderStage, std::shared_ptr<const ShaderFunction>>&
229 if (
auto found = entrypoints_.find(stage); found != entrypoints_.end()) {
230 return found->second;
240 return depth_pixel_format_;
243std::optional<StencilAttachmentDescriptor>
245 return back_stencil_attachment_descriptor_;
249 return front_stencil_attachment_descriptor_.has_value() ||
250 back_stencil_attachment_descriptor_.has_value();
262 winding_order_ = order;
266 return winding_order_;
270 primitive_type_ =
type;
274 return primitive_type_;
278 polygon_mode_ = mode;
282 return polygon_mode_;
286 std::vector<Scalar> values) {
287 specialization_constants_ = std::move(values);
292 return specialization_constants_;
PipelineDescriptor & SetStencilPixelFormat(PixelFormat format)
PipelineDescriptor & SetDepthStencilAttachmentDescriptor(std::optional< DepthAttachmentDescriptor > desc)
std::string_view GetLabel() const
void ClearStencilAttachments()
std::size_t GetHash() const override
PixelFormat GetDepthPixelFormat() const
CullMode GetCullMode() const
void SetCullMode(CullMode mode)
PipelineDescriptor & SetVertexDescriptor(std::shared_ptr< VertexDescriptor > vertex_descriptor)
void SetPolygonMode(PolygonMode mode)
PrimitiveType GetPrimitiveType() const
PolygonMode GetPolygonMode() const
size_t GetMaxColorAttacmentBindIndex() const
std::optional< DepthAttachmentDescriptor > GetDepthStencilAttachmentDescriptor() const
PipelineDescriptor & AddStageEntrypoint(std::shared_ptr< const ShaderFunction > function)
bool IsEqual(const PipelineDescriptor &other) const override
const std::map< ShaderStage, std::shared_ptr< const ShaderFunction > > & GetStageEntrypoints() const
PixelFormat GetStencilPixelFormat() const
const ColorAttachmentDescriptor * GetLegacyCompatibleColorAttachment() const
PipelineDescriptor & SetLabel(std::string_view label)
void SetSpecializationConstants(std::vector< Scalar > values)
const std::vector< Scalar > & GetSpecializationConstants() const
PipelineDescriptor & SetDepthPixelFormat(PixelFormat format)
PipelineDescriptor & SetStencilAttachmentDescriptors(std::optional< StencilAttachmentDescriptor > front_and_back)
const ColorAttachmentDescriptor * GetColorAttachmentDescriptor(size_t index) const
WindingOrder GetWindingOrder() const
PipelineDescriptor & SetColorAttachmentDescriptor(size_t index, ColorAttachmentDescriptor desc)
PipelineDescriptor & SetSampleCount(SampleCount samples)
void SetPrimitiveType(PrimitiveType type)
std::shared_ptr< const ShaderFunction > GetEntrypointForStage(ShaderStage stage) const
const std::map< size_t, ColorAttachmentDescriptor > & GetColorAttachmentDescriptors() const
std::optional< StencilAttachmentDescriptor > GetBackStencilAttachmentDescriptor() const
const std::shared_ptr< VertexDescriptor > & GetVertexDescriptor() const
void ClearDepthAttachment()
std::optional< StencilAttachmentDescriptor > GetFrontStencilAttachmentDescriptor() const
void SetWindingOrder(WindingOrder order)
void ClearColorAttachment(size_t index)
PipelineDescriptor & SetColorAttachmentDescriptors(std::map< size_t, ColorAttachmentDescriptor > descriptors)
bool HasStencilAttachmentDescriptors() const
uint32_t uint32_t * format
Dart_NativeFunction function
constexpr std::size_t HashCombine()
constexpr void HashCombineSeed(std::size_t &seed, const Type &arg)
PrimitiveType
Decides how backend draws pixels based on input vertices.
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
bool DeepComparePointer(const std::shared_ptr< ComparableType > &lhs, const std::shared_ptr< ComparableType > &rhs)
bool DeepCompareMap(const std::map< Key, std::shared_ptr< ComparableType > > &lhs, const std::map< Key, std::shared_ptr< ComparableType > > &rhs)
Describe the color attachment that will be used with this pipeline.