From 7bf1104323bc06cf549110b4446723b842ff8b8a Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Tue, 10 Dec 2024 13:20:00 -0800 Subject: [PATCH 1/6] [Impeller] dont print format strings for blend filter. --- .../contents/filters/blend_filter_contents.cc | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/impeller/entity/contents/filters/blend_filter_contents.cc b/impeller/entity/contents/filters/blend_filter_contents.cc index b427de9ab76e6..96e2443875712 100644 --- a/impeller/entity/contents/filters/blend_filter_contents.cc +++ b/impeller/entity/contents/filters/blend_filter_contents.cc @@ -30,6 +30,21 @@ namespace impeller { +namespace { + +#define _IMPELLER_BLEND_MODE_FILTER_NAME_LIST(blend_mode) \ + "Blend Filter " #blend_mode, + +static constexpr const char* kBlendModeFilterNames[] = { + _IMPELLER_BLEND_MODE_FILTER_NAME_LIST(_IMPELLER_BLEND_MODE_NAME_LIST)}; + +const std::string_view BlendModeToFilterString(BlendMode blend_mode) { + return kBlendModeFilterNames[static_cast>( + blend_mode)]; +} + +} // namespace + std::optional InvertPorterDuffBlend(BlendMode blend_mode) { switch (blend_mode) { case BlendMode::kClear: @@ -174,8 +189,7 @@ static std::optional AdvancedBlend( std::invoke(pipeline_proc, renderer, options); #ifdef IMPELLER_DEBUG - pass.SetCommandLabel( - SPrintF("Advanced Blend Filter (%s)", BlendModeToString(blend_mode))); + pass.SetCommandLabel(BlendModeToFilterString(blend_mode)); #endif // IMPELLER_DEBUG pass.SetVertexBuffer(std::move(vtx_buffer)); pass.SetPipeline(pipeline); @@ -297,8 +311,7 @@ std::optional BlendFilterContents::CreateForegroundAdvancedBlend( CreateVertexBuffer(vertices, renderer.GetTransientsBuffer()); #ifdef IMPELLER_DEBUG - pass.SetCommandLabel(SPrintF("Foreground Advanced Blend Filter (%s)", - BlendModeToString(blend_mode))); + pass.SetCommandLabel(BlendModeToFilterString(blend_mode)); #endif // IMPELLER_DEBUG pass.SetVertexBuffer(std::move(vtx_buffer)); auto options = OptionsFromPassAndEntity(pass, entity); @@ -450,8 +463,7 @@ std::optional BlendFilterContents::CreateForegroundPorterDuffBlend( CreateVertexBuffer(vertices, renderer.GetTransientsBuffer()); #ifdef IMPELLER_DEBUG - pass.SetCommandLabel(SPrintF("Foreground PorterDuff Blend Filter (%s)", - BlendModeToString(blend_mode))); + pass.SetCommandLabel(BlendModeToFilterString(blend_mode)); #endif // IMPELLER_DEBUG pass.SetVertexBuffer(std::move(vtx_buffer)); auto options = OptionsFromPassAndEntity(pass, entity); @@ -549,8 +561,7 @@ static std::optional PipelineBlend( auto& host_buffer = renderer.GetTransientsBuffer(); #ifdef IMPELLER_DEBUG - pass.SetCommandLabel( - SPrintF("Pipeline Blend Filter (%s)", BlendModeToString(blend_mode))); + pass.SetCommandLabel(BlendModeToFilterString(blend_mode)); #endif // IMPELLER_DEBUG auto options = OptionsFromPass(pass); options.primitive_type = PrimitiveType::kTriangleStrip; From fa56f7816d5e4ee58ff7fa8b83b81698af077fae Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Tue, 10 Dec 2024 15:03:33 -0800 Subject: [PATCH 2/6] remove extra labeling. --- .../contents/filters/blend_filter_contents.cc | 26 +++++++------------ .../border_mask_blur_filter_contents.cc | 3 +-- .../filters/color_matrix_filter_contents.cc | 2 +- .../filters/gaussian_blur_filter_contents.cc | 2 +- .../filters/inputs/contents_filter_input.cc | 18 +++++-------- .../filters/inputs/contents_filter_input.h | 3 +-- .../inputs/filter_contents_filter_input.cc | 16 +++++------- .../inputs/filter_contents_filter_input.h | 3 +-- .../contents/filters/inputs/filter_input.h | 1 - .../inputs/placeholder_filter_input.cc | 1 - .../filters/inputs/placeholder_filter_input.h | 3 +-- .../filters/inputs/texture_filter_input.cc | 1 - .../filters/inputs/texture_filter_input.h | 3 +-- .../filters/linear_to_srgb_filter_contents.cc | 3 +-- .../filters/local_matrix_filter_contents.cc | 3 +-- .../filters/matrix_filter_contents.cc | 2 +- .../filters/morphology_filter_contents.cc | 2 +- .../filters/runtime_effect_filter_contents.cc | 3 +-- .../filters/srgb_to_linear_filter_contents.cc | 3 +-- .../filters/yuv_to_rgb_filter_contents.cc | 6 ++--- 20 files changed, 38 insertions(+), 66 deletions(-) diff --git a/impeller/entity/contents/filters/blend_filter_contents.cc b/impeller/entity/contents/filters/blend_filter_contents.cc index 96e2443875712..55e38e95a1f83 100644 --- a/impeller/entity/contents/filters/blend_filter_contents.cc +++ b/impeller/entity/contents/filters/blend_filter_contents.cc @@ -36,7 +36,7 @@ namespace { "Blend Filter " #blend_mode, static constexpr const char* kBlendModeFilterNames[] = { - _IMPELLER_BLEND_MODE_FILTER_NAME_LIST(_IMPELLER_BLEND_MODE_NAME_LIST)}; + IMPELLER_FOR_EACH_BLEND_MODE(_IMPELLER_BLEND_MODE_FILTER_NAME_LIST)}; const std::string_view BlendModeToFilterString(BlendMode blend_mode) { return kBlendModeFilterNames[static_cast>( @@ -113,8 +113,7 @@ static std::optional AdvancedBlend( return std::nullopt; } - auto dst_snapshot = - inputs[0]->GetSnapshot("AdvancedBlend(Dst)", renderer, entity); + auto dst_snapshot = inputs[0]->GetSnapshot(renderer, entity); if (!dst_snapshot.has_value()) { return std::nullopt; } @@ -127,8 +126,7 @@ static std::optional AdvancedBlend( std::optional src_snapshot; std::array src_uvs; if (!foreground_color.has_value()) { - src_snapshot = - inputs[1]->GetSnapshot("AdvancedBlend(Src)", renderer, entity); + src_snapshot = inputs[1]->GetSnapshot(renderer, entity); if (!src_snapshot.has_value()) { if (!dst_snapshot.has_value()) { return std::nullopt; @@ -285,8 +283,7 @@ std::optional BlendFilterContents::CreateForegroundAdvancedBlend( BlendMode blend_mode, std::optional alpha, ColorFilterContents::AbsorbOpacity absorb_opacity) const { - auto dst_snapshot = - input->GetSnapshot("ForegroundAdvancedBlend", renderer, entity); + auto dst_snapshot = input->GetSnapshot(renderer, entity); if (!dst_snapshot.has_value()) { return std::nullopt; } @@ -432,8 +429,7 @@ std::optional BlendFilterContents::CreateForegroundPorterDuffBlend( return std::nullopt; } - auto dst_snapshot = - input->GetSnapshot("ForegroundPorterDuffBlend", renderer, entity); + auto dst_snapshot = input->GetSnapshot(renderer, entity); if (!dst_snapshot.has_value()) { return std::nullopt; } @@ -535,8 +531,7 @@ static std::optional PipelineBlend( using VS = TexturePipeline::VertexShader; using FS = TexturePipeline::FragmentShader; - auto dst_snapshot = - inputs[0]->GetSnapshot("PipelineBlend(Dst)", renderer, entity); + auto dst_snapshot = inputs[0]->GetSnapshot(renderer, entity); if (!dst_snapshot.has_value()) { return std::nullopt; // Nothing to render. } @@ -623,8 +618,7 @@ static std::optional PipelineBlend( for (auto texture_i = inputs.begin() + 1; texture_i < inputs.end(); texture_i++) { - auto src_input = texture_i->get()->GetSnapshot("PipelineBlend(Src)", - renderer, entity); + auto src_input = texture_i->get()->GetSnapshot(renderer, entity); if (!add_blend_command(src_input)) { return true; } @@ -695,8 +689,7 @@ std::optional BlendFilterContents::CreateFramebufferAdvancedBlend( FML_DCHECK(inputs.size() == 2u || (inputs.size() == 1u && foreground_color.has_value())); - auto dst_snapshot = - inputs[0]->GetSnapshot("ForegroundAdvancedBlend", renderer, entity); + auto dst_snapshot = inputs[0]->GetSnapshot(renderer, entity); if (!dst_snapshot.has_value()) { return std::nullopt; } @@ -756,8 +749,7 @@ std::optional BlendFilterContents::CreateFramebufferAdvancedBlend( if (foreground_color.has_value()) { src_texture = foreground_texture; } else { - auto src_snapshot = - inputs[0]->GetSnapshot("ForegroundAdvancedBlend", renderer, entity); + auto src_snapshot = inputs[0]->GetSnapshot(renderer, entity); if (!src_snapshot.has_value()) { return false; } diff --git a/impeller/entity/contents/filters/border_mask_blur_filter_contents.cc b/impeller/entity/contents/filters/border_mask_blur_filter_contents.cc index 81b157d8ad9d8..c3f959aba3104 100644 --- a/impeller/entity/contents/filters/border_mask_blur_filter_contents.cc +++ b/impeller/entity/contents/filters/border_mask_blur_filter_contents.cc @@ -66,8 +66,7 @@ std::optional BorderMaskBlurFilterContents::RenderFilter( return std::nullopt; } - auto input_snapshot = - inputs[0]->GetSnapshot("BorderMaskBlur", renderer, entity); + auto input_snapshot = inputs[0]->GetSnapshot(renderer, entity); if (!input_snapshot.has_value()) { return std::nullopt; } diff --git a/impeller/entity/contents/filters/color_matrix_filter_contents.cc b/impeller/entity/contents/filters/color_matrix_filter_contents.cc index b13fe19e7cafc..4f93bb37daae9 100644 --- a/impeller/entity/contents/filters/color_matrix_filter_contents.cc +++ b/impeller/entity/contents/filters/color_matrix_filter_contents.cc @@ -43,7 +43,7 @@ std::optional ColorMatrixFilterContents::RenderFilter( return std::nullopt; } - auto input_snapshot = inputs[0]->GetSnapshot("ColorMatrix", renderer, entity); + auto input_snapshot = inputs[0]->GetSnapshot(renderer, entity); if (!input_snapshot.has_value()) { return std::nullopt; } diff --git a/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc b/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc index b2e81ce1dc342..53fd86e945a3c 100644 --- a/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc +++ b/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc @@ -130,7 +130,7 @@ std::optional GetSnapshot(const std::shared_ptr& input, const Entity& entity, const std::optional& coverage_hint) { std::optional input_snapshot = - input->GetSnapshot("GaussianBlur", renderer, entity, + input->GetSnapshot(renderer, entity, /*coverage_limit=*/coverage_hint); if (!input_snapshot.has_value()) { return std::nullopt; diff --git a/impeller/entity/contents/filters/inputs/contents_filter_input.cc b/impeller/entity/contents/filters/inputs/contents_filter_input.cc index 57a68747e97fc..d2c8d24c8a0e5 100644 --- a/impeller/entity/contents/filters/inputs/contents_filter_input.cc +++ b/impeller/entity/contents/filters/inputs/contents_filter_input.cc @@ -7,8 +7,6 @@ #include #include -#include "impeller/base/strings.h" - namespace impeller { ContentsFilterInput::ContentsFilterInput(std::shared_ptr contents, @@ -18,7 +16,6 @@ ContentsFilterInput::ContentsFilterInput(std::shared_ptr contents, ContentsFilterInput::~ContentsFilterInput() = default; std::optional ContentsFilterInput::GetSnapshot( - const std::string& label, const ContentContext& renderer, const Entity& entity, std::optional coverage_limit, @@ -27,14 +24,13 @@ std::optional ContentsFilterInput::GetSnapshot( coverage_limit = entity.GetContents()->GetCoverageHint(); } if (!snapshot_.has_value()) { - snapshot_ = contents_->RenderToSnapshot( - renderer, // renderer - entity, // entity - coverage_limit, // coverage_limit - std::nullopt, // sampler_descriptor - msaa_enabled_, // msaa_enabled - /*mip_count=*/mip_count, - SPrintF("Contents to %s Filter Snapshot", label.c_str())); // label + snapshot_ = contents_->RenderToSnapshot(renderer, // renderer + entity, // entity + coverage_limit, // coverage_limit + std::nullopt, // sampler_descriptor + msaa_enabled_, // msaa_enabled + /*mip_count=*/mip_count // + ); } return snapshot_; } diff --git a/impeller/entity/contents/filters/inputs/contents_filter_input.h b/impeller/entity/contents/filters/inputs/contents_filter_input.h index 0a43968f9f576..740e7c9eee3a5 100644 --- a/impeller/entity/contents/filters/inputs/contents_filter_input.h +++ b/impeller/entity/contents/filters/inputs/contents_filter_input.h @@ -14,8 +14,7 @@ class ContentsFilterInput final : public FilterInput { ~ContentsFilterInput() override; // |FilterInput| - std::optional GetSnapshot(const std::string& label, - const ContentContext& renderer, + std::optional GetSnapshot(const ContentContext& renderer, const Entity& entity, std::optional coverage_limit, int32_t mip_count) const override; diff --git a/impeller/entity/contents/filters/inputs/filter_contents_filter_input.cc b/impeller/entity/contents/filters/inputs/filter_contents_filter_input.cc index 9eb01a7437dcd..a689f9b96a026 100644 --- a/impeller/entity/contents/filters/inputs/filter_contents_filter_input.cc +++ b/impeller/entity/contents/filters/inputs/filter_contents_filter_input.cc @@ -18,20 +18,18 @@ FilterContentsFilterInput::FilterContentsFilterInput( FilterContentsFilterInput::~FilterContentsFilterInput() = default; std::optional FilterContentsFilterInput::GetSnapshot( - const std::string& label, const ContentContext& renderer, const Entity& entity, std::optional coverage_limit, int32_t mip_count) const { if (!snapshot_.has_value()) { - snapshot_ = filter_->RenderToSnapshot( - renderer, // renderer - entity, // entity - coverage_limit, // coverage_limit - std::nullopt, // sampler_descriptor - true, // msaa_enabled - /*mip_count=*/mip_count, - SPrintF("Filter to %s Filter Snapshot", label.c_str())); // label + snapshot_ = filter_->RenderToSnapshot(renderer, // renderer + entity, // entity + coverage_limit, // coverage_limit + std::nullopt, // sampler_descriptor + true, // msaa_enabled + /*mip_count=*/mip_count // + ); // label } return snapshot_; } diff --git a/impeller/entity/contents/filters/inputs/filter_contents_filter_input.h b/impeller/entity/contents/filters/inputs/filter_contents_filter_input.h index d1f42f32eaf01..195a26ecd5e38 100644 --- a/impeller/entity/contents/filters/inputs/filter_contents_filter_input.h +++ b/impeller/entity/contents/filters/inputs/filter_contents_filter_input.h @@ -14,8 +14,7 @@ class FilterContentsFilterInput final : public FilterInput { ~FilterContentsFilterInput() override; // |FilterInput| - std::optional GetSnapshot(const std::string& label, - const ContentContext& renderer, + std::optional GetSnapshot(const ContentContext& renderer, const Entity& entity, std::optional coverage_limit, int32_t mip_count) const override; diff --git a/impeller/entity/contents/filters/inputs/filter_input.h b/impeller/entity/contents/filters/inputs/filter_input.h index e8edd041c750a..293f62e08088c 100644 --- a/impeller/entity/contents/filters/inputs/filter_input.h +++ b/impeller/entity/contents/filters/inputs/filter_input.h @@ -46,7 +46,6 @@ class FilterInput { static FilterInput::Vector Make(std::initializer_list inputs); virtual std::optional GetSnapshot( - const std::string& label, const ContentContext& renderer, const Entity& entity, std::optional coverage_limit = std::nullopt, diff --git a/impeller/entity/contents/filters/inputs/placeholder_filter_input.cc b/impeller/entity/contents/filters/inputs/placeholder_filter_input.cc index 2742340d403ed..0c3dc21b7fee5 100644 --- a/impeller/entity/contents/filters/inputs/placeholder_filter_input.cc +++ b/impeller/entity/contents/filters/inputs/placeholder_filter_input.cc @@ -14,7 +14,6 @@ PlaceholderFilterInput::PlaceholderFilterInput(Rect coverage_rect) PlaceholderFilterInput::~PlaceholderFilterInput() = default; std::optional PlaceholderFilterInput::GetSnapshot( - const std::string& label, const ContentContext& renderer, const Entity& entity, std::optional coverage_limit, diff --git a/impeller/entity/contents/filters/inputs/placeholder_filter_input.h b/impeller/entity/contents/filters/inputs/placeholder_filter_input.h index 1096d57246614..2ab9a08824a0e 100644 --- a/impeller/entity/contents/filters/inputs/placeholder_filter_input.h +++ b/impeller/entity/contents/filters/inputs/placeholder_filter_input.h @@ -16,8 +16,7 @@ class PlaceholderFilterInput final : public FilterInput { ~PlaceholderFilterInput() override; // |FilterInput| - std::optional GetSnapshot(const std::string& label, - const ContentContext& renderer, + std::optional GetSnapshot(const ContentContext& renderer, const Entity& entity, std::optional coverage_limit, int32_t mip_count = 1) const override; diff --git a/impeller/entity/contents/filters/inputs/texture_filter_input.cc b/impeller/entity/contents/filters/inputs/texture_filter_input.cc index 0e84e740379f9..053cc6e199739 100644 --- a/impeller/entity/contents/filters/inputs/texture_filter_input.cc +++ b/impeller/entity/contents/filters/inputs/texture_filter_input.cc @@ -17,7 +17,6 @@ TextureFilterInput::TextureFilterInput(std::shared_ptr texture, TextureFilterInput::~TextureFilterInput() = default; std::optional TextureFilterInput::GetSnapshot( - const std::string& label, const ContentContext& renderer, const Entity& entity, std::optional coverage_limit, diff --git a/impeller/entity/contents/filters/inputs/texture_filter_input.h b/impeller/entity/contents/filters/inputs/texture_filter_input.h index 218659b28ec9a..477732daa01dd 100644 --- a/impeller/entity/contents/filters/inputs/texture_filter_input.h +++ b/impeller/entity/contents/filters/inputs/texture_filter_input.h @@ -16,8 +16,7 @@ class TextureFilterInput final : public FilterInput { ~TextureFilterInput() override; // |FilterInput| - std::optional GetSnapshot(const std::string& label, - const ContentContext& renderer, + std::optional GetSnapshot(const ContentContext& renderer, const Entity& entity, std::optional coverage_limit, int32_t mip_count) const override; diff --git a/impeller/entity/contents/filters/linear_to_srgb_filter_contents.cc b/impeller/entity/contents/filters/linear_to_srgb_filter_contents.cc index ac8debca592d6..69b21a0bf1f11 100644 --- a/impeller/entity/contents/filters/linear_to_srgb_filter_contents.cc +++ b/impeller/entity/contents/filters/linear_to_srgb_filter_contents.cc @@ -31,8 +31,7 @@ std::optional LinearToSrgbFilterContents::RenderFilter( using VS = LinearToSrgbFilterPipeline::VertexShader; using FS = LinearToSrgbFilterPipeline::FragmentShader; - auto input_snapshot = - inputs[0]->GetSnapshot("LinearToSrgb", renderer, entity); + auto input_snapshot = inputs[0]->GetSnapshot(renderer, entity); if (!input_snapshot.has_value()) { return std::nullopt; } diff --git a/impeller/entity/contents/filters/local_matrix_filter_contents.cc b/impeller/entity/contents/filters/local_matrix_filter_contents.cc index de06e4f953a24..e28b6c5b5421c 100644 --- a/impeller/entity/contents/filters/local_matrix_filter_contents.cc +++ b/impeller/entity/contents/filters/local_matrix_filter_contents.cc @@ -37,8 +37,7 @@ std::optional LocalMatrixFilterContents::RenderFilter( const Matrix& effect_transform, const Rect& coverage, const std::optional& coverage_hint) const { - std::optional snapshot = - inputs[0]->GetSnapshot("LocalMatrix", renderer, entity); + std::optional snapshot = inputs[0]->GetSnapshot(renderer, entity); if (!snapshot.has_value()) { return std::nullopt; } diff --git a/impeller/entity/contents/filters/matrix_filter_contents.cc b/impeller/entity/contents/filters/matrix_filter_contents.cc index 444a62ee298aa..7076b80be6b00 100644 --- a/impeller/entity/contents/filters/matrix_filter_contents.cc +++ b/impeller/entity/contents/filters/matrix_filter_contents.cc @@ -53,7 +53,7 @@ std::optional MatrixFilterContents::RenderFilter( const Matrix& effect_transform, const Rect& coverage, const std::optional& coverage_hint) const { - auto snapshot = inputs[0]->GetSnapshot("Matrix", renderer, entity); + auto snapshot = inputs[0]->GetSnapshot(renderer, entity); if (!snapshot.has_value()) { return std::nullopt; } diff --git a/impeller/entity/contents/filters/morphology_filter_contents.cc b/impeller/entity/contents/filters/morphology_filter_contents.cc index 87c0706deb763..f0697c3218d3d 100644 --- a/impeller/entity/contents/filters/morphology_filter_contents.cc +++ b/impeller/entity/contents/filters/morphology_filter_contents.cc @@ -53,7 +53,7 @@ std::optional DirectionalMorphologyFilterContents::RenderFilter( return std::nullopt; } - auto input_snapshot = inputs[0]->GetSnapshot("Morphology", renderer, entity); + auto input_snapshot = inputs[0]->GetSnapshot(renderer, entity); if (!input_snapshot.has_value()) { return std::nullopt; } diff --git a/impeller/entity/contents/filters/runtime_effect_filter_contents.cc b/impeller/entity/contents/filters/runtime_effect_filter_contents.cc index 4bc87c443efd9..15bbac1313131 100644 --- a/impeller/entity/contents/filters/runtime_effect_filter_contents.cc +++ b/impeller/entity/contents/filters/runtime_effect_filter_contents.cc @@ -41,8 +41,7 @@ std::optional RuntimeEffectFilterContents::RenderFilter( return std::nullopt; } - auto input_snapshot = - inputs[0]->GetSnapshot("RuntimeEffectContents", renderer, entity); + auto input_snapshot = inputs[0]->GetSnapshot(renderer, entity); if (!input_snapshot.has_value()) { return std::nullopt; } diff --git a/impeller/entity/contents/filters/srgb_to_linear_filter_contents.cc b/impeller/entity/contents/filters/srgb_to_linear_filter_contents.cc index e69ac505324df..6fd55e5887e96 100644 --- a/impeller/entity/contents/filters/srgb_to_linear_filter_contents.cc +++ b/impeller/entity/contents/filters/srgb_to_linear_filter_contents.cc @@ -31,8 +31,7 @@ std::optional SrgbToLinearFilterContents::RenderFilter( using VS = SrgbToLinearFilterPipeline::VertexShader; using FS = SrgbToLinearFilterPipeline::FragmentShader; - auto input_snapshot = - inputs[0]->GetSnapshot("SrgbToLinear", renderer, entity); + auto input_snapshot = inputs[0]->GetSnapshot(renderer, entity); if (!input_snapshot.has_value()) { return std::nullopt; } diff --git a/impeller/entity/contents/filters/yuv_to_rgb_filter_contents.cc b/impeller/entity/contents/filters/yuv_to_rgb_filter_contents.cc index bf10fe686b0c4..556efedd76cfe 100644 --- a/impeller/entity/contents/filters/yuv_to_rgb_filter_contents.cc +++ b/impeller/entity/contents/filters/yuv_to_rgb_filter_contents.cc @@ -51,10 +51,8 @@ std::optional YUVToRGBFilterContents::RenderFilter( using VS = YUVToRGBFilterPipeline::VertexShader; using FS = YUVToRGBFilterPipeline::FragmentShader; - auto y_input_snapshot = - inputs[0]->GetSnapshot("YUVToRGB(Y)", renderer, entity); - auto uv_input_snapshot = - inputs[1]->GetSnapshot("YUVToRGB(UV)", renderer, entity); + auto y_input_snapshot = inputs[0]->GetSnapshot(renderer, entity); + auto uv_input_snapshot = inputs[1]->GetSnapshot(renderer, entity); if (!y_input_snapshot.has_value() || !uv_input_snapshot.has_value()) { return std::nullopt; } From 95ead9c7205b09ee3a51113ac95f60f48288c141 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Tue, 10 Dec 2024 15:55:40 -0800 Subject: [PATCH 3/6] ++ --- impeller/entity/contents/filters/blend_filter_contents.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/impeller/entity/contents/filters/blend_filter_contents.cc b/impeller/entity/contents/filters/blend_filter_contents.cc index 55e38e95a1f83..50c12cfa63d2f 100644 --- a/impeller/entity/contents/filters/blend_filter_contents.cc +++ b/impeller/entity/contents/filters/blend_filter_contents.cc @@ -38,10 +38,12 @@ namespace { static constexpr const char* kBlendModeFilterNames[] = { IMPELLER_FOR_EACH_BLEND_MODE(_IMPELLER_BLEND_MODE_FILTER_NAME_LIST)}; +#ifdef IMPELLER_DEBUG const std::string_view BlendModeToFilterString(BlendMode blend_mode) { return kBlendModeFilterNames[static_cast>( blend_mode)]; } +#endif // IMPELLER_DEBUG } // namespace From ee561aadbecab267838eb747e5c5969d918f7358 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Tue, 10 Dec 2024 16:24:44 -0800 Subject: [PATCH 4/6] ++ --- impeller/entity/contents/filters/blend_filter_contents.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/impeller/entity/contents/filters/blend_filter_contents.cc b/impeller/entity/contents/filters/blend_filter_contents.cc index 50c12cfa63d2f..8bde0749bc4aa 100644 --- a/impeller/entity/contents/filters/blend_filter_contents.cc +++ b/impeller/entity/contents/filters/blend_filter_contents.cc @@ -32,13 +32,14 @@ namespace impeller { namespace { +#ifdef IMPELLER_DEBUG + #define _IMPELLER_BLEND_MODE_FILTER_NAME_LIST(blend_mode) \ "Blend Filter " #blend_mode, static constexpr const char* kBlendModeFilterNames[] = { IMPELLER_FOR_EACH_BLEND_MODE(_IMPELLER_BLEND_MODE_FILTER_NAME_LIST)}; -#ifdef IMPELLER_DEBUG const std::string_view BlendModeToFilterString(BlendMode blend_mode) { return kBlendModeFilterNames[static_cast>( blend_mode)]; From 6e9f5d16721f774cf89a13bc8b51547d290f8208 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Wed, 11 Dec 2024 17:25:40 -0800 Subject: [PATCH 5/6] string view everywhere. --- impeller/entity/contents/contents.cc | 2 +- impeller/entity/contents/contents.h | 2 +- .../contents/filters/blend_filter_contents.cc | 24 ++++++++++++------- .../border_mask_blur_filter_contents.cc | 3 ++- .../filters/color_matrix_filter_contents.cc | 2 +- .../contents/filters/filter_contents.cc | 5 ++-- .../entity/contents/filters/filter_contents.h | 2 +- .../filters/gaussian_blur_filter_contents.cc | 2 +- .../filters/inputs/contents_filter_input.cc | 4 +++- .../filters/inputs/contents_filter_input.h | 3 ++- .../inputs/filter_contents_filter_input.cc | 5 ++-- .../inputs/filter_contents_filter_input.h | 3 ++- .../contents/filters/inputs/filter_input.h | 1 + .../inputs/placeholder_filter_input.cc | 1 + .../filters/inputs/placeholder_filter_input.h | 3 ++- .../filters/inputs/texture_filter_input.cc | 1 + .../filters/inputs/texture_filter_input.h | 3 ++- .../filters/linear_to_srgb_filter_contents.cc | 3 ++- .../filters/local_matrix_filter_contents.cc | 3 ++- .../filters/matrix_filter_contents.cc | 2 +- .../filters/morphology_filter_contents.cc | 2 +- .../filters/runtime_effect_filter_contents.cc | 3 ++- .../filters/srgb_to_linear_filter_contents.cc | 3 ++- .../filters/yuv_to_rgb_filter_contents.cc | 6 +++-- impeller/entity/contents/texture_contents.cc | 2 +- impeller/entity/contents/texture_contents.h | 2 +- .../entity/contents/tiled_texture_contents.cc | 2 +- .../entity/contents/tiled_texture_contents.h | 2 +- 28 files changed, 61 insertions(+), 35 deletions(-) diff --git a/impeller/entity/contents/contents.cc b/impeller/entity/contents/contents.cc index 60998616fefcf..21d7ebf75d08c 100644 --- a/impeller/entity/contents/contents.cc +++ b/impeller/entity/contents/contents.cc @@ -60,7 +60,7 @@ std::optional Contents::RenderToSnapshot( const std::optional& sampler_descriptor, bool msaa_enabled, int32_t mip_count, - const std::string& label) const { + std::string_view label) const { auto coverage = GetCoverage(entity); if (!coverage.has_value()) { return std::nullopt; diff --git a/impeller/entity/contents/contents.h b/impeller/entity/contents/contents.h index 31a8aed38faab..2672136c52d70 100644 --- a/impeller/entity/contents/contents.h +++ b/impeller/entity/contents/contents.h @@ -95,7 +95,7 @@ class Contents { const std::optional& sampler_descriptor = std::nullopt, bool msaa_enabled = true, int32_t mip_count = 1, - const std::string& label = "Snapshot") const; + std::string_view label = "Snapshot") const; //---------------------------------------------------------------------------- /// @brief Return the color source's intrinsic size, if available. diff --git a/impeller/entity/contents/filters/blend_filter_contents.cc b/impeller/entity/contents/filters/blend_filter_contents.cc index 8bde0749bc4aa..fe4486310470f 100644 --- a/impeller/entity/contents/filters/blend_filter_contents.cc +++ b/impeller/entity/contents/filters/blend_filter_contents.cc @@ -116,7 +116,8 @@ static std::optional AdvancedBlend( return std::nullopt; } - auto dst_snapshot = inputs[0]->GetSnapshot(renderer, entity); + auto dst_snapshot = + inputs[0]->GetSnapshot("AdvancedBlend(Src)", renderer, entity); if (!dst_snapshot.has_value()) { return std::nullopt; } @@ -129,7 +130,8 @@ static std::optional AdvancedBlend( std::optional src_snapshot; std::array src_uvs; if (!foreground_color.has_value()) { - src_snapshot = inputs[1]->GetSnapshot(renderer, entity); + src_snapshot = + inputs[1]->GetSnapshot("AdvancedBlend(Dst)", renderer, entity); if (!src_snapshot.has_value()) { if (!dst_snapshot.has_value()) { return std::nullopt; @@ -286,7 +288,8 @@ std::optional BlendFilterContents::CreateForegroundAdvancedBlend( BlendMode blend_mode, std::optional alpha, ColorFilterContents::AbsorbOpacity absorb_opacity) const { - auto dst_snapshot = input->GetSnapshot(renderer, entity); + auto dst_snapshot = + input->GetSnapshot("ForegroundAdvancedBlend", renderer, entity); if (!dst_snapshot.has_value()) { return std::nullopt; } @@ -432,7 +435,8 @@ std::optional BlendFilterContents::CreateForegroundPorterDuffBlend( return std::nullopt; } - auto dst_snapshot = input->GetSnapshot(renderer, entity); + auto dst_snapshot = + input->GetSnapshot("ForegroundPorterDuffBlend", renderer, entity); if (!dst_snapshot.has_value()) { return std::nullopt; } @@ -534,7 +538,8 @@ static std::optional PipelineBlend( using VS = TexturePipeline::VertexShader; using FS = TexturePipeline::FragmentShader; - auto dst_snapshot = inputs[0]->GetSnapshot(renderer, entity); + auto dst_snapshot = + inputs[0]->GetSnapshot("PipelineBlend(Dst)", renderer, entity); if (!dst_snapshot.has_value()) { return std::nullopt; // Nothing to render. } @@ -621,7 +626,8 @@ static std::optional PipelineBlend( for (auto texture_i = inputs.begin() + 1; texture_i < inputs.end(); texture_i++) { - auto src_input = texture_i->get()->GetSnapshot(renderer, entity); + auto src_input = texture_i->get()->GetSnapshot("PipelineBlend(Src)", + renderer, entity); if (!add_blend_command(src_input)) { return true; } @@ -692,7 +698,8 @@ std::optional BlendFilterContents::CreateFramebufferAdvancedBlend( FML_DCHECK(inputs.size() == 2u || (inputs.size() == 1u && foreground_color.has_value())); - auto dst_snapshot = inputs[0]->GetSnapshot(renderer, entity); + auto dst_snapshot = + inputs[0]->GetSnapshot("ForegroundAdvancedBlend", renderer, entity); if (!dst_snapshot.has_value()) { return std::nullopt; } @@ -752,7 +759,8 @@ std::optional BlendFilterContents::CreateFramebufferAdvancedBlend( if (foreground_color.has_value()) { src_texture = foreground_texture; } else { - auto src_snapshot = inputs[0]->GetSnapshot(renderer, entity); + auto src_snapshot = + inputs[0]->GetSnapshot("ForegroundAdvancedBlend", renderer, entity); if (!src_snapshot.has_value()) { return false; } diff --git a/impeller/entity/contents/filters/border_mask_blur_filter_contents.cc b/impeller/entity/contents/filters/border_mask_blur_filter_contents.cc index c3f959aba3104..81b157d8ad9d8 100644 --- a/impeller/entity/contents/filters/border_mask_blur_filter_contents.cc +++ b/impeller/entity/contents/filters/border_mask_blur_filter_contents.cc @@ -66,7 +66,8 @@ std::optional BorderMaskBlurFilterContents::RenderFilter( return std::nullopt; } - auto input_snapshot = inputs[0]->GetSnapshot(renderer, entity); + auto input_snapshot = + inputs[0]->GetSnapshot("BorderMaskBlur", renderer, entity); if (!input_snapshot.has_value()) { return std::nullopt; } diff --git a/impeller/entity/contents/filters/color_matrix_filter_contents.cc b/impeller/entity/contents/filters/color_matrix_filter_contents.cc index 4f93bb37daae9..b13fe19e7cafc 100644 --- a/impeller/entity/contents/filters/color_matrix_filter_contents.cc +++ b/impeller/entity/contents/filters/color_matrix_filter_contents.cc @@ -43,7 +43,7 @@ std::optional ColorMatrixFilterContents::RenderFilter( return std::nullopt; } - auto input_snapshot = inputs[0]->GetSnapshot(renderer, entity); + auto input_snapshot = inputs[0]->GetSnapshot("ColorMatrix", renderer, entity); if (!input_snapshot.has_value()) { return std::nullopt; } diff --git a/impeller/entity/contents/filters/filter_contents.cc b/impeller/entity/contents/filters/filter_contents.cc index ddfaa2c6388c5..9d42ad104dff2 100644 --- a/impeller/entity/contents/filters/filter_contents.cc +++ b/impeller/entity/contents/filters/filter_contents.cc @@ -253,7 +253,7 @@ std::optional FilterContents::RenderToSnapshot( const std::optional& sampler_descriptor, bool msaa_enabled, int32_t mip_count, - const std::string& label) const { + std::string_view label) const { // Resolve the render instruction (entity) from the filter and render it to a // snapshot. if (std::optional result = @@ -266,7 +266,8 @@ std::optional FilterContents::RenderToSnapshot( std::nullopt, // sampler_descriptor true, // msaa_enabled /*mip_count=*/mip_count, - label); // label + label // label + ); } return std::nullopt; diff --git a/impeller/entity/contents/filters/filter_contents.h b/impeller/entity/contents/filters/filter_contents.h index 3177cf7518ee3..baa168f16719b 100644 --- a/impeller/entity/contents/filters/filter_contents.h +++ b/impeller/entity/contents/filters/filter_contents.h @@ -126,7 +126,7 @@ class FilterContents : public Contents { const std::optional& sampler_descriptor = std::nullopt, bool msaa_enabled = true, int32_t mip_count = 1, - const std::string& label = "Filter Snapshot") const override; + std::string_view label = "Filter Snapshot") const override; /// @brief Determines the coverage of source pixels that will be needed /// to produce results for the specified |output_limit| under the diff --git a/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc b/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc index 53fd86e945a3c..b2e81ce1dc342 100644 --- a/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc +++ b/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc @@ -130,7 +130,7 @@ std::optional GetSnapshot(const std::shared_ptr& input, const Entity& entity, const std::optional& coverage_hint) { std::optional input_snapshot = - input->GetSnapshot(renderer, entity, + input->GetSnapshot("GaussianBlur", renderer, entity, /*coverage_limit=*/coverage_hint); if (!input_snapshot.has_value()) { return std::nullopt; diff --git a/impeller/entity/contents/filters/inputs/contents_filter_input.cc b/impeller/entity/contents/filters/inputs/contents_filter_input.cc index d2c8d24c8a0e5..9be12186d4baa 100644 --- a/impeller/entity/contents/filters/inputs/contents_filter_input.cc +++ b/impeller/entity/contents/filters/inputs/contents_filter_input.cc @@ -16,6 +16,7 @@ ContentsFilterInput::ContentsFilterInput(std::shared_ptr contents, ContentsFilterInput::~ContentsFilterInput() = default; std::optional ContentsFilterInput::GetSnapshot( + std::string_view label, const ContentContext& renderer, const Entity& entity, std::optional coverage_limit, @@ -29,7 +30,8 @@ std::optional ContentsFilterInput::GetSnapshot( coverage_limit, // coverage_limit std::nullopt, // sampler_descriptor msaa_enabled_, // msaa_enabled - /*mip_count=*/mip_count // + /*mip_count=*/mip_count, // + label // ); } return snapshot_; diff --git a/impeller/entity/contents/filters/inputs/contents_filter_input.h b/impeller/entity/contents/filters/inputs/contents_filter_input.h index 740e7c9eee3a5..42258f3d3a8a6 100644 --- a/impeller/entity/contents/filters/inputs/contents_filter_input.h +++ b/impeller/entity/contents/filters/inputs/contents_filter_input.h @@ -14,7 +14,8 @@ class ContentsFilterInput final : public FilterInput { ~ContentsFilterInput() override; // |FilterInput| - std::optional GetSnapshot(const ContentContext& renderer, + std::optional GetSnapshot(std::string_view label, + const ContentContext& renderer, const Entity& entity, std::optional coverage_limit, int32_t mip_count) const override; diff --git a/impeller/entity/contents/filters/inputs/filter_contents_filter_input.cc b/impeller/entity/contents/filters/inputs/filter_contents_filter_input.cc index a689f9b96a026..10000909a7da8 100644 --- a/impeller/entity/contents/filters/inputs/filter_contents_filter_input.cc +++ b/impeller/entity/contents/filters/inputs/filter_contents_filter_input.cc @@ -18,6 +18,7 @@ FilterContentsFilterInput::FilterContentsFilterInput( FilterContentsFilterInput::~FilterContentsFilterInput() = default; std::optional FilterContentsFilterInput::GetSnapshot( + std::string_view label, const ContentContext& renderer, const Entity& entity, std::optional coverage_limit, @@ -28,8 +29,8 @@ std::optional FilterContentsFilterInput::GetSnapshot( coverage_limit, // coverage_limit std::nullopt, // sampler_descriptor true, // msaa_enabled - /*mip_count=*/mip_count // - ); // label + /*mip_count=*/mip_count, // + label); // label } return snapshot_; } diff --git a/impeller/entity/contents/filters/inputs/filter_contents_filter_input.h b/impeller/entity/contents/filters/inputs/filter_contents_filter_input.h index 195a26ecd5e38..9bcac002b6207 100644 --- a/impeller/entity/contents/filters/inputs/filter_contents_filter_input.h +++ b/impeller/entity/contents/filters/inputs/filter_contents_filter_input.h @@ -14,7 +14,8 @@ class FilterContentsFilterInput final : public FilterInput { ~FilterContentsFilterInput() override; // |FilterInput| - std::optional GetSnapshot(const ContentContext& renderer, + std::optional GetSnapshot(std::string_view label, + const ContentContext& renderer, const Entity& entity, std::optional coverage_limit, int32_t mip_count) const override; diff --git a/impeller/entity/contents/filters/inputs/filter_input.h b/impeller/entity/contents/filters/inputs/filter_input.h index 293f62e08088c..7888ac6ef9ec1 100644 --- a/impeller/entity/contents/filters/inputs/filter_input.h +++ b/impeller/entity/contents/filters/inputs/filter_input.h @@ -46,6 +46,7 @@ class FilterInput { static FilterInput::Vector Make(std::initializer_list inputs); virtual std::optional GetSnapshot( + std::string_view label, const ContentContext& renderer, const Entity& entity, std::optional coverage_limit = std::nullopt, diff --git a/impeller/entity/contents/filters/inputs/placeholder_filter_input.cc b/impeller/entity/contents/filters/inputs/placeholder_filter_input.cc index 0c3dc21b7fee5..0201645f40817 100644 --- a/impeller/entity/contents/filters/inputs/placeholder_filter_input.cc +++ b/impeller/entity/contents/filters/inputs/placeholder_filter_input.cc @@ -14,6 +14,7 @@ PlaceholderFilterInput::PlaceholderFilterInput(Rect coverage_rect) PlaceholderFilterInput::~PlaceholderFilterInput() = default; std::optional PlaceholderFilterInput::GetSnapshot( + std::string_view label, const ContentContext& renderer, const Entity& entity, std::optional coverage_limit, diff --git a/impeller/entity/contents/filters/inputs/placeholder_filter_input.h b/impeller/entity/contents/filters/inputs/placeholder_filter_input.h index 2ab9a08824a0e..e64688c03016f 100644 --- a/impeller/entity/contents/filters/inputs/placeholder_filter_input.h +++ b/impeller/entity/contents/filters/inputs/placeholder_filter_input.h @@ -16,7 +16,8 @@ class PlaceholderFilterInput final : public FilterInput { ~PlaceholderFilterInput() override; // |FilterInput| - std::optional GetSnapshot(const ContentContext& renderer, + std::optional GetSnapshot(std::string_view label, + const ContentContext& renderer, const Entity& entity, std::optional coverage_limit, int32_t mip_count = 1) const override; diff --git a/impeller/entity/contents/filters/inputs/texture_filter_input.cc b/impeller/entity/contents/filters/inputs/texture_filter_input.cc index 053cc6e199739..38ee99a5b78d3 100644 --- a/impeller/entity/contents/filters/inputs/texture_filter_input.cc +++ b/impeller/entity/contents/filters/inputs/texture_filter_input.cc @@ -17,6 +17,7 @@ TextureFilterInput::TextureFilterInput(std::shared_ptr texture, TextureFilterInput::~TextureFilterInput() = default; std::optional TextureFilterInput::GetSnapshot( + std::string_view label, const ContentContext& renderer, const Entity& entity, std::optional coverage_limit, diff --git a/impeller/entity/contents/filters/inputs/texture_filter_input.h b/impeller/entity/contents/filters/inputs/texture_filter_input.h index 477732daa01dd..817dcb3077e25 100644 --- a/impeller/entity/contents/filters/inputs/texture_filter_input.h +++ b/impeller/entity/contents/filters/inputs/texture_filter_input.h @@ -16,7 +16,8 @@ class TextureFilterInput final : public FilterInput { ~TextureFilterInput() override; // |FilterInput| - std::optional GetSnapshot(const ContentContext& renderer, + std::optional GetSnapshot(std::string_view label, + const ContentContext& renderer, const Entity& entity, std::optional coverage_limit, int32_t mip_count) const override; diff --git a/impeller/entity/contents/filters/linear_to_srgb_filter_contents.cc b/impeller/entity/contents/filters/linear_to_srgb_filter_contents.cc index 69b21a0bf1f11..ac8debca592d6 100644 --- a/impeller/entity/contents/filters/linear_to_srgb_filter_contents.cc +++ b/impeller/entity/contents/filters/linear_to_srgb_filter_contents.cc @@ -31,7 +31,8 @@ std::optional LinearToSrgbFilterContents::RenderFilter( using VS = LinearToSrgbFilterPipeline::VertexShader; using FS = LinearToSrgbFilterPipeline::FragmentShader; - auto input_snapshot = inputs[0]->GetSnapshot(renderer, entity); + auto input_snapshot = + inputs[0]->GetSnapshot("LinearToSrgb", renderer, entity); if (!input_snapshot.has_value()) { return std::nullopt; } diff --git a/impeller/entity/contents/filters/local_matrix_filter_contents.cc b/impeller/entity/contents/filters/local_matrix_filter_contents.cc index e28b6c5b5421c..de06e4f953a24 100644 --- a/impeller/entity/contents/filters/local_matrix_filter_contents.cc +++ b/impeller/entity/contents/filters/local_matrix_filter_contents.cc @@ -37,7 +37,8 @@ std::optional LocalMatrixFilterContents::RenderFilter( const Matrix& effect_transform, const Rect& coverage, const std::optional& coverage_hint) const { - std::optional snapshot = inputs[0]->GetSnapshot(renderer, entity); + std::optional snapshot = + inputs[0]->GetSnapshot("LocalMatrix", renderer, entity); if (!snapshot.has_value()) { return std::nullopt; } diff --git a/impeller/entity/contents/filters/matrix_filter_contents.cc b/impeller/entity/contents/filters/matrix_filter_contents.cc index 7076b80be6b00..444a62ee298aa 100644 --- a/impeller/entity/contents/filters/matrix_filter_contents.cc +++ b/impeller/entity/contents/filters/matrix_filter_contents.cc @@ -53,7 +53,7 @@ std::optional MatrixFilterContents::RenderFilter( const Matrix& effect_transform, const Rect& coverage, const std::optional& coverage_hint) const { - auto snapshot = inputs[0]->GetSnapshot(renderer, entity); + auto snapshot = inputs[0]->GetSnapshot("Matrix", renderer, entity); if (!snapshot.has_value()) { return std::nullopt; } diff --git a/impeller/entity/contents/filters/morphology_filter_contents.cc b/impeller/entity/contents/filters/morphology_filter_contents.cc index f0697c3218d3d..87c0706deb763 100644 --- a/impeller/entity/contents/filters/morphology_filter_contents.cc +++ b/impeller/entity/contents/filters/morphology_filter_contents.cc @@ -53,7 +53,7 @@ std::optional DirectionalMorphologyFilterContents::RenderFilter( return std::nullopt; } - auto input_snapshot = inputs[0]->GetSnapshot(renderer, entity); + auto input_snapshot = inputs[0]->GetSnapshot("Morphology", renderer, entity); if (!input_snapshot.has_value()) { return std::nullopt; } diff --git a/impeller/entity/contents/filters/runtime_effect_filter_contents.cc b/impeller/entity/contents/filters/runtime_effect_filter_contents.cc index 15bbac1313131..4bc87c443efd9 100644 --- a/impeller/entity/contents/filters/runtime_effect_filter_contents.cc +++ b/impeller/entity/contents/filters/runtime_effect_filter_contents.cc @@ -41,7 +41,8 @@ std::optional RuntimeEffectFilterContents::RenderFilter( return std::nullopt; } - auto input_snapshot = inputs[0]->GetSnapshot(renderer, entity); + auto input_snapshot = + inputs[0]->GetSnapshot("RuntimeEffectContents", renderer, entity); if (!input_snapshot.has_value()) { return std::nullopt; } diff --git a/impeller/entity/contents/filters/srgb_to_linear_filter_contents.cc b/impeller/entity/contents/filters/srgb_to_linear_filter_contents.cc index 6fd55e5887e96..e69ac505324df 100644 --- a/impeller/entity/contents/filters/srgb_to_linear_filter_contents.cc +++ b/impeller/entity/contents/filters/srgb_to_linear_filter_contents.cc @@ -31,7 +31,8 @@ std::optional SrgbToLinearFilterContents::RenderFilter( using VS = SrgbToLinearFilterPipeline::VertexShader; using FS = SrgbToLinearFilterPipeline::FragmentShader; - auto input_snapshot = inputs[0]->GetSnapshot(renderer, entity); + auto input_snapshot = + inputs[0]->GetSnapshot("SrgbToLinear", renderer, entity); if (!input_snapshot.has_value()) { return std::nullopt; } diff --git a/impeller/entity/contents/filters/yuv_to_rgb_filter_contents.cc b/impeller/entity/contents/filters/yuv_to_rgb_filter_contents.cc index 556efedd76cfe..bf10fe686b0c4 100644 --- a/impeller/entity/contents/filters/yuv_to_rgb_filter_contents.cc +++ b/impeller/entity/contents/filters/yuv_to_rgb_filter_contents.cc @@ -51,8 +51,10 @@ std::optional YUVToRGBFilterContents::RenderFilter( using VS = YUVToRGBFilterPipeline::VertexShader; using FS = YUVToRGBFilterPipeline::FragmentShader; - auto y_input_snapshot = inputs[0]->GetSnapshot(renderer, entity); - auto uv_input_snapshot = inputs[1]->GetSnapshot(renderer, entity); + auto y_input_snapshot = + inputs[0]->GetSnapshot("YUVToRGB(Y)", renderer, entity); + auto uv_input_snapshot = + inputs[1]->GetSnapshot("YUVToRGB(UV)", renderer, entity); if (!y_input_snapshot.has_value() || !uv_input_snapshot.has_value()) { return std::nullopt; } diff --git a/impeller/entity/contents/texture_contents.cc b/impeller/entity/contents/texture_contents.cc index f443558dd1c69..9e6274c33c226 100644 --- a/impeller/entity/contents/texture_contents.cc +++ b/impeller/entity/contents/texture_contents.cc @@ -77,7 +77,7 @@ std::optional TextureContents::RenderToSnapshot( const std::optional& sampler_descriptor, bool msaa_enabled, int32_t mip_count, - const std::string& label) const { + std::string_view label) const { // Passthrough textures that have simple rectangle paths and complete source // rects. auto bounds = destination_rect_; diff --git a/impeller/entity/contents/texture_contents.h b/impeller/entity/contents/texture_contents.h index 34657ff54dfa5..92cb29a234402 100644 --- a/impeller/entity/contents/texture_contents.h +++ b/impeller/entity/contents/texture_contents.h @@ -62,7 +62,7 @@ class TextureContents final : public Contents { const std::optional& sampler_descriptor = std::nullopt, bool msaa_enabled = true, int32_t mip_count = 1, - const std::string& label = "Texture Snapshot") const override; + std::string_view label = "Texture Snapshot") const override; // |Contents| bool Render(const ContentContext& renderer, diff --git a/impeller/entity/contents/tiled_texture_contents.cc b/impeller/entity/contents/tiled_texture_contents.cc index 549abf32ff99d..c082155cd7e77 100644 --- a/impeller/entity/contents/tiled_texture_contents.cc +++ b/impeller/entity/contents/tiled_texture_contents.cc @@ -175,7 +175,7 @@ std::optional TiledTextureContents::RenderToSnapshot( const std::optional& sampler_descriptor, bool msaa_enabled, int32_t mip_count, - const std::string& label) const { + std::string_view label) const { std::optional geometry_coverage = GetGeometry()->GetCoverage({}); if (GetInverseEffectTransform().IsIdentity() && GetGeometry()->IsAxisAlignedRect() && diff --git a/impeller/entity/contents/tiled_texture_contents.h b/impeller/entity/contents/tiled_texture_contents.h index 3c883aabab8ac..c10d74f412d45 100644 --- a/impeller/entity/contents/tiled_texture_contents.h +++ b/impeller/entity/contents/tiled_texture_contents.h @@ -59,7 +59,7 @@ class TiledTextureContents final : public ColorSourceContents { const std::optional& sampler_descriptor = std::nullopt, bool msaa_enabled = true, int32_t mip_count = 1, - const std::string& label = "Tiled Texture Snapshot") const override; + std::string_view label = "Tiled Texture Snapshot") const override; private: std::shared_ptr CreateFilterTexture( From abb6d7eaf1ab2594d031385a895cad83024be156 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Wed, 11 Dec 2024 17:27:11 -0800 Subject: [PATCH 6/6] fix src/dst label order. --- impeller/entity/contents/filters/blend_filter_contents.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/impeller/entity/contents/filters/blend_filter_contents.cc b/impeller/entity/contents/filters/blend_filter_contents.cc index fe4486310470f..94ad6023e8339 100644 --- a/impeller/entity/contents/filters/blend_filter_contents.cc +++ b/impeller/entity/contents/filters/blend_filter_contents.cc @@ -117,7 +117,7 @@ static std::optional AdvancedBlend( } auto dst_snapshot = - inputs[0]->GetSnapshot("AdvancedBlend(Src)", renderer, entity); + inputs[0]->GetSnapshot("AdvancedBlend(Dst)", renderer, entity); if (!dst_snapshot.has_value()) { return std::nullopt; } @@ -131,7 +131,7 @@ static std::optional AdvancedBlend( std::array src_uvs; if (!foreground_color.has_value()) { src_snapshot = - inputs[1]->GetSnapshot("AdvancedBlend(Dst)", renderer, entity); + inputs[1]->GetSnapshot("AdvancedBlend(Src)", renderer, entity); if (!src_snapshot.has_value()) { if (!dst_snapshot.has_value()) { return std::nullopt;