Skip to content

[Flutter GPU] Improve context initialization error messages#183986

Merged
bdero merged 7 commits into
flutter:masterfrom
bdero:bdero/flutter-gpu-init-errors
Mar 27, 2026
Merged

[Flutter GPU] Improve context initialization error messages#183986
bdero merged 7 commits into
flutter:masterfrom
bdero:bdero/flutter-gpu-init-errors

Conversation

@bdero

@bdero bdero commented Mar 21, 2026

Copy link
Copy Markdown
Member

When Flutter GPU initialization fails because Impeller is not enabled, display a specific error message about enabling Impeller rather than the generic "Flutter GPU must be enabled" message.

Resolves #173648

@github-actions github-actions Bot added the engine flutter/engine related. See also e: labels. label Mar 21, 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 improves the error messages for Flutter GPU context initialization. A new check is added to provide a specific error when the Impeller rendering backend is not enabled, which is a prerequisite for Flutter GPU. The existing error message for when Flutter GPU itself is not enabled has also been clarified to include macOS and specific file names (Info.plist, AndroidManifest.xml). To support these changes, the test suite in gpu_test.dart has been refactored into more granular tests that cover each initialization error case separately, and a new helper flutterGpuEnabled has been added for test flag detection. The changes make debugging initialization issues easier and improve test coverage.

@bdero bdero force-pushed the bdero/flutter-gpu-init-errors branch from 706ecf9 to 51a1875 Compare March 21, 2026 20:10
@bdero bdero requested a review from jtmcdole March 22, 2026 01:06
@bdero

bdero commented Mar 22, 2026

Copy link
Copy Markdown
Member Author

Hmm not sure why the engine tests aren't running.

@gaaclarke gaaclarke added the CICD Run CI/CD label Mar 23, 2026
gaaclarke
gaaclarke previously approved these changes Mar 23, 2026

@gaaclarke gaaclarke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me.

@bdero bdero enabled auto-merge March 23, 2026 18:44
@github-actions github-actions Bot removed the CICD Run CI/CD label Mar 24, 2026
@gaaclarke gaaclarke added the CICD Run CI/CD label Mar 24, 2026
gaaclarke
gaaclarke previously approved these changes Mar 24, 2026
@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 24, 2026
@jtmcdole

Copy link
Copy Markdown
Member

Hmm not sure why the engine tests aren't running.

Just FYI - The CICD label is required from a member with write access in order to run tests.

@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Mar 24, 2026
@auto-submit

auto-submit Bot commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions github-actions Bot removed the CICD Run CI/CD label Mar 24, 2026
@bdero bdero added the CICD Run CI/CD label Mar 24, 2026
bdero added 6 commits March 26, 2026 03:38
…nabled errors

When Flutter GPU initialization fails because Impeller is not enabled,
display a specific error message about enabling Impeller rather than
the generic "Flutter GPU must be enabled" message.
…isabled

Run gpu_test.dart with Impeller enabled but --enable-flutter-gpu omitted
so the "Flutter GPU must be enabled" error message is also tested on CI.
The skip: parameter of test() is evaluated eagerly at registration time.
When running with Impeller enabled but Flutter GPU disabled, accessing
gpu.gpuContext in skip expressions throws an unhandled exception that
crashes the entire test runner. Add flutterGpuEnabled guards so the
expression short-circuits before accessing the context.
All tests that use gpu.gpuContext require both Impeller and Flutter GPU
to be enabled. Update skip conditions from `!impellerEnabled` to
`!impellerEnabled || !flutterGpuEnabled` so tests are properly skipped
when running with Impeller enabled but Flutter GPU disabled.

Also fix the first error message test to not fail when Impeller is
enabled but Flutter GPU is disabled.
@bdero bdero force-pushed the bdero/flutter-gpu-init-errors branch from a697290 to 8d3b79c Compare March 26, 2026 10:39
@github-actions github-actions Bot removed the CICD Run CI/CD label Mar 26, 2026
@bdero bdero added the CICD Run CI/CD label Mar 26, 2026
@bdero bdero requested a review from gaaclarke March 26, 2026 20:46

@gaaclarke gaaclarke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

slight change requested, otherwise looks good

final int alignment = gpu.gpuContext.minimumUniformByteAlignment;
expect(alignment, greaterThanOrEqualTo(16));
}, skip: !impellerEnabled);
}, skip: !impellerEnabled || !flutterGpuEnabled);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you switch these to !(impellerEnabled && flutterGpuEnabled) using de morgan's law? That's a lot more clear to me.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done!

ahmedsameha1 pushed a commit to ahmedsameha1/flutter that referenced this pull request Apr 14, 2026
…183986)

When Flutter GPU initialization fails because Impeller is not enabled,
display a specific error message about enabling Impeller rather than the
generic "Flutter GPU must be enabled" message.

Resolves flutter#173648
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD engine flutter/engine related. See also e: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enabling Flutter GPU on macOS with FLTEnableFlutterGPU key in Info.plist doesn't work

3 participants