Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 13be2d4

Browse files
authored
[Impeller] Reland uniquely label offscreen resources (#39995)
[Impeller] Reland uniquely label offscreen resources
1 parent 4926833 commit 13be2d4

12 files changed

+30
-29
lines changed

impeller/entity/contents/atlas_contents.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ bool AtlasContents::Render(const ContentContext& renderer,
226226

227227
#ifdef FML_OS_PHYSICAL_IOS
228228
auto new_texture = renderer.MakeSubpass(
229-
sub_atlas->size, [&](const ContentContext& context, RenderPass& pass) {
229+
"Atlas Blend", sub_atlas->size,
230+
[&](const ContentContext& context, RenderPass& pass) {
230231
Entity entity;
231232
entity.SetContents(dst_contents);
232233
entity.SetBlendMode(BlendMode::kSource);

impeller/entity/contents/content_context.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <memory>
88
#include <sstream>
99

10+
#include "impeller/base/strings.h"
1011
#include "impeller/entity/entity.h"
1112
#include "impeller/renderer/command_buffer.h"
1213
#include "impeller/renderer/formats.h"
@@ -308,6 +309,7 @@ bool ContentContext::IsValid() const {
308309
}
309310

310311
std::shared_ptr<Texture> ContentContext::MakeSubpass(
312+
const std::string& label,
311313
ISize texture_size,
312314
const SubpassCallback& subpass_callback,
313315
bool msaa_enabled) const {
@@ -317,11 +319,11 @@ std::shared_ptr<Texture> ContentContext::MakeSubpass(
317319
if (context->GetDeviceCapabilities().SupportsOffscreenMSAA() &&
318320
msaa_enabled) {
319321
subpass_target = RenderTarget::CreateOffscreenMSAA(
320-
*context, texture_size, "Contents Offscreen MSAA",
322+
*context, texture_size, SPrintF("%s Offscreen", label.c_str()),
321323
RenderTarget::kDefaultColorAttachmentConfigMSAA, std::nullopt);
322324
} else {
323325
subpass_target = RenderTarget::CreateOffscreen(
324-
*context, texture_size, "Contents Offscreen",
326+
*context, texture_size, SPrintF("%s Offscreen", label.c_str()),
325327
RenderTarget::kDefaultColorAttachmentConfig, std::nullopt);
326328
}
327329
auto subpass_texture = subpass_target.GetRenderTargetTexture();
@@ -330,7 +332,7 @@ std::shared_ptr<Texture> ContentContext::MakeSubpass(
330332
}
331333

332334
auto sub_command_buffer = context->CreateCommandBuffer();
333-
sub_command_buffer->SetLabel("Offscreen Contents Command Buffer");
335+
sub_command_buffer->SetLabel(SPrintF("%s CommandBuffer", label.c_str()));
334336
if (!sub_command_buffer) {
335337
return nullptr;
336338
}
@@ -339,7 +341,7 @@ std::shared_ptr<Texture> ContentContext::MakeSubpass(
339341
if (!sub_renderpass) {
340342
return nullptr;
341343
}
342-
sub_renderpass->SetLabel("OffscreenContentsPass");
344+
sub_renderpass->SetLabel(SPrintF("%s RenderPass", label.c_str()));
343345

344346
if (!subpass_callback(*this, *sub_renderpass)) {
345347
return nullptr;

impeller/entity/contents/content_context.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,8 @@ class ContentContext {
603603

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

impeller/entity/contents/contents.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <optional>
77

88
#include "fml/logging.h"
9+
#include "impeller/base/strings.h"
910
#include "impeller/entity/contents/content_context.h"
1011
#include "impeller/entity/contents/texture_contents.h"
1112
#include "impeller/renderer/command_buffer.h"
@@ -82,7 +83,7 @@ std::optional<Snapshot> Contents::RenderToSnapshot(
8283
}
8384

8485
auto texture = renderer.MakeSubpass(
85-
ISize::Ceil(coverage->size),
86+
"Snapshot", ISize::Ceil(coverage->size),
8687
[&contents = *this, &entity, &coverage](const ContentContext& renderer,
8788
RenderPass& pass) -> bool {
8889
Entity sub_entity;

impeller/entity/contents/filters/blend_filter_contents.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,11 @@ static std::optional<Entity> AdvancedBlend(
150150
return true;
151151
};
152152

153-
auto out_texture = renderer.MakeSubpass(ISize(coverage.size), callback);
153+
auto out_texture = renderer.MakeSubpass("Advanced Blend Filter",
154+
ISize(coverage.size), callback);
154155
if (!out_texture) {
155156
return std::nullopt;
156157
}
157-
out_texture->SetLabel("Advanced Blend Filter Texture");
158158

159159
return Contents::EntityFromSnapshot(
160160
Snapshot{.texture = out_texture,
@@ -274,11 +274,11 @@ static std::optional<Entity> PipelineBlend(
274274
return true;
275275
};
276276

277-
auto out_texture = renderer.MakeSubpass(ISize(coverage.size), callback);
277+
auto out_texture = renderer.MakeSubpass("Pipeline Blend Filter",
278+
ISize(coverage.size), callback);
278279
if (!out_texture) {
279280
return std::nullopt;
280281
}
281-
out_texture->SetLabel("Pipeline Blend Filter Texture");
282282

283283
return Contents::EntityFromSnapshot(
284284
Snapshot{.texture = out_texture,

impeller/entity/contents/filters/border_mask_blur_filter_contents.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ std::optional<Entity> BorderMaskBlurFilterContents::RenderFilter(
122122
return pass.AddCommand(std::move(cmd));
123123
};
124124

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

131131
return Contents::EntityFromSnapshot(
132132
Snapshot{.texture = out_texture,

impeller/entity/contents/filters/color_matrix_filter_contents.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,11 @@ std::optional<Entity> ColorMatrixFilterContents::RenderFilter(
9797
return pass.AddCommand(std::move(cmd));
9898
};
9999

100-
auto out_texture =
101-
renderer.MakeSubpass(input_snapshot->texture->GetSize(), callback);
100+
auto out_texture = renderer.MakeSubpass(
101+
"Color Matrix Filter", input_snapshot->texture->GetSize(), callback);
102102
if (!out_texture) {
103103
return std::nullopt;
104104
}
105-
out_texture->SetLabel("ColorMatrixFilter Texture");
106105

107106
return Contents::EntityFromSnapshot(
108107
Snapshot{.texture = out_texture,

impeller/entity/contents/filters/gaussian_blur_filter_contents.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,12 @@ std::optional<Entity> DirectionalGaussianBlurFilterContents::RenderFilter(
276276
Vector2 scaled_size = pass_texture_rect.size * scale;
277277
ISize floored_size = ISize(scaled_size.x, scaled_size.y);
278278

279-
auto out_texture = renderer.MakeSubpass(floored_size, callback);
279+
auto out_texture = renderer.MakeSubpass("Directional Gaussian Blur Filter",
280+
floored_size, callback);
280281

281282
if (!out_texture) {
282283
return std::nullopt;
283284
}
284-
out_texture->SetLabel("DirectionalGaussianBlurFilter Texture");
285285

286286
SamplerDescriptor sampler_desc;
287287
sampler_desc.min_filter = MinMagFilter::kLinear;

impeller/entity/contents/filters/linear_to_srgb_filter_contents.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,11 @@ std::optional<Entity> LinearToSrgbFilterContents::RenderFilter(
7474
return pass.AddCommand(std::move(cmd));
7575
};
7676

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

8483
return Contents::EntityFromSnapshot(
8584
Snapshot{.texture = out_texture,

impeller/entity/contents/filters/morphology_filter_contents.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,11 @@ std::optional<Entity> DirectionalMorphologyFilterContents::RenderFilter(
132132
return pass.AddCommand(cmd);
133133
};
134134

135-
auto out_texture = renderer.MakeSubpass(ISize(coverage.size), callback);
135+
auto out_texture = renderer.MakeSubpass("Directional Morphology Filter",
136+
ISize(coverage.size), callback);
136137
if (!out_texture) {
137138
return std::nullopt;
138139
}
139-
out_texture->SetLabel("DirectionalMorphologyFilter Texture");
140140

141141
SamplerDescriptor sampler_desc;
142142
sampler_desc.min_filter = MinMagFilter::kLinear;

0 commit comments

Comments
 (0)