Skip to content

[Impeller] Playground expanded role#188889

Merged
auto-submit[bot] merged 25 commits into
flutter:masterfrom
flar:playground-expanded-role
Jul 14, 2026
Merged

[Impeller] Playground expanded role#188889
auto-submit[bot] merged 25 commits into
flutter:masterfrom
flar:playground-expanded-role

Conversation

@flar

@flar flar commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Currently the set of Playground tests in the Impeller directory is the main way in which we test changes to the renderer. Unfortunately, these tests don't test much code unless they are either run in the impeller_golden_tests executable, or if they are run with --enable_playground. Without those conditions the test harness simply allows the caller to construct a DisplayList and then immediately returns true without seeing if it successfully renders anything. This PR expands the role of these Playground tests in 2 ways:

  • The tests can now generate golden images directly from impeller_unittests without needing a separate executable (impeller_golden_tests). If you specify the flag --golden_output_dir=<directory> then golden images for any test marked as a golden test will be written there along with a digest of the files written.
  • The tests will always render their target at least once for each Playground test, whether or not goldens are being generated or the playground is enabled, expanding the amount of code that is tested on each run.

Note that some tests were found to fail when you actually tried to render something. Some of them with trivial fixes are fixed in this PR while others which require more investigation have been deferred to follow-on issues, such as:

The Interop RuntimeEffect test: #188882
The StencilMask tests (with playground window): #188884
The MassiveScalingTexture test: #189286
The SepiaTone subpass tests: #189287

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on [Discord].

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@github-actions github-actions Bot added a: text input Entering text in a text field or keyboard related problems engine flutter/engine related. See also e: labels. e: impeller Impeller rendering backend issues and features requests labels Jul 1, 2026
@flar flar added the CICD Run CI/CD label Jul 1, 2026
@flar
flar marked this pull request as ready for review July 10, 2026 08:16

@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 restructures Impeller's testing and playground infrastructure by extracting screenshotting and golden digest management into a dedicated testing component, updating various tests to use the new Screenshotter and GoldenDigestManager, and wrapping ImGui controls with playground checks. Feedback on these changes highlights several critical issues, including potential null pointer dereferences when retrieving the graphics context, an out-of-bounds memory read in CalculateSpaceBetweenUI due to missing boundary checks on the vertical coordinate, undefined behavior from a missing fallback return in Screenshotter::MakeScreenshot, potential malformed JSON generation from unescaped characters in GoldenDigestManager::AddDimension, and encapsulation violations in Playground::GetTypographerContext.

Comment thread engine/src/flutter/impeller/testing/screenshotter.cc
Comment thread engine/src/flutter/impeller/display_list/dl_golden_unittests.cc
Comment thread engine/src/flutter/impeller/playground/playground.cc
Comment thread engine/src/flutter/impeller/playground/playground.cc
Comment thread engine/src/flutter/impeller/testing/screenshotter.cc
Comment on lines +47 to +52
void GoldenDigestManager::AddDimension(const std::string& name,
const std::string& value) {
std::stringstream ss;
ss << "\"" << value << "\"";
dimensions_[name] = ss.str();
}

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.

medium

If the value parameter contains double quotes (") or backslashes (\\), writing it directly to the JSON stream will result in malformed JSON. Since value can be a GPU model description (which often contains brand names or version strings with special characters), it should be properly escaped.\n\nConsider escaping double quotes and backslashes in the dimension value.

void GoldenDigestManager::AddDimension(const std::string& name,\n                                       const std::string& value) {\n  std::string escaped_value;\n  for (char c : value) {\n    if (c == '\"') {\n      escaped_value += \"\\\\\\\";\n    } else if (c == '\\\\') {\n      escaped_value += \"\\\\\\\\\\\\";\n    } else {\n      escaped_value += c;\n    }\n  }\n  std::stringstream ss;\n  ss << \"\\\"\" << escaped_value << \"\\\"\";\n  dimensions_[name] = ss.str();\n}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We should really be constructing the output with a JSON utility that would automatically protect the data for us. I opted not to pursue cobbling this together for now.

Comment thread engine/src/flutter/impeller/playground/playground.cc Outdated
Comment thread engine/src/flutter/impeller/playground/playground.h Outdated
@flar

flar commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

To be clear on the golden image generation, this feature is not yet used to create the golden images for our pre-submit testing. I will work on switching the mechanism over in a future PR as that will also have (different) wide-ranging changes and I want to work on making sure we generate compatible output. For now, I'm leaving the existing impeller_golden_tests executable in charge of doing pre-submit image production even while adding the same functionality (really just a single method) into impeller_unittests.

jason-simmons
jason-simmons previously approved these changes Jul 13, 2026

@jason-simmons jason-simmons 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.

LGTM - just a few nits

const std::string_view& font_fixture,
DlPoint position,
const TextRenderOptions& options) {
std::optional<DlRect> RenderTextInCanvasSkia(

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.

Consider returning absl::StatusOr here (and in CalculateSpaceBetweenUI)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This complicated the code a fair bit since the return value was only used in one spot and all of the others expected to either ignore the return (you can't with StatusOr) or just do an EXPECT/ASSERT_TRUE which also doesn't work on StatusOr (you need to add .ok())

But, check out the last couple of commits and see...

Comment thread engine/src/flutter/impeller/playground/playground.h Outdated
@flar flar added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 14, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Jul 14, 2026
Merged via the queue into flutter:master with commit 547e77e Jul 14, 2026
204 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 14, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Jul 14, 2026
flutter/flutter@cf9e8af...846664b

2026-07-14 [email protected] Roll Skia from dfcff99566c3 to 88954ef8f36d (1 revision) (flutter/flutter#189440)
2026-07-14 [email protected] refactor: remove material import from scrollable_semantics_test and selectable_region_context_menu_test (flutter/flutter#186611)
2026-07-14 [email protected] Roll Skia from 3d1fc554f1a2 to dfcff99566c3 (17 revisions) (flutter/flutter#189428)
2026-07-14 [email protected] Roll Dart SDK from 2c587df8f05a to 05bf153370c4 (5 revisions) (flutter/flutter#189426)
2026-07-14 [email protected] [flutter_tools] Remove web hot reload flag (flutter/flutter#185994)
2026-07-14 [email protected] [iOS] Fix flaky keyboard animation test (flutter/flutter#189353)
2026-07-14 [email protected] [Impeller] Playground expanded role (flutter/flutter#188889)
2026-07-14 [email protected] Roll pub packages (flutter/flutter#189409)
2026-07-13 [email protected] Update lock-threads dependency to 6.0.2 (flutter/flutter#189053)
2026-07-13 49699333+dependabot[bot]@users.noreply.github.com Bump actions/labeler from 6.1.0 to 6.2.0 in the all-github-actions group (flutter/flutter#189396)
2026-07-13 [email protected] Remove  outdated todo about `analysis bug on Windows` and update condition to also perform `analysis on windows` (flutter/flutter#189283)
2026-07-13 [email protected] Add more 0x0 size tests part 4 (flutter/flutter#185187)
2026-07-13 [email protected] Roll Packages from 20928d5 to ad2eab1 (18 revisions) (flutter/flutter#189387)
2026-07-13 [email protected] [flutter_tools] Fix ADB device listing output parsing regression (flutter/flutter#189369)
2026-07-13 [email protected] Stop running most Mac x64 builders that have Mac ARM equivalents on master (flutter/flutter#189301)
2026-07-13 [email protected] Move a few benchmarks from x64 Intel Macs to ARM (flutter/flutter#189377)
2026-07-13 [email protected] Add note that `hcpp` needs impeller (flutter/flutter#189382)
2026-07-13 [email protected] Roll Fuchsia Linux SDK from vhIlDkWIy21IrlB9E... to oOETA0ISPouDt2xBo... (flutter/flutter#189349)
2026-07-13 [email protected] [flutter_tools] Respect mustMatchAppBuild on Windows native assets (flutter/flutter#186788)
2026-07-13 [email protected] Roll Skia from 8bf65996caba to 3d1fc554f1a2 (2 revisions) (flutter/flutter#189350)
2026-07-13 [email protected] Roll Dart SDK from 0fc1668c4af4 to 2c587df8f05a (9 revisions) (flutter/flutter#189351)
2026-07-13 [email protected] [web] Fall back to full CJK fonts for characters not covered by split slices (flutter/flutter#188890)
2026-07-13 [email protected] Take Mac tool_integration_tests_* out of bringup (flutter/flutter#189368)
2026-07-13 [email protected] [hooks] Roll record_use to 1.0 and unpin (flutter/flutter#189366)

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 [email protected],[email protected] 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
jason-simmons added a commit to jason-simmons/flutter that referenced this pull request Jul 22, 2026
…ts on Mac Minis used by CI

flutter#188889 started using the
Impeller rendering backends in playground tests run by the
impeller_unittests harness.

Since then, runs of OpenGLESSDF tests on macOS CI have been flaky.
These flakes show up as gtest-parallel child processes that fail with
exit code -5 (SIGTRAP).

The affected CI machines are M1 Mac Minis (hardware model "Macmini9,1")
This is an experiment to see if limiting the number of test cases run in
parallel on these machines reduces the crashes.

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

Labels

a: text input Entering text in a text field or keyboard related problems CICD Run CI/CD 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.

2 participants