Skip to content

Commit e95252f

Browse files
chinmaygardednfield
authored andcommitted
Shorten names of the render target attachment descriptors.
1 parent 08f00cd commit e95252f

14 files changed

+57
-61
lines changed

impeller/playground/playground.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,14 @@ static void PlaygroundKeyCallback(GLFWwindow* window,
140140
static_cast<ISize::Type>(current_drawable.texture.width),
141141
static_cast<ISize::Type>(current_drawable.texture.height)};
142142

143-
RenderPassColorAttachment color0;
143+
ColorAttachment color0;
144144
color0.texture =
145145
std::make_shared<TextureMTL>(color0_desc, current_drawable.texture);
146146
color0.clear_color = Color::SkyBlue();
147147
color0.load_action = LoadAction::kClear;
148148
color0.store_action = StoreAction::kStore;
149149

150-
RenderPassDescriptor desc;
150+
RenderTarget desc;
151151
desc.SetColorAttachment(color0, 0u);
152152

153153
Surface surface(desc);

impeller/renderer/backend/metal/command_buffer_mtl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class CommandBufferMTL final : public CommandBuffer {
3434

3535
// |CommandBuffer|
3636
std::shared_ptr<RenderPass> CreateRenderPass(
37-
const RenderPassDescriptor& desc) const override;
37+
const RenderTarget& desc) const override;
3838

3939
FML_DISALLOW_COPY_AND_ASSIGN(CommandBufferMTL);
4040
};

impeller/renderer/backend/metal/command_buffer_mtl.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
}
5454

5555
std::shared_ptr<RenderPass> CommandBufferMTL::CreateRenderPass(
56-
const RenderPassDescriptor& desc) const {
56+
const RenderTarget& desc) const {
5757
if (!buffer_) {
5858
return nullptr;
5959
}

impeller/renderer/backend/metal/formats_mtl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
namespace impeller {
1717

18-
class RenderPassDescriptor;
18+
class RenderTarget;
1919

2020
constexpr MTLPixelFormat ToMTLPixelFormat(PixelFormat format) {
2121
switch (format) {

impeller/renderer/backend/metal/render_pass_mtl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class RenderPassMTL final : public RenderPass {
2727
std::string label_;
2828
bool is_valid_ = false;
2929

30-
RenderPassMTL(id<MTLCommandBuffer> buffer, const RenderPassDescriptor& desc);
30+
RenderPassMTL(id<MTLCommandBuffer> buffer, const RenderTarget& desc);
3131

3232
// |RenderPass|
3333
bool IsValid() const override;

impeller/renderer/backend/metal/render_pass_mtl.mm

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace impeller {
1919

20-
static bool ConfigureAttachment(const RenderPassAttachment& desc,
20+
static bool ConfigureAttachment(const Attachment& desc,
2121
MTLRenderPassAttachmentDescriptor* attachment) {
2222
if (!desc.texture) {
2323
return false;
@@ -30,7 +30,7 @@ static bool ConfigureAttachment(const RenderPassAttachment& desc,
3030
}
3131

3232
static bool ConfigureColorAttachment(
33-
const RenderPassColorAttachment& desc,
33+
const ColorAttachment& desc,
3434
MTLRenderPassColorAttachmentDescriptor* attachment) {
3535
if (!ConfigureAttachment(desc, attachment)) {
3636
return false;
@@ -40,7 +40,7 @@ static bool ConfigureColorAttachment(
4040
}
4141

4242
static bool ConfigureDepthAttachment(
43-
const RenderPassDepthAttachment& desc,
43+
const DepthAttachment& desc,
4444
MTLRenderPassDepthAttachmentDescriptor* attachment) {
4545
if (!ConfigureAttachment(desc, attachment)) {
4646
return false;
@@ -50,7 +50,7 @@ static bool ConfigureDepthAttachment(
5050
}
5151

5252
static bool ConfigureStencilAttachment(
53-
const RenderPassStencilAttachment& desc,
53+
const StencilAttachment& desc,
5454
MTLRenderPassStencilAttachmentDescriptor* attachment) {
5555
if (!ConfigureAttachment(desc, attachment)) {
5656
return false;
@@ -61,7 +61,7 @@ static bool ConfigureStencilAttachment(
6161

6262
// TODO(csg): Move this to formats_mtl.h
6363
static MTLRenderPassDescriptor* ToMTLRenderPassDescriptor(
64-
const RenderPassDescriptor& desc) {
64+
const RenderTarget& desc) {
6565
auto result = [MTLRenderPassDescriptor renderPassDescriptor];
6666

6767
const auto& colors = desc.GetColorAttachments();
@@ -93,7 +93,7 @@ static bool ConfigureStencilAttachment(
9393
}
9494

9595
RenderPassMTL::RenderPassMTL(id<MTLCommandBuffer> buffer,
96-
const RenderPassDescriptor& desc)
96+
const RenderTarget& desc)
9797
: buffer_(buffer),
9898
desc_(ToMTLRenderPassDescriptor(desc)),
9999
transients_buffer_(HostBuffer::Create()) {

impeller/renderer/command_buffer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace impeller {
1313

1414
class Context;
1515
class RenderPass;
16-
class RenderPassDescriptor;
16+
class RenderTarget;
1717

1818
//------------------------------------------------------------------------------
1919
/// @brief A collection of encoded commands to be submitted to the GPU for
@@ -59,7 +59,7 @@ class CommandBuffer {
5959
/// @return A valid render pass or null.
6060
///
6161
virtual std::shared_ptr<RenderPass> CreateRenderPass(
62-
const RenderPassDescriptor& desc) const = 0;
62+
const RenderTarget& desc) const = 0;
6363

6464
protected:
6565
CommandBuffer();

impeller/renderer/formats.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,23 +319,23 @@ struct PipelineStencilAttachment {
319319
}
320320
};
321321

322-
struct RenderPassAttachment {
322+
struct Attachment {
323323
std::shared_ptr<Texture> texture = nullptr;
324324
LoadAction load_action = LoadAction::kDontCare;
325325
StoreAction store_action = StoreAction::kStore;
326326

327327
constexpr operator bool() const { return static_cast<bool>(texture); }
328328
};
329329

330-
struct RenderPassColorAttachment : public RenderPassAttachment {
330+
struct ColorAttachment : public Attachment {
331331
Color clear_color = Color::BlackTransparent();
332332
};
333333

334-
struct RenderPassDepthAttachment : public RenderPassAttachment {
334+
struct DepthAttachment : public Attachment {
335335
double clear_depth = 0.0;
336336
};
337337

338-
struct RenderPassStencilAttachment : public RenderPassAttachment {
338+
struct StencilAttachment : public Attachment {
339339
uint32_t clear_stencil = 0;
340340
};
341341

impeller/renderer/render_pass.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ namespace impeller {
1313
class HostBuffer;
1414
class Allocator;
1515

16+
//------------------------------------------------------------------------------
17+
/// @brief Render passes encode render commands directed as one specific
18+
/// render target into an underlying command buffer.
19+
///
20+
/// Render passes can be obtained from the command buffer in which
21+
/// the pass is meant to encode commands into.
22+
///
1623
class RenderPass {
1724
public:
1825
virtual ~RenderPass();

impeller/renderer/render_pass_descriptor.cc

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,18 @@
88

99
namespace impeller {
1010

11-
RenderPassDescriptor::RenderPassDescriptor() = default;
11+
RenderTarget::RenderTarget() = default;
1212

13-
RenderPassDescriptor::~RenderPassDescriptor() = default;
13+
RenderTarget::~RenderTarget() = default;
1414

15-
bool RenderPassDescriptor::HasColorAttachment(size_t index) const {
15+
bool RenderTarget::HasColorAttachment(size_t index) const {
1616
if (auto found = colors_.find(index); found != colors_.end()) {
1717
return true;
1818
}
1919
return false;
2020
}
2121

22-
std::optional<ISize> RenderPassDescriptor::GetColorAttachmentSize(
23-
size_t index) const {
22+
std::optional<ISize> RenderTarget::GetColorAttachmentSize(size_t index) const {
2423
auto found = colors_.find(index);
2524

2625
if (found == colors_.end()) {
@@ -30,43 +29,39 @@ std::optional<ISize> RenderPassDescriptor::GetColorAttachmentSize(
3029
return found->second.texture->GetSize();
3130
}
3231

33-
RenderPassDescriptor& RenderPassDescriptor::SetColorAttachment(
34-
RenderPassColorAttachment attachment,
35-
size_t index) {
32+
RenderTarget& RenderTarget::SetColorAttachment(ColorAttachment attachment,
33+
size_t index) {
3634
if (attachment) {
3735
colors_[index] = attachment;
3836
}
3937
return *this;
4038
}
4139

42-
RenderPassDescriptor& RenderPassDescriptor::SetDepthAttachment(
43-
RenderPassDepthAttachment attachment) {
40+
RenderTarget& RenderTarget::SetDepthAttachment(DepthAttachment attachment) {
4441
if (attachment) {
4542
depth_ = std::move(attachment);
4643
}
4744
return *this;
4845
}
4946

50-
RenderPassDescriptor& RenderPassDescriptor::SetStencilAttachment(
51-
RenderPassStencilAttachment attachment) {
47+
RenderTarget& RenderTarget::SetStencilAttachment(StencilAttachment attachment) {
5248
if (attachment) {
5349
stencil_ = std::move(attachment);
5450
}
5551
return *this;
5652
}
5753

58-
const std::map<size_t, RenderPassColorAttachment>&
59-
RenderPassDescriptor::GetColorAttachments() const {
54+
const std::map<size_t, ColorAttachment>& RenderTarget::GetColorAttachments()
55+
const {
6056
return colors_;
6157
}
6258

63-
const std::optional<RenderPassDepthAttachment>&
64-
RenderPassDescriptor::GetDepthAttachment() const {
59+
const std::optional<DepthAttachment>& RenderTarget::GetDepthAttachment() const {
6560
return depth_;
6661
}
6762

68-
const std::optional<RenderPassStencilAttachment>&
69-
RenderPassDescriptor::GetStencilAttachment() const {
63+
const std::optional<StencilAttachment>& RenderTarget::GetStencilAttachment()
64+
const {
7065
return stencil_;
7166
}
7267

0 commit comments

Comments
 (0)