26 for (
const auto& entry : entrypoints_) {
28 if (
auto second = entry.second) {
32 for (
const auto& des : color_attachment_descriptors_) {
36 if (vertex_descriptor_) {
53 return label_ == other.label_ && sample_count_ == other.sample_count_ &&
55 color_attachment_descriptors_ == other.color_attachment_descriptors_ &&
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_;
72 label_ = std::string(label);
77 sample_count_ = samples;
82 std::shared_ptr<const ShaderFunction> function) {
97 std::shared_ptr<VertexDescriptor> vertex_descriptor) {
98 vertex_descriptor_ = std::move(vertex_descriptor);
104 for (
const auto& color : color_attachment_descriptors_) {
105 max = std::max(color.first, max);
113 color_attachment_descriptors_[index] = desc;
118 std::map<size_t /* index */, ColorAttachmentDescriptor> descriptors) {
119 color_attachment_descriptors_ = std::move(descriptors);
125 auto found = color_attachment_descriptors_.find(index);
126 return found == color_attachment_descriptors_.end() ? nullptr
133 if (color_attachment_descriptors_.size() != 1u) {
141 depth_pixel_format_ =
format;
147 stencil_pixel_format_ =
format;
152 std::optional<DepthAttachmentDescriptor> desc) {
153 depth_attachment_descriptor_ = desc;
158 std::optional<StencilAttachmentDescriptor> front_and_back) {
163 std::optional<StencilAttachmentDescriptor> front,
164 std::optional<StencilAttachmentDescriptor> back) {
165 front_stencil_attachment_descriptor_ = front;
166 back_stencil_attachment_descriptor_ = back;
171 back_stencil_attachment_descriptor_.reset();
172 front_stencil_attachment_descriptor_.reset();
177 depth_attachment_descriptor_.reset();
182 if (color_attachment_descriptors_.find(index) ==
183 color_attachment_descriptors_.end()) {
187 color_attachment_descriptors_.erase(index);
191 color_attachment_descriptors_.clear();
192 depth_attachment_descriptor_.reset();
193 front_stencil_attachment_descriptor_.reset();
194 back_stencil_attachment_descriptor_.reset();
198 return stencil_pixel_format_;
201std::optional<StencilAttachmentDescriptor>
203 return front_stencil_attachment_descriptor_;
206std::optional<DepthAttachmentDescriptor>
208 return depth_attachment_descriptor_;
213 return color_attachment_descriptors_;
216const std::shared_ptr<VertexDescriptor>&
218 return vertex_descriptor_;
221const std::map<ShaderStage, std::shared_ptr<const ShaderFunction>>&
228 if (
auto found = entrypoints_.find(stage); found != entrypoints_.end()) {
229 return found->second;
239 return depth_pixel_format_;
242std::optional<StencilAttachmentDescriptor>
244 return back_stencil_attachment_descriptor_;
248 return front_stencil_attachment_descriptor_.has_value() ||
249 back_stencil_attachment_descriptor_.has_value();
261 winding_order_ = order;
265 return winding_order_;
269 primitive_type_ =
type;
273 return primitive_type_;
277 polygon_mode_ = mode;
281 return polygon_mode_;
285 std::vector<Scalar> values) {
286 specialization_constants_ = std::move(values);
291 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.