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

Commit a657541

Browse files
committed
[Impeller] Comprehensively label snapshots
1 parent 0a53cf6 commit a657541

28 files changed

Lines changed: 80 additions & 39 deletions

impeller/display_list/dl_image_impeller.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ sk_sp<DlImageImpeller> DlImageImpeller::MakeFromYUVTextures(
3131
impeller::Entity entity;
3232
entity.SetBlendMode(impeller::BlendMode::kSource);
3333
auto snapshot = yuv_to_rgb_filter_contents->RenderToSnapshot(
34-
aiks_context->GetContentContext(), entity);
34+
aiks_context->GetContentContext(), entity, std::nullopt, true,
35+
"MakeYUVToRGBFilter Snapshot");
3536
return impeller::DlImageImpeller::Make(snapshot->texture);
3637
}
3738

impeller/entity/contents/atlas_contents.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ bool AtlasContents::Render(const ContentContext& renderer,
248248
auto contents = ColorFilterContents::MakeBlend(
249249
blend_mode_,
250250
{FilterInput::Make(dst_contents), FilterInput::Make(src_contents)});
251-
auto snapshot = contents->RenderToSnapshot(renderer, entity);
251+
auto snapshot = contents->RenderToSnapshot(renderer, entity, std::nullopt,
252+
true, "AtlasContents Snapshot");
252253
if (!snapshot.has_value()) {
253254
return false;
254255
}

impeller/entity/contents/contents.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,15 @@ std::optional<Snapshot> Contents::RenderToSnapshot(
5656
const ContentContext& renderer,
5757
const Entity& entity,
5858
const std::optional<SamplerDescriptor>& sampler_descriptor,
59-
bool msaa_enabled) const {
59+
bool msaa_enabled,
60+
const std::string& label) const {
6061
auto coverage = GetCoverage(entity);
6162
if (!coverage.has_value()) {
6263
return std::nullopt;
6364
}
6465

6566
auto texture = renderer.MakeSubpass(
66-
"Snapshot", ISize::Ceil(coverage->size),
67+
label, ISize::Ceil(coverage->size),
6768
[&contents = *this, &entity, &coverage](const ContentContext& renderer,
6869
RenderPass& pass) -> bool {
6970
Entity sub_entity;

impeller/entity/contents/contents.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ class Contents {
7272
const ContentContext& renderer,
7373
const Entity& entity,
7474
const std::optional<SamplerDescriptor>& sampler_descriptor = std::nullopt,
75-
bool msaa_enabled = true) const;
75+
bool msaa_enabled = true,
76+
const std::string& label = "Snapshot") const;
7677

7778
virtual bool ShouldRender(const Entity& entity,
7879
const std::optional<Rect>& stencil_coverage) const;

impeller/entity/contents/filters/blend_filter_contents.cc

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ static std::optional<Entity> AdvancedBlend(
5454
return std::nullopt;
5555
}
5656

57-
auto dst_snapshot = inputs[0]->GetSnapshot(renderer, entity);
57+
auto dst_snapshot =
58+
inputs[0]->GetSnapshot("AdvancedBlend(Dst)", renderer, entity);
5859
if (!dst_snapshot.has_value()) {
5960
return std::nullopt;
6061
}
@@ -67,7 +68,8 @@ static std::optional<Entity> AdvancedBlend(
6768
std::optional<Snapshot> src_snapshot;
6869
std::array<Point, 4> src_uvs;
6970
if (!foreground_color.has_value()) {
70-
src_snapshot = inputs[1]->GetSnapshot(renderer, entity);
71+
src_snapshot =
72+
inputs[1]->GetSnapshot("AdvancedBlend(Src)", renderer, entity);
7173
if (!src_snapshot.has_value()) {
7274
if (!dst_snapshot.has_value()) {
7375
return std::nullopt;
@@ -188,7 +190,8 @@ std::optional<Entity> BlendFilterContents::CreateForegroundAdvancedBlend(
188190
BlendMode blend_mode,
189191
std::optional<Scalar> alpha,
190192
bool absorb_opacity) const {
191-
auto dst_snapshot = input->GetSnapshot(renderer, entity);
193+
auto dst_snapshot =
194+
input->GetSnapshot("ForegroundAdvancedBlend", renderer, entity);
192195
if (!dst_snapshot.has_value()) {
193196
return std::nullopt;
194197
}
@@ -353,7 +356,8 @@ std::optional<Entity> BlendFilterContents::CreateForegroundPorterDuffBlend(
353356
BlendMode blend_mode,
354357
std::optional<Scalar> alpha,
355358
bool absorb_opacity) const {
356-
auto dst_snapshot = input->GetSnapshot(renderer, entity);
359+
auto dst_snapshot =
360+
input->GetSnapshot("ForegroundPorterDuffBlend", renderer, entity);
357361
if (!dst_snapshot.has_value()) {
358362
return std::nullopt;
359363
}
@@ -477,7 +481,8 @@ static std::optional<Entity> PipelineBlend(
477481
using VS = BlendPipeline::VertexShader;
478482
using FS = BlendPipeline::FragmentShader;
479483

480-
auto dst_snapshot = inputs[0]->GetSnapshot(renderer, entity);
484+
auto dst_snapshot =
485+
inputs[0]->GetSnapshot("PipelineBlend(Dst)", renderer, entity);
481486

482487
ContentContext::SubpassCallback callback = [&](const ContentContext& renderer,
483488
RenderPass& pass) {
@@ -544,7 +549,8 @@ static std::optional<Entity> PipelineBlend(
544549

545550
for (auto texture_i = inputs.begin() + 1; texture_i < inputs.end();
546551
texture_i++) {
547-
auto src_input = texture_i->get()->GetSnapshot(renderer, entity);
552+
auto src_input = texture_i->get()->GetSnapshot("PipelineBlend(Src)",
553+
renderer, entity);
548554
if (!add_blend_command(src_input)) {
549555
return true;
550556
}

impeller/entity/contents/filters/border_mask_blur_filter_contents.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ std::optional<Entity> BorderMaskBlurFilterContents::RenderFilter(
6565
return std::nullopt;
6666
}
6767

68-
auto input_snapshot = inputs[0]->GetSnapshot(renderer, entity);
68+
auto input_snapshot =
69+
inputs[0]->GetSnapshot("BorderMaskBlur", renderer, entity);
6970
if (!input_snapshot.has_value()) {
7071
return std::nullopt;
7172
}

impeller/entity/contents/filters/color_matrix_filter_contents.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ std::optional<Entity> ColorMatrixFilterContents::RenderFilter(
4141
return std::nullopt;
4242
}
4343

44-
auto input_snapshot = inputs[0]->GetSnapshot(renderer, entity);
44+
auto input_snapshot = inputs[0]->GetSnapshot("ColorMatrix", renderer, entity);
4545
if (!input_snapshot.has_value()) {
4646
return std::nullopt;
4747
}

impeller/entity/contents/filters/filter_contents.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,14 @@ std::optional<Snapshot> FilterContents::RenderToSnapshot(
242242
const ContentContext& renderer,
243243
const Entity& entity,
244244
const std::optional<SamplerDescriptor>& sampler_descriptor,
245-
bool msaa_enabled) const {
245+
bool msaa_enabled,
246+
const std::string& label) const {
246247
// Resolve the render instruction (entity) from the filter and render it to a
247248
// snapshot.
248249
if (std::optional<Entity> result = GetEntity(renderer, entity);
249250
result.has_value()) {
250-
return result->GetContents()->RenderToSnapshot(renderer, result.value());
251+
return result->GetContents()->RenderToSnapshot(renderer, result.value(),
252+
std::nullopt, true, label);
251253
}
252254

253255
return std::nullopt;

impeller/entity/contents/filters/filter_contents.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ class FilterContents : public Contents {
126126
const ContentContext& renderer,
127127
const Entity& entity,
128128
const std::optional<SamplerDescriptor>& sampler_descriptor = std::nullopt,
129-
bool msaa_enabled = true) const override;
129+
bool msaa_enabled = true,
130+
const std::string& label = "Filter Snapshot") const override;
130131

131132
virtual Matrix GetLocalTransform(const Matrix& parent_transform) const;
132133

impeller/entity/contents/filters/gaussian_blur_filter_contents.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ std::optional<Entity> DirectionalGaussianBlurFilterContents::RenderFilter(
100100

101101
// Input 0 snapshot.
102102

103-
auto input_snapshot = inputs[0]->GetSnapshot(renderer, entity);
103+
auto input_snapshot =
104+
inputs[0]->GetSnapshot("GaussianBlur", renderer, entity);
104105
if (!input_snapshot.has_value()) {
105106
return std::nullopt;
106107
}
@@ -148,7 +149,8 @@ std::optional<Entity> DirectionalGaussianBlurFilterContents::RenderFilter(
148149
// Source override snapshot.
149150

150151
auto source = source_override_ ? source_override_ : inputs[0];
151-
auto source_snapshot = source->GetSnapshot(renderer, entity);
152+
auto source_snapshot =
153+
source->GetSnapshot("GaussianBlur(Override)", renderer, entity);
152154
if (!source_snapshot.has_value()) {
153155
return std::nullopt;
154156
}

0 commit comments

Comments
 (0)