Flutter Engine
The Flutter Engine
pipeline_descriptor.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_IMPELLER_RENDERER_PIPELINE_DESCRIPTOR_H_
6#define FLUTTER_IMPELLER_RENDERER_PIPELINE_DESCRIPTOR_H_
7
8#include <map>
9#include <memory>
10#include <string>
11
16
17namespace impeller {
18
19class ShaderFunction;
20class VertexDescriptor;
21template <typename T>
22class Pipeline;
23
24class PipelineDescriptor final : public Comparable<PipelineDescriptor> {
25 public:
27
29
30 PipelineDescriptor& SetLabel(std::string label);
31
32 const std::string& GetLabel() const;
33
35
36 SampleCount GetSampleCount() const { return sample_count_; }
37
39 std::shared_ptr<const ShaderFunction> function);
40
41 const std::map<ShaderStage, std::shared_ptr<const ShaderFunction>>&
42 GetStageEntrypoints() const;
43
44 std::shared_ptr<const ShaderFunction> GetEntrypointForStage(
45 ShaderStage stage) const;
46
48 std::shared_ptr<VertexDescriptor> vertex_descriptor);
49
50 const std::shared_ptr<VertexDescriptor>& GetVertexDescriptor() const;
51
52 size_t GetMaxColorAttacmentBindIndex() const;
53
55 size_t index,
57
59 std::map<size_t /* index */, ColorAttachmentDescriptor> descriptors);
60
62 size_t index) const;
63
64 const std::map<size_t /* index */, ColorAttachmentDescriptor>&
66
68
70 std::optional<DepthAttachmentDescriptor> desc);
71
72 std::optional<DepthAttachmentDescriptor> GetDepthStencilAttachmentDescriptor()
73 const;
74
76 std::optional<StencilAttachmentDescriptor> front_and_back);
77
79 std::optional<StencilAttachmentDescriptor> front,
80 std::optional<StencilAttachmentDescriptor> back);
81
83
85
86 void ClearColorAttachment(size_t index);
87
88 std::optional<StencilAttachmentDescriptor>
90
91 std::optional<StencilAttachmentDescriptor>
93
95
97
99
101
103
104 // Comparable<PipelineDescriptor>
105 std::size_t GetHash() const override;
106
107 // Comparable<PipelineDescriptor>
108 bool IsEqual(const PipelineDescriptor& other) const override;
109
110 void ResetAttachments();
111
113
114 CullMode GetCullMode() const;
115
116 void SetWindingOrder(WindingOrder order);
117
119
121
123
125
127
128 void SetSpecializationConstants(std::vector<Scalar> values);
129
130 const std::vector<Scalar>& GetSpecializationConstants() const;
131
132 private:
133 std::string label_;
134 SampleCount sample_count_ = SampleCount::kCount1;
135 WindingOrder winding_order_ = WindingOrder::kClockwise;
136 CullMode cull_mode_ = CullMode::kNone;
137 std::map<ShaderStage, std::shared_ptr<const ShaderFunction>> entrypoints_;
138 std::map<size_t /* index */, ColorAttachmentDescriptor>
139 color_attachment_descriptors_;
140 std::shared_ptr<VertexDescriptor> vertex_descriptor_;
141 PixelFormat depth_pixel_format_ = PixelFormat::kUnknown;
142 PixelFormat stencil_pixel_format_ = PixelFormat::kUnknown;
143 std::optional<DepthAttachmentDescriptor> depth_attachment_descriptor_;
144 std::optional<StencilAttachmentDescriptor>
145 front_stencil_attachment_descriptor_;
146 std::optional<StencilAttachmentDescriptor>
147 back_stencil_attachment_descriptor_;
148 PrimitiveType primitive_type_ = PrimitiveType::kTriangle;
149 PolygonMode polygon_mode_ = PolygonMode::kFill;
150 std::vector<Scalar> specialization_constants_;
151};
152
153} // namespace impeller
154
155#endif // FLUTTER_IMPELLER_RENDERER_PIPELINE_DESCRIPTOR_H_
GLenum type
PipelineDescriptor & SetStencilPixelFormat(PixelFormat format)
PipelineDescriptor & SetDepthStencilAttachmentDescriptor(std::optional< DepthAttachmentDescriptor > desc)
std::size_t GetHash() const override
PixelFormat GetDepthPixelFormat() const
PipelineDescriptor & SetVertexDescriptor(std::shared_ptr< VertexDescriptor > vertex_descriptor)
void SetPolygonMode(PolygonMode mode)
PrimitiveType GetPrimitiveType() 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
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 & SetLabel(std::string label)
PipelineDescriptor & SetColorAttachmentDescriptor(size_t index, ColorAttachmentDescriptor desc)
PipelineDescriptor & SetSampleCount(SampleCount samples)
void SetPrimitiveType(PrimitiveType type)
const std::string & GetLabel() const
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
std::optional< StencilAttachmentDescriptor > GetFrontStencilAttachmentDescriptor() const
void SetWindingOrder(WindingOrder order)
void ClearColorAttachment(size_t index)
PipelineDescriptor & SetColorAttachmentDescriptors(std::map< size_t, ColorAttachmentDescriptor > descriptors)
SampleCount GetSampleCount() const
uint32_t uint32_t * format
Dart_NativeFunction function
Definition: fuchsia.cc:51
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
PrimitiveType
Decides how backend draws pixels based on input vertices.
Definition: formats.h:352
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
Definition: formats.h:99
WindingOrder
Definition: formats.h:22
PolygonMode
Definition: formats.h:383
SampleCount
Definition: formats.h:295
SI auto map(std::index_sequence< I... >, Fn &&fn, const Args &... args) -> skvx::Vec< sizeof...(I), decltype(fn(args[0]...))>
Definition: SkVx.h:680
Describe the color attachment that will be used with this pipeline.
Definition: formats.h:512