Skip to content

Revert: Remove BorderMaskBlur - #194567

Closed
flutteractionsbot wants to merge 1 commit into
flutter:masterfrom
flutteractionsbot:revert-194508-1792169007
Closed

flutteractionsbot wants to merge 1 commit into
flutter:masterfrom
flutteractionsbot:revert-194508-1792169007

Conversation

@flutteractionsbot

Copy link
Copy Markdown
Contributor

Reverts: Remove BorderMaskBlur

Initiated by: @eyebrowsoffire

Reason for reverting: tree is broken. Example failure: https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20linux_unopt/20632/overview

Original PR Author: @walley892

Reviewed By: @gaaclarke

The original PR description is provided below:

Removes the BorderMaskBlur pipeline and associated shaders.

This is created only in CreateMaskBlur when is_solid_color=false. The three argument CreateMaskBlur is only called in canvas.cc, and hardcodes is_solid_color=true.

std::shared_ptr<FilterContents> filter =

This shader looks like it was used in the olden days, but has been deadcode since 2024.

Part of #194511

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant in-code documentation (doc comments with ///).
  • If this PR introduces a new feature or capability, I created and linked a website documentation issue or PR in [flutter/website] (or verified none is needed).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

@flutteractionsbot flutteractionsbot mentioned this pull request Oct 16, 2026
11 tasks
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Oct 16, 2026
@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. e: impeller Impeller rendering backend issues and features requests labels Oct 16, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new BorderMaskBlur filter in Impeller, adding BorderMaskBlurFilterContents, a corresponding fragment shader border_mask_blur.frag, and updating pipeline configurations, Paint, and Canvas to support it. Unit tests are also added to verify coverage and correctness. The review feedback suggests adding null checks for inputs[0] in BorderMaskBlurFilterContents and input in Paint::WithMaskBlur to prevent potential crashes, as well as removing an unused alpha field from the FragInfo uniform block in the new shader.

Comment on lines +65 to +67
if (inputs.empty()) {
return std::nullopt;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

If inputs[0] is null, calling inputs[0]->GetSnapshot will result in a null pointer dereference and crash. Add a check to ensure inputs[0] is not null.

  if (inputs.empty() || !inputs[0]) {\n    return std::nullopt;\n  }

Comment on lines +148 to +150
if (inputs.empty()) {
return std::nullopt;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

If inputs[0] is null, dereferencing it on the following lines will cause a crash. We should defensively check if inputs[0] is null before proceeding.

  if (inputs.empty() || !inputs[0]) {\n    return std::nullopt;\n  }

Comment on lines +312 to +320
std::shared_ptr<Contents> Paint::WithMaskBlur(std::shared_ptr<Contents> input,
bool is_solid_color,
const Matrix& ctm) const {
if (mask_blur_descriptor.has_value()) {
input = mask_blur_descriptor->CreateMaskBlur(FilterInput::Make(input),
is_solid_color, ctm);
}
return input;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

If input is null, there is no content to apply a mask blur to. We should return nullptr early to avoid unnecessary processing and potential null pointer issues down the line.

std::shared_ptr<Contents> Paint::WithMaskBlur(std::shared_ptr<Contents> input,\n                                              bool is_solid_color,\n                                              const Matrix& ctm) const {\n  if (!input) {\n    return nullptr;\n  }\n  if (mask_blur_descriptor.has_value()) {\n    input = mask_blur_descriptor->CreateMaskBlur(FilterInput::Make(input),\n                                                 is_solid_color, ctm);\n  }\n  return input;\n}

Comment on lines +22 to +29
uniform FragInfo {
float16_t src_factor;
float16_t inner_blur_factor;
float16_t outer_blur_factor;
float16_t alpha;

f16vec2 sigma_uv;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The alpha field in the FragInfo uniform block is declared but never used in the shader. Removing it simplifies the uniform block and avoids sending unused data to the GPU.

uniform FragInfo {\n  float16_t src_factor;\n  float16_t inner_blur_factor;\n  float16_t outer_blur_factor;\n\n  f16vec2 sigma_uv;\n}
References
  1. Suggest simplification and refactoring: Assess whether the code can be made simpler or refactored to enhance readability and maintainability. (link)

@gaaclarke gaaclarke closed this Oct 16, 2026
@gaaclarke

Copy link
Copy Markdown
Member

This PR did not introduce the problem. Fix for actual problem in #194540

@flutteractionsbot
flutteractionsbot deleted the revert-194508-1792169007 branch October 16, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD e: impeller Impeller rendering backend issues and features requests engine flutter/engine related. See also e: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants