Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions impeller/entity/contents/content_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <memory>
#include <sstream>

#include "impeller/base/strings.h"
#include "impeller/entity/entity.h"
#include "impeller/renderer/command_buffer.h"
#include "impeller/renderer/formats.h"
Expand Down Expand Up @@ -309,7 +308,6 @@ bool ContentContext::IsValid() const {
}

std::shared_ptr<Texture> ContentContext::MakeSubpass(
const std::string& label,
ISize texture_size,
const SubpassCallback& subpass_callback,
bool msaa_enabled) const {
Expand All @@ -319,11 +317,11 @@ std::shared_ptr<Texture> ContentContext::MakeSubpass(
if (context->GetDeviceCapabilities().SupportsOffscreenMSAA() &&
msaa_enabled) {
subpass_target = RenderTarget::CreateOffscreenMSAA(
*context, texture_size, SPrintF("%s Offscreen", label.c_str()),
*context, texture_size, "Contents Offscreen MSAA",
RenderTarget::kDefaultColorAttachmentConfigMSAA, std::nullopt);
} else {
subpass_target = RenderTarget::CreateOffscreen(
*context, texture_size, SPrintF("%s Offscreen", label.c_str()),
*context, texture_size, "Contents Offscreen",
RenderTarget::kDefaultColorAttachmentConfig, std::nullopt);
}
auto subpass_texture = subpass_target.GetRenderTargetTexture();
Expand All @@ -332,7 +330,7 @@ std::shared_ptr<Texture> ContentContext::MakeSubpass(
}

auto sub_command_buffer = context->CreateCommandBuffer();
sub_command_buffer->SetLabel(SPrintF("%s CommandBuffer", label.c_str()));
sub_command_buffer->SetLabel("Offscreen Contents Command Buffer");
if (!sub_command_buffer) {
return nullptr;
}
Expand All @@ -341,7 +339,7 @@ std::shared_ptr<Texture> ContentContext::MakeSubpass(
if (!sub_renderpass) {
return nullptr;
}
sub_renderpass->SetLabel(SPrintF("%s RenderPass", label.c_str()));
sub_renderpass->SetLabel("OffscreenContentsPass");

if (!subpass_callback(*this, *sub_renderpass)) {
return nullptr;
Expand Down
3 changes: 1 addition & 2 deletions impeller/entity/contents/content_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -603,8 +603,7 @@ class ContentContext {

/// @brief Creates a new texture of size `texture_size` and calls
/// `subpass_callback` with a `RenderPass` for drawing to the texture.
std::shared_ptr<Texture> MakeSubpass(const std::string& label,
ISize texture_size,
std::shared_ptr<Texture> MakeSubpass(ISize texture_size,
const SubpassCallback& subpass_callback,
bool msaa_enabled = true) const;

Expand Down
3 changes: 1 addition & 2 deletions impeller/entity/contents/contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <optional>

#include "fml/logging.h"
#include "impeller/base/strings.h"
#include "impeller/entity/contents/content_context.h"
#include "impeller/entity/contents/texture_contents.h"
#include "impeller/renderer/command_buffer.h"
Expand Down Expand Up @@ -83,7 +82,7 @@ std::optional<Snapshot> Contents::RenderToSnapshot(
}

auto texture = renderer.MakeSubpass(
"Snapshot", ISize::Ceil(coverage->size),
ISize::Ceil(coverage->size),
[&contents = *this, &entity, &coverage](const ContentContext& renderer,
RenderPass& pass) -> bool {
Entity sub_entity;
Expand Down
8 changes: 4 additions & 4 deletions impeller/entity/contents/filters/blend_filter_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ static std::optional<Entity> AdvancedBlend(
return true;
};

auto out_texture = renderer.MakeSubpass("Advanced Blend Filter",
ISize(coverage.size), callback);
auto out_texture = renderer.MakeSubpass(ISize(coverage.size), callback);
if (!out_texture) {
return std::nullopt;
}
out_texture->SetLabel("Advanced Blend Filter Texture");

return Contents::EntityFromSnapshot(
Snapshot{.texture = out_texture,
Expand Down Expand Up @@ -274,11 +274,11 @@ static std::optional<Entity> PipelineBlend(
return true;
};

auto out_texture = renderer.MakeSubpass("Pipeline Blend Filter",
ISize(coverage.size), callback);
auto out_texture = renderer.MakeSubpass(ISize(coverage.size), callback);
if (!out_texture) {
return std::nullopt;
}
out_texture->SetLabel("Pipeline Blend Filter Texture");

return Contents::EntityFromSnapshot(
Snapshot{.texture = out_texture,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ std::optional<Entity> BorderMaskBlurFilterContents::RenderFilter(
return pass.AddCommand(std::move(cmd));
};

auto out_texture = renderer.MakeSubpass("Border Mask Blur Filter",
ISize(coverage.size), callback);
auto out_texture = renderer.MakeSubpass(ISize(coverage.size), callback);
if (!out_texture) {
return std::nullopt;
}
out_texture->SetLabel("BorderMaskBlurFilter Texture");

return Contents::EntityFromSnapshot(
Snapshot{.texture = out_texture,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,12 @@ std::optional<Entity> ColorMatrixFilterContents::RenderFilter(
return pass.AddCommand(std::move(cmd));
};

auto out_texture = renderer.MakeSubpass(
"Color Matrix Filter", input_snapshot->texture->GetSize(), callback);
auto out_texture =
renderer.MakeSubpass(input_snapshot->texture->GetSize(), callback);
if (!out_texture) {
return std::nullopt;
}
out_texture->SetLabel("ColorMatrixFilter Texture");

return Contents::EntityFromSnapshot(
Snapshot{.texture = out_texture,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,12 @@ std::optional<Entity> DirectionalGaussianBlurFilterContents::RenderFilter(
Vector2 scaled_size = pass_texture_rect.size * scale;
ISize floored_size = ISize(scaled_size.x, scaled_size.y);

auto out_texture = renderer.MakeSubpass("Directional Gaussian Blur Filter",
floored_size, callback);
auto out_texture = renderer.MakeSubpass(floored_size, callback);

if (!out_texture) {
return std::nullopt;
}
out_texture->SetLabel("DirectionalGaussianBlurFilter Texture");

SamplerDescriptor sampler_desc;
sampler_desc.min_filter = MinMagFilter::kLinear;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,12 @@ std::optional<Entity> LinearToSrgbFilterContents::RenderFilter(
return pass.AddCommand(std::move(cmd));
};

auto out_texture = renderer.MakeSubpass(
"Linear to sRGB Filter", input_snapshot->texture->GetSize(), callback);
auto out_texture =
renderer.MakeSubpass(input_snapshot->texture->GetSize(), callback);
if (!out_texture) {
return std::nullopt;
}
out_texture->SetLabel("LinearToSrgb Texture");

return Contents::EntityFromSnapshot(
Snapshot{.texture = out_texture,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ std::optional<Entity> DirectionalMorphologyFilterContents::RenderFilter(
return pass.AddCommand(cmd);
};

auto out_texture = renderer.MakeSubpass("Directional Morphology Filter",
ISize(coverage.size), callback);
auto out_texture = renderer.MakeSubpass(ISize(coverage.size), callback);
if (!out_texture) {
return std::nullopt;
}
out_texture->SetLabel("DirectionalMorphologyFilter Texture");

SamplerDescriptor sampler_desc;
sampler_desc.min_filter = MinMagFilter::kLinear;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,12 @@ std::optional<Entity> SrgbToLinearFilterContents::RenderFilter(
return pass.AddCommand(std::move(cmd));
};

auto out_texture = renderer.MakeSubpass(
"sRGB to Linear Filter", input_snapshot->texture->GetSize(), callback);
auto out_texture =
renderer.MakeSubpass(input_snapshot->texture->GetSize(), callback);
if (!out_texture) {
return std::nullopt;
}
out_texture->SetLabel("SrgbToLinear Texture");

return Contents::EntityFromSnapshot(
Snapshot{.texture = out_texture,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,12 @@ std::optional<Entity> YUVToRGBFilterContents::RenderFilter(
return pass.AddCommand(std::move(cmd));
};

auto out_texture = renderer.MakeSubpass(
"YUV to RGB Filter", y_input_snapshot->texture->GetSize(), callback);
auto out_texture =
renderer.MakeSubpass(y_input_snapshot->texture->GetSize(), callback);
if (!out_texture) {
return std::nullopt;
}
out_texture->SetLabel("YUVToRGB Texture");

return Contents::EntityFromSnapshot(Snapshot{.texture = out_texture},
entity.GetBlendMode(),
Expand Down