-
Notifications
You must be signed in to change notification settings - Fork 30.2k
[Android][Impeller OpenGL ES] Gradients rendered incorrectly after Vulkan → OpenGL ES fallback #179268
Description
Steps to reproduce
- Add the code provided in the
Code samplesection to any widget. - Run the app in the Android device.
I was able to reproduce the bug in the device Positivo Q20 with Android 10 and PowerVR IMG8322 GPU.
The bug seems to happen when the fallback from Vulkan to OpenGLES occurs.
It happened running with impeller enabled in Flutter 3.38.3 channel stable and in 3.39.0-1.0.pre-340 channel master.
It did not happen running with Impeller disabled in Flutter 3.38.3 and did not happen in Flutter 3.27.4 independently of Impeller.
This issue might be related to #177873
Expected results
The radial gradient should render correctly.
Actual results
The gradient is rendered incorrectly.
Code sample
Code sample
Just add this in any Widget. In my test, i added as children of the Column in the sample genereted by flutter create:
ShaderMask(
shaderCallback: (bounds) => RadialGradient(
stops: const [0, 0.5, 1],
colors: [Colors.grey[800]!, Colors.grey[800]!.withAlpha(204), Colors.grey[800]!.withAlpha(0)],
).createShader(bounds),
blendMode: BlendMode.srcOver,
child: Container(height: 200, width: 200, color: Colors.red),
),
CircularProgressIndicator(),Screenshots or Video
Screenshots / Video demonstration
Expected result.
With Flutter 3.38.3 and Impeller disabled, or with Flutter 3.27.4 (Impeller enabled or disabled has the same result).
impellerDisabled_3_38_3.mov
Actual result with Flutter 3.38.3 and Impeller enabled:
impellerEnabled_3_38_3.mov
Logs
Logs
I believe the relevant detail is that rendering breaks only when Vulkan → OpenGL ES fallback occurs.
If Vulkan is used alone or OpenGL ES is used alone, the issue does not happen.
- Flutter 3.38.3 with Impeller enabled (bad rendering):
Launching lib/main.dart on Positivo Q20 in debug mode...
✓ Built build/app/outputs/flutter-apk/app-debug.apk
D/FlutterJNI(10516): Beginning load of flutter...
D/FlutterJNI(10516): flutter (null) was loaded normally!
I/flutter (10516): [IMPORTANT:flutter/shell/platform/android/android_context_vk_impeller.cc(62)] Using the Impeller rendering backend (Vulkan).
I/flutter (10516): [IMPORTANT:flutter/shell/platform/android/android_context_gl_impeller.cc(104)] Using the Impeller rendering backend (OpenGLES).
Connecting to VM Service at ws://127.0.0.1:59868/bbztvVO6O9A=/ws
Connected to the VM Service.
D/ (10516): Gralloc Free w:720, h:1464, f:0x1, usage:0xb00, ui64Stamp:157887 line = 2376
D/ (10516): Gralloc Register w:720, h:1464, f:0x1, usage:0xb00, ui64Stamp:157894, sSize:4239360, line = 2270
D/SurfaceCallbackHelper(10516): dispatchSurfaceRedrawNeededAsync, callbacks=[Landroid.view.SurfaceHolder$Callback;@12fd0fa, callbacks.length=1
I/Choreographer(10516): Skipped 237 frames! The application may be doing too much work on its main thread.
I/Choreographer(10516): Skipped 278 frames! The application may be doing too much work on its main thread.
D/SurfaceCallbackHelper(10516): mFinishDrawingRunnable, mFinishDrawingCollected=1, mFinishDrawingExpected=1
D/ProfileInstaller(10516): Installing profile for com.example.impeller
D/ (10516): Gralloc Register w:720, h:1464, f:0x1, usage:0xb00, ui64Stamp:157939, sSize:4239360, line = 2270
D/ (10516): Gralloc Register w:720, h:1560, f:0x1, usage:0xb00, ui64Stamp:157944, sSize:4517888, line = 2270
D/ (10516): Gralloc Register w:720, h:1464, f:0x1, usage:0xb00, ui64Stamp:157954, sSize:4239360, line = 2270- Flutter 3.38.3 with Impeller disabled (rendering OK):
Launching lib/main.dart on Positivo Q20 in debug mode...
✓ Built build/app/outputs/flutter-apk/app-debug.apk
D/FlutterJNI( 9983): Beginning load of flutter...
D/FlutterJNI( 9983): flutter (null) was loaded normally!
I/flutter ( 9983): [IMPORTANT:flutter/shell/common/shell.cc(527)] [Action Required]: Impeller opt-out deprecated.
I/flutter ( 9983): The application opted out of Impeller by either using the
I/flutter ( 9983): `--no-enable-impeller` flag or the
I/flutter ( 9983): `io.flutter.embedding.android.EnableImpeller` `AndroidManifest.xml` entry.
I/flutter ( 9983): These options are going to go away in an upcoming Flutter release. Remove
I/flutter ( 9983): the explicit opt-out. If you need to opt-out, please report a bug describing
I/flutter ( 9983): the issue.
I/flutter ( 9983):
I/flutter ( 9983): https://github.com/flutter/flutter/issues/new?template=02_bug.yml
I/flutter ( 9983):
Connecting to VM Service at ws://127.0.0.1:59279/hfDmsPCdWsY=/ws
Connected to the VM Service.
I/Choreographer( 9983): Skipped 268 frames! The application may be doing too much work on its main thread.
D/ProfileInstaller( 9983): Installing profile for com.example.impeller
D/SurfaceCallbackHelper( 9983): mFinishDrawingRunnable, mFinishDrawingCollected=1, mFinishDrawingExpected=1
D/ ( 9983): Gralloc Register w:720, h:1464, f:0x1, usage:0xb00, ui64Stamp:150514, sSize:4239360, line = 2270
D/ ( 9983): Gralloc Register w:720, h:1560, f:0x1, usage:0xb00, ui64Stamp:150518, sSize:4517888, line = 2270
D/ ( 9983): Gralloc Register w:720, h:1464, f:0x1, usage:0xb00, ui64Stamp:150527, sSize:4239360, line = 2270
- Flutter 3.27.4 with Impeller enabled (rendering OK):
Launching lib/main.dart on Positivo Q20 in debug mode...
Warning: SDK processing. This version only understands SDK XML versions up to 3 but an SDK XML file of version 4 was encountered. This can happen if you use versions of Android Studio and the command-line tools that were released at different times.
✓ Built build/app/outputs/flutter-apk/app-debug.apk
I/flutter (11445): [IMPORTANT:flutter/shell/platform/android/android_context_vk_impeller.cc(60)] Using the Impeller rendering backend (Vulkan).
Connecting to VM Service at ws://127.0.0.1:62100/Aqojj1yiIwI=/ws
Connected to the VM Service.
D/ProfileInstaller(11445): Installing profile for com.example.impeller
I/xample.impelle(11445): Compiler allocated 4181KB to compile void android.view.ViewRootImpl.performTraversals()
D/ (11445): Gralloc Register w:720, h:1560, f:0x1, usage:0xb00, ui64Stamp:158387, sSize:4517888, line = 2270
Flutter Doctor output
Doctor output
flutter doctor -v
[✓] Flutter (Channel master, 3.39.0-1.0.pre-340, on macOS 15.3.1 24D70 darwin-arm64, locale en-BR) [1,536ms]
• Flutter version 3.39.0-1.0.pre-340 on channel master at /Users/guilhermess/.asdf/installs/flutter/3.27.4-stable
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 05d6005dd8 (5 hours ago), 2025-12-01 04:15:13 -0500
• Engine revision 05d6005dd8
• Dart version 3.11.0 (build 3.11.0-189.0.dev)
• DevTools version 2.52.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets,
omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [1,223ms]
• Android SDK at /Users/guilhermess/Library/Android/sdk
• Emulator version 34.2.16.0 (build_id 12038310) (CL:N/A)
• Platform android-36, build-tools 35.0.0
• ANDROID_HOME = /Users/guilhermess/Library/Android/sdk
• ANDROID_SDK_ROOT = ~/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 16.0) [1,283ms]
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16A242d
• CocoaPods version 1.16.2
[✓] Chrome - develop for the web [5ms]
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Connected device (5 available) [6.9s]
• Positivo Q20 (mobile) • 5A1869T99 • android-arm64 • Android 10 (API 29)
• sdk gphone64 arm64 (mobile) • emulator-5556 • android-arm64 • Android 15 (API 35) (emulator)
• bicicleta (wireless) (mobile) • 00008110-000878312E0B801E • ios • iOS 18.3.1 22D72
• macOS (desktop) • macos • darwin-arm64 • macOS 15.3.1 24D70 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 142.0.7444.176
[✓] Network resources [696ms]
• All expected network resources are available.
• No issues found!