Skip to content

Impeller inconsistency when using ImageShader in CustomPaint #165205

Closed

Description

@Erfa

Steps to reproduce

I have a visual effect where I show an animated 3D cube in Flutter, projected to 2D and with images rendered as its sides using ImageShader in a CustomPaint. This used to work, but starting in a recent Flutter version (maybe 3.29.0?) it does not work in Impeller anymore.

Expected results

I would expect the result between Impeller and --no-enable-impeller to be consistent.

Actual results

Impeller has a new behavior different from --no-enable-impeller.

Code sample

Code sample

Here's a minimal repro of it: https://github.com/Erfa/impeller_inconsistency

Screenshots or Video

Screenshots / Video demonstration
Impeller --no-enable-impeller
impeller.mp4
no-impeller.mp4

Logs

Logs
Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...                              7.8s
√ Built build\app\outputs\flutter-apk\app-debug.apk
Installing build\app\outputs\flutter-apk\app-debug.apk...          393ms
I/flutter ( 8695): [IMPORTANT:flutter/shell/platform/android/android_context_gl_impeller.cc(94)] Using the Impeller rendering backend (OpenGLES).
I/Choreographer( 8695): Skipped 82 frames!  The application may be doing too much work on its main thread.
I/WindowExtensionsImpl( 8695): Initializing Window Extensions, vendor API level=6, activity embedding enabled=true
I/r_inconsistency( 8695): Compiler allocated 4968KB to compile void android.view.ViewRootImpl.performTraversals()
I/r_inconsistency( 8695): Compiler allocated 5155KB to compile void android.view.ViewRootImpl.performTraversals()
W/HWUI    ( 8695): Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
W/HWUI    ( 8695): Failed to initialize 101010-2 format, error = EGL_SUCCESS
I/Gralloc4( 8695): mapper 4.x is not supported
Syncing files to device sdk gphone64 x86 64...                      58ms
E/libEGL  ( 8695): called unimplemented OpenGL ES API

Flutter run key commands.
r Hot reload.
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on sdk gphone64 x86 64 is available at: http://127.0.0.1:52431/E_mc4H_0p2E=/
I/r_inconsistency( 8695): Compiler allocated 5155KB to compile void android.view.ViewRootImpl.performTraversals()
The Flutter DevTools debugger and profiler on sdk gphone64 x86 64 is available at:
http://127.0.0.1:9101?uri=http://127.0.0.1:52431/E_mc4H_0p2E=/
E/libEGL  ( 8695): called unimplemented OpenGL ES API
D/EGL_emulation( 8695): app_time_stats: avg=3.72ms min=0.55ms max=78.42ms count=57
E/libEGL  ( 8695): called unimplemented OpenGL ES API
D/EGL_emulation( 8695): app_time_stats: avg=0.78ms min=0.54ms max=2.02ms count=61
E/libEGL  ( 8695): called unimplemented OpenGL ES API
D/EGL_emulation( 8695): app_time_stats: avg=1.08ms min=0.60ms max=11.67ms count=58
E/libEGL  ( 8695): called unimplemented OpenGL ES API
D/EGL_emulation( 8695): app_time_stats: avg=0.93ms min=0.56ms max=3.09ms count=61
E/libEGL  ( 8695): called unimplemented OpenGL ES API
D/ProfileInstaller( 8695): Installing profile for com.example.impeller_inconsistency
D/EGL_emulation( 8695): app_time_stats: avg=0.91ms min=0.55ms max=2.06ms count=57
E/libEGL  ( 8695): called unimplemented OpenGL ES API
D/EGL_emulation( 8695): app_time_stats: avg=0.85ms min=0.58ms max=2.25ms count=61

Application finished.

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.29.2, on Microsoft Windows [Version 10.0.26100.3476], locale en-SE)
[√] Windows Version (11 Pro 64-bit, 24H2, 2009)
[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    X cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/to/windows-android-setup for more details.
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.9.1)
[√] Android Studio (version 2024.1)
[!] Android Studio (version 2024.2)
    X Unable to determine bundled Java version.
[√] VS Code (version 1.98.2)
[√] Connected device (4 available)
[√] Network resources

! Doctor found issues in 2 categories.

Activity

  1. added
    in triagePresently being triaged by the triage team
    on Mar 17, 2025
  2. huycozy commented on Mar 17, 2025

    @huycozy
    Member

    Thanks for filing the issue. Reproduced on Flutter master 3.31.0-1.0.pre.86 as well (on iOS platform).

    Flutter version
    [!] Flutter (Channel master, 3.31.0-1.0.pre.86, on macOS 15.3.1 24D70 darwin-x64, locale en-VN) [2.8s]
        • Flutter version 3.31.0-1.0.pre.86 on channel master at /Users/huynq/Documents/GitHub/flutter_master
        ! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
        ! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision d05bba1c41 (12 hours ago), 2025-03-16 11:19:26 -0400
        • Engine revision d05bba1c41
        • Dart version 3.8.0 (build 3.8.0-197.0.dev)
        • DevTools version 2.45.0-dev.0
        • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
    
  3. added
    c: regressionIt was better in the past than it is now
    engineflutter/engine related. See also e: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    e: impellerImpeller rendering backend issues and features requests
    and removed
    in triagePresently being triaged by the triage team
    on Mar 17, 2025
  4. added
    P2Important issues not at the top of the work list
    on Mar 17, 2025
  5. jonahwilliams commented on Mar 17, 2025

    @jonahwilliams
    Contributor

    We must be mishandling the effect transform somehow (maybe dropping it to 3d?).

  6. jonahwilliams commented on Mar 31, 2025

    @jonahwilliams
    Contributor

    I can fix this by adding the following lines after the matrix is constructed:

      g.setColumn(2, v.Vector4(0, 0, 1, 0));
      g.setRow(2, v.Vector4(0, 0, 1, 0));
    

    Despite accepting a 4x4, Skia drops it to a 3x3 for rendering. If we force Impeller to do this same it looks identical.

  7. added
    r: fixedIssue is closed as already fixed in a newer version
    on Apr 9, 2025
  8. github-actions commented on Apr 23, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  9. locked as resolved and limited conversation to collaborators on Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: regressionIt was better in the past than it is nowe: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.found in release: 3.29Found to occur in 3.29found in release: 3.31Found to occur in 3.31has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions