Skip to content

Commit b5ed864

Browse files
chinmaygardednfield
authored andcommitted
Fixup names of pipeline descriptors.
1 parent e95252f commit b5ed864

File tree

6 files changed

+46
-44
lines changed

6 files changed

+46
-44
lines changed

impeller/renderer/backend/metal/formats_mtl.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -251,12 +251,12 @@ constexpr MTLClearColor ToMTLClearColor(const Color& color) {
251251

252252
MTLRenderPipelineColorAttachmentDescriptor*
253253
ToMTLRenderPipelineColorAttachmentDescriptor(
254-
PipelineColorAttachment descriptor);
254+
ColorAttachmentDescriptor descriptor);
255255

256256
MTLDepthStencilDescriptor* ToMTLDepthStencilDescriptor(
257-
std::optional<PipelineDepthAttachment> depth,
258-
std::optional<PipelineStencilAttachment> front,
259-
std::optional<PipelineStencilAttachment> back);
257+
std::optional<DepthAttachmentDescriptor> depth,
258+
std::optional<StencilAttachmentDescriptor> front,
259+
std::optional<StencilAttachmentDescriptor> back);
260260

261261
MTLTextureDescriptor* ToMTLTextureDescriptor(const TextureDescriptor& desc);
262262

impeller/renderer/backend/metal/formats_mtl.mm

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
MTLRenderPipelineColorAttachmentDescriptor*
1414
ToMTLRenderPipelineColorAttachmentDescriptor(
15-
PipelineColorAttachment descriptor) {
15+
ColorAttachmentDescriptor descriptor) {
1616
auto des = [[MTLRenderPipelineColorAttachmentDescriptor alloc] init];
1717
des.pixelFormat = ToMTLPixelFormat(descriptor.format);
1818

@@ -35,7 +35,7 @@
3535
}
3636

3737
MTLStencilDescriptor* ToMTLStencilDescriptor(
38-
const PipelineStencilAttachment& descriptor) {
38+
const StencilAttachmentDescriptor& descriptor) {
3939
auto des = [[MTLStencilDescriptor alloc] init];
4040
des.stencilCompareFunction = ToMTLCompareFunction(descriptor.stencil_compare);
4141
des.stencilFailureOperation =
@@ -51,11 +51,11 @@
5151
}
5252

5353
MTLDepthStencilDescriptor* ToMTLDepthStencilDescriptor(
54-
std::optional<PipelineDepthAttachment> depth,
55-
std::optional<PipelineStencilAttachment> front,
56-
std::optional<PipelineStencilAttachment> back) {
54+
std::optional<DepthAttachmentDescriptor> depth,
55+
std::optional<StencilAttachmentDescriptor> front,
56+
std::optional<StencilAttachmentDescriptor> back) {
5757
if (!depth) {
58-
depth = PipelineDepthAttachment{
58+
depth = DepthAttachmentDescriptor{
5959
// Always pass the depth test.
6060
.depth_compare = CompareFunction::kAlways,
6161
.depth_write_enabled = false,

impeller/renderer/formats.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ constexpr size_t BytesPerPixelForPixelFormat(PixelFormat format) {
181181
/// ```
182182
///
183183
/// The default blend mode is 1 - source alpha.
184-
struct PipelineColorAttachment {
184+
struct ColorAttachmentDescriptor {
185185
PixelFormat format = PixelFormat::kUnknown;
186186
bool blending_enabled = false;
187187

@@ -196,7 +196,7 @@ struct PipelineColorAttachment {
196196
std::underlying_type_t<ColorWriteMask> write_mask =
197197
static_cast<uint64_t>(ColorWriteMask::kAll);
198198

199-
constexpr bool operator==(const PipelineColorAttachment& o) const {
199+
constexpr bool operator==(const ColorAttachmentDescriptor& o) const {
200200
return format == o.format && //
201201
blending_enabled == o.blending_enabled && //
202202
src_color_blend_factor == o.src_color_blend_factor && //
@@ -254,7 +254,7 @@ enum class StencilOperation {
254254
kDecrementWrap,
255255
};
256256

257-
struct PipelineDepthAttachment {
257+
struct DepthAttachmentDescriptor {
258258
//----------------------------------------------------------------------------
259259
/// Indicates how to compare the value with that in the depth buffer.
260260
///
@@ -264,7 +264,7 @@ struct PipelineDepthAttachment {
264264
///
265265
bool depth_write_enabled = false;
266266

267-
constexpr bool operator==(const PipelineDepthAttachment& o) const {
267+
constexpr bool operator==(const DepthAttachmentDescriptor& o) const {
268268
return depth_compare == o.depth_compare &&
269269
depth_write_enabled == o.depth_write_enabled;
270270
}
@@ -274,7 +274,7 @@ struct PipelineDepthAttachment {
274274
}
275275
};
276276

277-
struct PipelineStencilAttachment {
277+
struct StencilAttachmentDescriptor {
278278
//----------------------------------------------------------------------------
279279
/// Indicates the operation to perform between the reference value and the
280280
/// value in the stencil buffer. Both values have the read_mask applied to
@@ -305,7 +305,7 @@ struct PipelineStencilAttachment {
305305
///
306306
uint32_t write_mask = ~0;
307307

308-
constexpr bool operator==(const PipelineStencilAttachment& o) const {
308+
constexpr bool operator==(const StencilAttachmentDescriptor& o) const {
309309
return stencil_compare == o.stencil_compare &&
310310
stencil_failure == o.stencil_failure &&
311311
depth_failure == o.depth_failure &&
@@ -344,17 +344,17 @@ struct StencilAttachment : public Attachment {
344344
namespace std {
345345

346346
template <>
347-
struct hash<impeller::PipelineDepthAttachment> {
347+
struct hash<impeller::DepthAttachmentDescriptor> {
348348
constexpr std::size_t operator()(
349-
const impeller::PipelineDepthAttachment& des) const {
349+
const impeller::DepthAttachmentDescriptor& des) const {
350350
return des.GetHash();
351351
}
352352
};
353353

354354
template <>
355-
struct hash<impeller::PipelineStencilAttachment> {
355+
struct hash<impeller::StencilAttachmentDescriptor> {
356356
constexpr std::size_t operator()(
357-
const impeller::PipelineStencilAttachment& des) const {
357+
const impeller::StencilAttachmentDescriptor& des) const {
358358
return des.GetHash();
359359
}
360360
};

impeller/renderer/pipeline_builder.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ struct PipelineBuilder {
8484
// Configure the sole color attachments pixel format.
8585
// TODO(csg): This can be easily reflected but we are sticking to the
8686
// convention that the first stage output is the color output.
87-
PipelineColorAttachment color0;
87+
ColorAttachmentDescriptor color0;
8888
color0.format = PixelFormat::kB8G8R8A8UNormInt;
8989
color0.blending_enabled = true;
9090
desc.SetColorAttachmentDescriptor(0u, std::move(color0));

impeller/renderer/pipeline_descriptor.cc

+7-7
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ PipelineDescriptor& PipelineDescriptor::SetVertexDescriptor(
8989

9090
PipelineDescriptor& PipelineDescriptor::SetColorAttachmentDescriptor(
9191
size_t index,
92-
PipelineColorAttachment desc) {
92+
ColorAttachmentDescriptor desc) {
9393
color_attachment_descriptors_[index] = std::move(desc);
9494
return *this;
9595
}
9696

97-
const PipelineColorAttachment* PipelineDescriptor::GetColorAttachmentDescriptor(
98-
size_t index) const {
97+
const ColorAttachmentDescriptor*
98+
PipelineDescriptor::GetColorAttachmentDescriptor(size_t index) const {
9999
auto found = color_attachment_descriptors_.find(index);
100100
return found == color_attachment_descriptors_.end() ? nullptr
101101
: &found->second;
@@ -114,19 +114,19 @@ PipelineDescriptor& PipelineDescriptor::SetStencilPixelFormat(
114114
}
115115

116116
PipelineDescriptor& PipelineDescriptor::SetDepthStencilAttachmentDescriptor(
117-
PipelineDepthAttachment desc) {
117+
DepthAttachmentDescriptor desc) {
118118
depth_attachment_descriptor_ = desc;
119119
return *this;
120120
}
121121

122122
PipelineDescriptor& PipelineDescriptor::SetStencilAttachmentDescriptors(
123-
PipelineStencilAttachment front_and_back) {
123+
StencilAttachmentDescriptor front_and_back) {
124124
return SetStencilAttachmentDescriptors(front_and_back, front_and_back);
125125
}
126126

127127
PipelineDescriptor& PipelineDescriptor::SetStencilAttachmentDescriptors(
128-
PipelineStencilAttachment front,
129-
PipelineStencilAttachment back) {
128+
StencilAttachmentDescriptor front,
129+
StencilAttachmentDescriptor back) {
130130
front_stencil_attachment_descriptor_ = front;
131131
back_stencil_attachment_descriptor_ = back;
132132
return *this;

impeller/renderer/pipeline_descriptor.h

+18-16
Original file line numberDiff line numberDiff line change
@@ -53,38 +53,38 @@ class PipelineDescriptor final : public Comparable<PipelineDescriptor> {
5353

5454
PipelineDescriptor& SetColorAttachmentDescriptor(
5555
size_t index,
56-
PipelineColorAttachment desc);
56+
ColorAttachmentDescriptor desc);
5757

58-
const PipelineColorAttachment* GetColorAttachmentDescriptor(
58+
const ColorAttachmentDescriptor* GetColorAttachmentDescriptor(
5959
size_t index) const;
6060

61-
const std::map<size_t /* index */, PipelineColorAttachment>
61+
const std::map<size_t /* index */, ColorAttachmentDescriptor>
6262
GetColorAttachmentDescriptors() const {
6363
return color_attachment_descriptors_;
6464
}
6565

6666
PipelineDescriptor& SetDepthStencilAttachmentDescriptor(
67-
PipelineDepthAttachment desc);
67+
DepthAttachmentDescriptor desc);
6868

69-
std::optional<PipelineDepthAttachment> GetDepthStencilAttachmentDescriptor()
69+
std::optional<DepthAttachmentDescriptor> GetDepthStencilAttachmentDescriptor()
7070
const {
7171
return depth_attachment_descriptor_;
7272
}
7373

7474
PipelineDescriptor& SetStencilAttachmentDescriptors(
75-
PipelineStencilAttachment front_and_back);
75+
StencilAttachmentDescriptor front_and_back);
7676

7777
PipelineDescriptor& SetStencilAttachmentDescriptors(
78-
PipelineStencilAttachment front,
79-
PipelineStencilAttachment back);
78+
StencilAttachmentDescriptor front,
79+
StencilAttachmentDescriptor back);
8080

81-
std::optional<PipelineStencilAttachment> GetFrontStencilAttachmentDescriptor()
82-
const {
81+
std::optional<StencilAttachmentDescriptor>
82+
GetFrontStencilAttachmentDescriptor() const {
8383
return front_stencil_attachment_descriptor_;
8484
}
8585

86-
std::optional<PipelineStencilAttachment> GetBackStencilAttachmentDescriptor()
87-
const {
86+
std::optional<StencilAttachmentDescriptor>
87+
GetBackStencilAttachmentDescriptor() const {
8888
return back_stencil_attachment_descriptor_;
8989
}
9090

@@ -106,14 +106,16 @@ class PipelineDescriptor final : public Comparable<PipelineDescriptor> {
106106
std::string label_;
107107
size_t sample_count_ = 1;
108108
std::map<ShaderStage, std::shared_ptr<const ShaderFunction>> entrypoints_;
109-
std::map<size_t /* index */, PipelineColorAttachment>
109+
std::map<size_t /* index */, ColorAttachmentDescriptor>
110110
color_attachment_descriptors_;
111111
std::shared_ptr<VertexDescriptor> vertex_descriptor_;
112112
PixelFormat depth_pixel_format_ = PixelFormat::kUnknown;
113113
PixelFormat stencil_pixel_format_ = PixelFormat::kUnknown;
114-
std::optional<PipelineDepthAttachment> depth_attachment_descriptor_;
115-
std::optional<PipelineStencilAttachment> front_stencil_attachment_descriptor_;
116-
std::optional<PipelineStencilAttachment> back_stencil_attachment_descriptor_;
114+
std::optional<DepthAttachmentDescriptor> depth_attachment_descriptor_;
115+
std::optional<StencilAttachmentDescriptor>
116+
front_stencil_attachment_descriptor_;
117+
std::optional<StencilAttachmentDescriptor>
118+
back_stencil_attachment_descriptor_;
117119
};
118120

119121
} // namespace impeller

0 commit comments

Comments
 (0)