mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Rename render pass attachment structs.
This commit is contained in:
parent
cd71fe879f
commit
feb43bfae7
@ -290,15 +290,15 @@ struct RenderPassAttachment {
|
||||
constexpr operator bool() const { return static_cast<bool>(texture); }
|
||||
};
|
||||
|
||||
struct ColorRenderPassAttachment : public RenderPassAttachment {
|
||||
struct RenderPassColorAttachment : public RenderPassAttachment {
|
||||
Color clear_color = Color::BlackTransparent();
|
||||
};
|
||||
|
||||
struct DepthRenderPassAttachment : public RenderPassAttachment {
|
||||
struct RenderPassDepthAttachment : public RenderPassAttachment {
|
||||
double clear_depth = 0.0;
|
||||
};
|
||||
|
||||
struct StencilRenderPassAttachment : public RenderPassAttachment {
|
||||
struct RenderPassStencilAttachment : public RenderPassAttachment {
|
||||
uint32_t clear_stencil = 0;
|
||||
};
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ static bool ConfigureAttachment(const RenderPassAttachment& desc,
|
||||
}
|
||||
|
||||
static bool ConfigureColorAttachment(
|
||||
const ColorRenderPassAttachment& desc,
|
||||
const RenderPassColorAttachment& desc,
|
||||
MTLRenderPassColorAttachmentDescriptor* attachment) {
|
||||
if (!ConfigureAttachment(desc, attachment)) {
|
||||
return false;
|
||||
@ -40,7 +40,7 @@ static bool ConfigureColorAttachment(
|
||||
}
|
||||
|
||||
static bool ConfigureDepthAttachment(
|
||||
const DepthRenderPassAttachment& desc,
|
||||
const RenderPassDepthAttachment& desc,
|
||||
MTLRenderPassDepthAttachmentDescriptor* attachment) {
|
||||
if (!ConfigureAttachment(desc, attachment)) {
|
||||
return false;
|
||||
@ -50,7 +50,7 @@ static bool ConfigureDepthAttachment(
|
||||
}
|
||||
|
||||
static bool ConfigureStencilAttachment(
|
||||
const StencilRenderPassAttachment& desc,
|
||||
const RenderPassStencilAttachment& desc,
|
||||
MTLRenderPassStencilAttachmentDescriptor* attachment) {
|
||||
if (!ConfigureAttachment(desc, attachment)) {
|
||||
return false;
|
||||
|
||||
@ -25,21 +25,21 @@ class RenderPassDescriptor {
|
||||
|
||||
std::optional<ISize> GetColorAttachmentSize(size_t index) const;
|
||||
|
||||
RenderPassDescriptor& SetColorAttachment(ColorRenderPassAttachment attachment,
|
||||
RenderPassDescriptor& SetColorAttachment(RenderPassColorAttachment attachment,
|
||||
size_t index);
|
||||
|
||||
RenderPassDescriptor& SetDepthAttachment(
|
||||
DepthRenderPassAttachment attachment);
|
||||
RenderPassDepthAttachment attachment);
|
||||
|
||||
RenderPassDescriptor& SetStencilAttachment(
|
||||
StencilRenderPassAttachment attachment);
|
||||
RenderPassStencilAttachment attachment);
|
||||
|
||||
MTLRenderPassDescriptor* ToMTLRenderPassDescriptor() const;
|
||||
|
||||
private:
|
||||
std::map<size_t, ColorRenderPassAttachment> colors_;
|
||||
std::optional<DepthRenderPassAttachment> depth_;
|
||||
std::optional<StencilRenderPassAttachment> stencil_;
|
||||
std::map<size_t, RenderPassColorAttachment> colors_;
|
||||
std::optional<RenderPassDepthAttachment> depth_;
|
||||
std::optional<RenderPassStencilAttachment> stencil_;
|
||||
};
|
||||
|
||||
} // namespace impeller
|
||||
|
||||
@ -31,7 +31,7 @@ std::optional<ISize> RenderPassDescriptor::GetColorAttachmentSize(
|
||||
}
|
||||
|
||||
RenderPassDescriptor& RenderPassDescriptor::SetColorAttachment(
|
||||
ColorRenderPassAttachment attachment,
|
||||
RenderPassColorAttachment attachment,
|
||||
size_t index) {
|
||||
if (attachment) {
|
||||
colors_[index] = attachment;
|
||||
@ -40,7 +40,7 @@ RenderPassDescriptor& RenderPassDescriptor::SetColorAttachment(
|
||||
}
|
||||
|
||||
RenderPassDescriptor& RenderPassDescriptor::SetDepthAttachment(
|
||||
DepthRenderPassAttachment attachment) {
|
||||
RenderPassDepthAttachment attachment) {
|
||||
if (attachment) {
|
||||
depth_ = std::move(attachment);
|
||||
}
|
||||
@ -48,7 +48,7 @@ RenderPassDescriptor& RenderPassDescriptor::SetDepthAttachment(
|
||||
}
|
||||
|
||||
RenderPassDescriptor& RenderPassDescriptor::SetStencilAttachment(
|
||||
StencilRenderPassAttachment attachment) {
|
||||
RenderPassStencilAttachment attachment) {
|
||||
if (attachment) {
|
||||
stencil_ = std::move(attachment);
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ bool Playground::OpenPlaygroundHere(Renderer::RenderCallback render_callback) {
|
||||
static_cast<ISize::Type>(current_drawable.texture.width),
|
||||
static_cast<ISize::Type>(current_drawable.texture.height)};
|
||||
|
||||
ColorRenderPassAttachment color0;
|
||||
RenderPassColorAttachment color0;
|
||||
color0.texture =
|
||||
std::make_shared<Texture>(color0_desc, current_drawable.texture);
|
||||
color0.clear_color = Color::SkyBlue();
|
||||
|
||||
@ -193,7 +193,7 @@ TEST_F(PrimitivesTest, CanRenderToTexture) {
|
||||
std::shared_ptr<RenderPass> r2t_pass;
|
||||
|
||||
{
|
||||
ColorRenderPassAttachment color0;
|
||||
RenderPassColorAttachment color0;
|
||||
color0.load_action = LoadAction::kClear;
|
||||
color0.store_action = StoreAction::kStore;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user