Skip to content

Conversation

@flar
Copy link
Contributor

@flar flar commented Jan 24, 2026

Fixes: #173104

We were precomputing the perspective adjustment inside the clipping vertex shader, which prevented the GPU from performing correct clipping against the camera plane.

@flar flar requested a review from gaaclarke January 24, 2026 01:14
@github-actions github-actions bot added engine flutter/engine related. See also e: labels. e: impeller Impeller rendering backend issues and features requests labels Jan 24, 2026
@flar flar requested a review from b-luk January 24, 2026 01:14
Copy link
Contributor

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

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 fixes incorrect clipping for geometries under a perspective transform with a large bias. The main change is in the clip.vert shader, which now correctly lets the GPU handle perspective division and clipping by not dividing gl_Position by w in the vertex shader. Instead, it sets gl_Position.z relative to w. Complementing this, FillRectGeometry::GetCoverage is updated to use TransformAndClipBounds for accurate coverage calculation with perspective transforms. A new playground test is also added for visual verification. The changes are correct and address the issue effectively.

Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

LGTM. The math should be equivalent. Previously the weight was set to 1 by applying the division, then undoing that for the z component to maintain the clip depth. This works similarly but keeps the weight value intact by just multiplying it by the weight instead. My intuition here is that we are getting different results by delaying the weight division instead of doing it here.

@flar flar added autosubmit Merge PR when tree becomes green via auto submit App and removed autosubmit Merge PR when tree becomes green via auto submit App labels Jan 24, 2026
@auto-submit auto-submit bot added this pull request to the merge queue Jan 24, 2026
Merged via the queue into flutter:master with commit 7e5f105 Jan 24, 2026
183 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jan 24, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 24, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 24, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 25, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 25, 2026
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jan 25, 2026
flutter/flutter@bfc9041...def9ca9

2026-01-25 engine-flutter-autoroll@skia.org Roll Skia from f1433eb44a50 to 2830fbe8bafe (1 revision) (flutter/flutter#181464)
2026-01-25 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 6xoKGIry6Y8T8x5Sa... to T4qTEa3T5CCSCIoJY... (flutter/flutter#181458)
2026-01-24 engine-flutter-autoroll@skia.org Roll Skia from b6d396a151bc to f1433eb44a50 (1 revision) (flutter/flutter#181449)
2026-01-24 engine-flutter-autoroll@skia.org Roll Dart SDK from 29918a54dd5c to 60553fc4c04f (1 revision) (flutter/flutter#181437)
2026-01-24 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from n7NohL9DPpEuPjNt9... to 6xoKGIry6Y8T8x5Sa... (flutter/flutter#181438)
2026-01-24 flar@google.com [Impeller] Fix perspective clips with a large perspective bias (flutter/flutter#181434)
2026-01-24 engine-flutter-autoroll@skia.org Roll Dart SDK from e82d7ad1855e to 29918a54dd5c (4 revisions) (flutter/flutter#181435)
2026-01-24 engine-flutter-autoroll@skia.org Roll Skia from 32b52343e757 to b6d396a151bc (4 revisions) (flutter/flutter#181431)
2026-01-24 flar@google.com [Impeller] Fix interpolation error in Rect::TransformAndClipBounds (flutter/flutter#181420)
2026-01-23 engine-flutter-autoroll@skia.org Roll Skia from 6d438894c2a8 to 32b52343e757 (2 revisions) (flutter/flutter#181419)
2026-01-23 120639059+Enderjua@users.noreply.github.com [Material] modernize Typography._withPlatform with Dart 3 switch expression (flutter/flutter#181398)
2026-01-23 58190796+MitchellGoodwin@users.noreply.github.com CupertinoSheetRoute with scrolling and dragging (flutter/flutter#177337)
2026-01-23 30870216+gaaclarke@users.noreply.github.com Adds contents of keys file when a skia gold error occurs. (flutter/flutter#181401)
2026-01-23 engine-flutter-autoroll@skia.org Roll Skia from e4bd0a355e68 to 6d438894c2a8 (3 revisions) (flutter/flutter#181405)
2026-01-23 116356835+AbdeMohlbi@users.noreply.github.com bump KGP and AGP max known versions (flutter/flutter#181325)
2026-01-23 engine-flutter-autoroll@skia.org Roll Skia from db10db8bd55f to e4bd0a355e68 (3 revisions) (flutter/flutter#181391)
2026-01-23 engine-flutter-autoroll@skia.org Roll Packages from 9010299 to 5af5f50 (4 revisions) (flutter/flutter#181388)
2026-01-23 w.albert221@gmail.com Look for project root for FeatureFlags manifest (flutter/flutter#180689)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC louisehsu@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

ListView under a Transform breaks for some perspective values

2 participants