Sitelet https://github.com/flutter/flutter/pull/193189
Skip to content

Revert: Fix square corner issue - #193189

Merged
auto-submit[bot] merged 2 commits into
flutter:masterfrom
flutteractionsbot:revert-191096-1790114608
Sep 23, 2026
Merged

auto-submit[bot] merged 2 commits into
flutter:masterfrom
flutteractionsbot:revert-191096-1790114608

Conversation

@flutteractionsbot

@flutteractionsbot flutteractionsbot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Reverts: Fix square corner issue

Initiated by: @andywolff

Reason for reverting: seems to have caused a test order dependency #192992
Original PR Author: @andywolff

Reviewed By: @gaaclarke

The original PR description is provided below:

Fixes #190602, see my comment on that issue for details about the problems I identified.
Also fixes #162172

What changed

When a route contained rounded clips (such as CupertinoSheetRoute), intermediate child ink features, and a backdrop filter (such as a blurred app bar), the clip stack replay logic prematurely popped parent clips and exceeded the depth buffer budget across render pass splits, causing subsequent header draws to render with 90° square corners. This PR addresses both mechanisms:

First, EntityPassClipStack::RecordRestore was popping replay entities unconditionally whenever any clip was restored. In a sheet containing ink decorations (like list item ripple effects), child clip restores at deeper heights would prematurely discard the root parent clip. We now track clip_height in ReplayResult so that restorations only pop entities when clip_height > restore_height, preserving parent clips across sibling restores. When replaying those clips in ClipContents::Render, we also supply the entity's model matrix to properly recompute the MVP matrix against the new pass's orthographic projection instead of reusing the stale matrix from the prior pass.

Second, the pass depth budget was exhausting across backdrop splits. Canvas::kMaxDepth (1 << 24) was mismatched with Entity::kDepthEpsilon (1.0 / 262144.0, or 2^-18), allowing integer depths to exceed the 18-bit precision of the depth buffer. Aligning Canvas::kMaxDepth to 262,143 and capping depth allocations in Save/SaveLayer to min(current_depth_ + total_content_depth, parent_clip_depth) keeps clip replay and subsequent draw operations within valid precision bounds. In Canvas::Restore, we also prevent unconditional depth jumps to kMaxDepth for unclipped saves, preserving the allocated budget for subsequent sibling draws.

Testing

Reproducing this interaction in automated tests required testing the onscreen pass-splitting branch (IsOnscreen()), which normal offscreen unit tests bypass. We added a ScopedOnscreenOverride test hook in Canvas and constructed a multi-layer display list recreating the route clip, child ink items, blurred backdrop bar, and trailing app bar:

  • clip_stack_unittests.cc: Added EntityPassClipStackTest.RestoringChildClipPreservesParentReplayEntities to isolate parent clip retention across sibling restores.
  • canvas_unittests.cc: Added AiksTest.ClipDepthMaintainedAcrossBackdropFilterAndLayers to verify depth invariants and precision bounds (<= kMaxDepth), and AiksTest.ParentClipDepthBudgetPreservedAfterBackdropLayerRestore to verify parent depth budget restoration.
  • dl_golden_unittests.cc (impeller_golden_tests): Added DlGoldenTest.CanRenderClippedBackdropFilterWithSuperellipse for pixel-accurate golden image verification in CI against Skia Gold.

Pre-launch Checklist

@flutteractionsbot flutteractionsbot mentioned this pull request Sep 22, 2026
10 tasks done
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Sep 22, 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 refactors and simplifies clip depth and clip stack management in Impeller. It increases the maximum canvas depth, simplifies clip depth tracking during save and restore operations, and removes clip height tracking from the entity pass clip stack and clip contents rendering. Additionally, several tests and unused mock dependencies are removed. There are no review comments to evaluate, so I have no feedback to provide.

@andywolff
andywolff requested review from flar and gaaclarke September 22, 2026 22:07
@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. e: impeller Impeller rendering backend issues and features requests labels Sep 22, 2026
@andywolff andywolff added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 23, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 23, 2026
@auto-submit

auto-submit Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/193189, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@andywolff andywolff added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 23, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Sep 23, 2026
Merged via the queue into flutter:master with commit b8a2aa4 Sep 23, 2026
23 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 23, 2026
@flutteractionsbot
flutteractionsbot deleted the revert-191096-1790114608 branch September 23, 2026 04:34
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

3 participants