Repository navigation
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: renderingUI glitches reported at the engine/skia or impeller rendering levelUI glitches reported at the engine/skia or impeller rendering levele: OS-version specificAffects only some versions of the relevant operating systemAffects only some versions of the relevant operating systeme: impellerImpeller rendering backend issues and features requestsImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.found in release: 3.29Found to occur in 3.29Found to occur in 3.29found in release: 3.30Found to occur in 3.30Found to occur in 3.30has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionslimpellerEngine binary size reduction. go/slimpellerEngine binary size reduction. go/slimpellerteam-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team
Description
Steps to reproduce
- Open flutter app with flutter version 3.29 an android emulator (tried on android 11)
- Add code that fetches ui.Image bytes in any encoding.
image.toByteData - Only reproduceable on emulators.
(Does it possibly have anything to do with the decision to disable Vulkan on emulators starting v3.29?)
Expected results
1- Correct image data
2- Console free of opengl errors
Actual results
1- Image data is incorrect.
2- Console shoes opengl errors.
Code sample
Code sample
ByteData? byteData = await image.toByteData(format: ui.ImageByteFormat.png);Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
E/emuglGLESv2_enc( 6025): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glBindFramebuffer:2710 GL error 0x500
E/emuglGLESv2_enc( 6025): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glFramebufferTexture2D:2723 GL error 0x500
E/emuglGLESv2_enc( 6025): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glBindFramebuffer:2710 GL error 0x500Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.29.0, on Microsoft Windows [Version 10.0.22631.4890], locale en-US)
[√] Windows Version (11 Enterprise 64-bit, 23H2, 2009)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Enterprise 2022 17.12.5)
[√] Android Studio (version 2024.2)
[√] VS Code (version 1.97.1)
[√] Connected device (4 available)
[√] Network resources
• No issues found!Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: renderingUI glitches reported at the engine/skia or impeller rendering levelUI glitches reported at the engine/skia or impeller rendering levele: OS-version specificAffects only some versions of the relevant operating systemAffects only some versions of the relevant operating systeme: impellerImpeller rendering backend issues and features requestsImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.found in release: 3.29Found to occur in 3.29Found to occur in 3.29found in release: 3.30Found to occur in 3.30Found to occur in 3.30has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionslimpellerEngine binary size reduction. go/slimpellerEngine binary size reduction. go/slimpellerteam-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team
Type
Projects
- StatusShow more project fieldsDone
Activity
[-]Upon upgrading version 3.29, image.toByteData doesn't return correct image bytes.[/-][+][Android] Upon upgrading version 3.29, image.toByteData doesn't return correct image bytes in Emulators.[/+]jonahwilliams commentedon Mar 2, 2025
When you say incorrect, do you mean upside down?
maryamshal commentedon Mar 2, 2025
no I mean it is blank. Image stored or transferred has size but it shows up blank.
darshankawar commentedon Mar 3, 2025
@maryamshal
I tried with below code sample and ran with Pixel 7 emulator api 35 on latest stable and master. The emulator showed the image properly.
runnable code
If above doesn't represent your case, please provide us complete code sample and also emulator details.
maryamshal commentedon Mar 3, 2025
The same code on the emulator i'm running on doesn't work, the screen shows up blank. Note that it used to previously work on previous Flutter versions.
Emulator specs
[google/sdk_gphone_x86_64/generic_x86_64_arm64:11/RSR1.210722.013.A2/10067904:userdebug/dev-keys]
[ro.opengles.version]: [131072]
[ro.organization_owned]: [false]
[ro.postinstall.fstab.prefix]: [/system]
[ro.product.board]: [goldfish_x86_64]
[ro.product.brand]: [google]
[ro.product.build.date]: [Thu May 4 15:22:09 UTC 2023]
[ro.product.build.date.utc]: [1683213729]
But when tried on Pixel 6 pro API 34 it worked. Is this a regression related to a specific android version?
darshankawar commentedon Mar 4, 2025
I tried on api 30 emulator in which the above code doesn't show the image. I get below in the log:
If I disable impeller, then the image is rendered properly:
Will keep the issue open for team's tracking / attention.
22 remaining items
jason-simmons commentedon Aug 27, 2025
The issue that I described in #164459 (comment) happened on a cloud VM running Linux.
It's a different issue from the one seen on Windows.
On an API 30 emulator in my Linux setup, the app is able to render the image on screen when running in a standard engine build with assertions disabled. But in a local
android_debug_unopt_x64engine build, the app gets an assertion failure becauseglBindBufferRangeproduces an error code.gaaclarke commentedon Aug 28, 2025
0x500 is
GL_INVALID_ENUM. In opengl es 2 the only valid enum for glBindFramebuffer isGL_FRAMEBUFFER. In opengles 3 it'sGL_DRAW_FRAMEBUFFER,GL_READ_FRAMEBUFFER, orGL_FRAMEBUFFER. So it seems like we are using the READ or DRAW variants when we shouldn't be.BlitCopyTextureToBufferCommandGLES::Encodeis definitely using theGL_READ_FRAMEBUFFERattachment in order to useglReadPixelsin the reproduction code when executing on a opengles3 device.If we support opengles 2.0 there should be a switch in the logic for
BlitCopyTextureToBufferCommandGLESto useGL_FRAMEBUFFERorGL_READ_FRAMEBUFFERdepending on the context version. Although, I think we can probably safely just bind toGL_FRAMEBUFFERfor both opengles 2 and opengles 3. Maybe that's slightly less efficient on opengles 3 contexts.In order to verify that I'll have to get a build environment for the engine setup on windows which will take some time.
gaaclarke commentedon Aug 28, 2025
I attempted to reproduce the problem on mac by forcing
android_context_gl_impeller.ccto create a opengles 2 context, but that isn't sufficient. The above might fix the problem, writing a test may be difficult though. Maybe with ANGLE we can force it into a mode were we can reproduce the problem somehow.gaaclarke commentedon Aug 28, 2025
I tried the following patch which removes the gl errors in the description:
There is a crash however in the ndk translation afterwards. Presumably this is the layer that translates arm64 to x64. I built the test apk for arm64 on a mac and shipped it to a x64 windows computer for testing. I'm not sure if that duplicates how things work when doing
flutter rundirectly on the windows machine. Locally it might make x64 android targets.the crash
gaaclarke commentedon Aug 28, 2025
When I built with the x64 target the patch in #164459 (comment) fixes this problem. Now the tricky part of trying to come up with a test.
Bind `GL_FRAMEBUFFER` with `glReadPixels` for gles2 compatibility (#1…
github-actions commentedon Sep 17, 2025
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 -vand a minimal reproduction of the issue.Bind `GL_FRAMEBUFFER` with `glReadPixels` for gles2 compatibility (fl…
Bind `GL_FRAMEBUFFER` with `glReadPixels` for gles2 compatibility (fl…
Bind `GL_FRAMEBUFFER` with `glReadPixels` for gles2 compatibility (fl…
Bind `GL_FRAMEBUFFER` with `glReadPixels` for gles2 compatibility (#1…