Skip to content

Run the shared Vulkan embedder tests under Impeller as well as Skia - #193004

Merged
auto-submit[bot] merged 1 commit into
flutter:masterfrom
jwinarske:pr6/impeller-test-variants
Nov 24, 2026
Merged

auto-submit[bot] merged 1 commit into
flutter:masterfrom
jwinarske:pr6/impeller-test-variants

Conversation

@jwinarske

@jwinarske jwinarske commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Impeller is the default renderer and none of these tests exercised it on Vulkan.

Add it as a backend the multi-backend fixture can select: kVulkanImpellerContext yields the same Vulkan context with Impeller enabled, and the config builder adds --enable-impeller for it — so a test written once runs under both renderers without naming the flag.

Goldens

Impeller's output matches the Skia goldens to within 2-3 levels per channel, and the comparison is exact, so the Impeller variants carry their own (vk_impeller_*). The root-surface and backing-store paths produce byte-identical pixels, so one golden serves both.

Two things the variants exposed

CanSwapOutVulkanCalls only waits for the root isolate. Skia submits while building its context, so the queue submit it checks for has already happened; Impeller submits nothing until it renders, so its variant renders a frame first. Both clear the capture on exit, which is global.

CanRenderGradientWithCompositorOnNonRootLayer expects the root layer's paint region to be the whole frame. That holds for Skia because it records the frame-start clear into the slice; Impeller does not, so its region is the one picture actually drawn there:

Skia:     rects=1 [0,0,800,600]
Impeller: rects=1 [10,10,800,600]

Encoded per backend here, but that is a workaround: the layer is cleared either way, so an embedder trusting paint_region for damage tracking keeps stale pixels under Impeller. Filed as #192973 — I would rather that be fixed and this expectation deleted.

Tests

The suite is the change. Full embedder_unittests: 205 pass, 5 skipped (AOT-only).

Last of six, from #187525. #193003 has landed, so this is one commit on master now.

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Sep 18, 2026
@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. e: impeller Impeller rendering backend issues and features requests labels Sep 18, 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 implements Vulkan backing store support under Impeller for the Flutter embedder by introducing a WrapTextureSourceVK utility and an ImpellerVulkanTransientsCache to reuse MSAA and depth-stencil buffers across frames. It also integrates these changes into the embedder API and adds corresponding unit tests. Feedback on these changes suggests adding defensive null checks: first, in ImpellerVulkanTransientsCache::Get to prevent matching expired weak pointers when the context is null, and second, in MakeRenderTargetFromBackingStoreImpeller to avoid a potential null pointer dereference on aiks_context.

@jwinarske
jwinarske force-pushed the pr6/impeller-test-variants branch from f24868e to 66e3554 Compare September 18, 2026 16:18
@jwinarske

Copy link
Copy Markdown
Contributor Author

Rebased onto the fix in #193003 — ImpellerVulkanTransientsCache was used outside the guard that defines it, so builds without Vulkan failed to compile embedder.cc.

@jwinarske
jwinarske force-pushed the pr6/impeller-test-variants branch 2 times, most recently from d8cf696 to 8f804fb Compare September 18, 2026 20:09
@jwinarske

Copy link
Copy Markdown
Contributor Author

Force-pushed: restacked, same cause as #193003 — #193000 was missing from the bottom of the stack, so a .cc here used a member its header did not declare.

This is the last of the series. Landing order: #192999, #193000, #193001, #193002, #193003, then this.

@jwinarske
jwinarske force-pushed the pr6/impeller-test-variants branch 2 times, most recently from 98e9a0e to 4a24a84 Compare September 18, 2026 20:32
@gaaclarke
gaaclarke requested a review from andywolff September 21, 2026 18:11
@flutter-dashboard

Copy link
Copy Markdown

This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@andywolff andywolff 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.

Needs a rebase and I have a few small comments, but mostly LGTM

If CI's differs by a level they will flake — say the word and I will give the comparison a tolerance instead of pinning numbers that may not be reproducible off my machine.

Looks like adding tolerance isn't necessary

}

TEST_F(EmbedderTest, CanSwapOutVulkanCalls) {
// The capture is global; start clean so a test that ran earlier cannot make

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.

Please use fml::ScopedCleanupClosure (from flutter/fml/closure.h) instead of resetting g_vulkan_proc_info at the start of individual tests.

Make sure it is declared before engine so UniqueEngine shuts down before g_vulkan_proc_info is cleared:

  fml::ScopedCleanupClosure reset_proc_info([] { g_vulkan_proc_info = {}; });

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.

Done, declared before engine in both tests.

backing_store.did_update = true;
ConfigureBackingStore(backing_store, backend, true);

// Skia clears the whole frame into the root slice before painting,

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.

Please add a TODO pointing to #192973

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.

Added.

EXPECT_TRUE(g_vulkan_proc_info.did_call_queue_submit);
}

/// The same interception under Impeller. Skia submits while it sets up its

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.

nit: If tests are reordered or Skia is eventually removed, referencing Skia and "the test above" will become stale. Please reword this docstring to state the standalone Impeller contract while keeping the note about why rendering a frame is required. Maybe:

/// Verifies Vulkan proc interception under Impeller. Because Impeller does not
/// submit command buffers during context setup, this test renders a frame to
/// trigger `vkQueueSubmit`.

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.

Taken as written.

@jwinarske
jwinarske force-pushed the pr6/impeller-test-variants branch from 46bf2e2 to 71bdd40 Compare November 17, 2026 01:42
@jwinarske

Copy link
Copy Markdown
Contributor Author

Rebased onto master and force-pushed.

@andywolff andywolff 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.

Thanks for the updates. Mostly LGTM, just one comment and will probably need another rebase once #193003 lands

/// Verifies Vulkan proc interception under Impeller. Because Impeller does not
/// submit command buffers during context setup, this test renders a frame to
/// trigger `vkQueueSubmit`.
TEST_F(EmbedderTest, CanSwapOutVulkanCallsWithImpeller) {

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.

Please guard CanSwapOutVulkanCallsWithImpeller with #if IMPELLER_SUPPORTS_RENDERING (same as requested on #193003). embedder_vk_unittests.cc is compiled on Fuchsia (test_enable_vulkan = true) where impeller_supports_rendering = false, so without the guard this test will compile and time out waiting for a frame.

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.

Done in the push that crossed with this review.

@jwinarske
jwinarske force-pushed the pr6/impeller-test-variants branch from 71bdd40 to 7213dda Compare November 17, 2026 20:47
@jwinarske

Copy link
Copy Markdown
Contributor Author

Force-pushed.

andywolff
andywolff previously approved these changes Nov 17, 2026

@andywolff andywolff 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.

LGTM, thanks! LMK if I need to reapprove after the other one merges and you rebase

@gaaclarke could you look at this one too please?

andywolff
andywolff previously approved these changes Nov 18, 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.

This looks like it's based on #193003, can you rebase it so I'm not reviewing things twice? Or we can wait for that one to merge and just rebase on main.

Impeller is the default renderer and none of these tests exercised it on
Vulkan. Add it as a backend the multi-backend fixture can select:
kVulkanImpellerContext yields the same Vulkan context with Impeller
enabled, and the config builder adds --enable-impeller for it, so a test
written once runs under both renderers without naming the flag.

Impeller's output matches the Skia goldens to within 2-3 levels per
channel, which an exact comparison fails, so the Impeller variants carry
their own: vk_impeller_*. The root-surface and backing-store paths produce
byte-identical pixels, so one golden serves both.

Two things the variants exposed:

CanSwapOutVulkanCalls only waits for the root isolate. Skia submits while
building its context, so the queue submit it checks for has happened by
then; Impeller submits nothing until it renders, so its variant renders a
frame first. Both clear the capture on exit, which is global.

CanRenderGradientWithCompositorOnNonRootLayer expects the root layer's
paint region to be the whole frame. That holds for Skia because it records
the frame-start clear into the slice; Impeller does not, so its region is
the picture actually drawn there. Encoded per backend for now. Filed
separately as flutter#192973 -- the layer is cleared either way, so
an embedder trusting the region can keep stale pixels, and that wants
fixing rather than asserting.
@github-actions github-actions Bot removed the e: impeller Impeller rendering backend issues and features requests label Nov 24, 2026
@jwinarske

jwinarske commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

@gaaclarke Rebased on master now that #193003 has landed. It's one commit: the Impeller variants of the shared Vulkan embedder tests and their goldens. The callback-ownership change that was stacked here went in with #193003, so it's gone from this PR too.

@jwinarske
jwinarske requested a review from gaaclarke November 24, 2026 17:26
@gaaclarke
gaaclarke requested a review from andywolff November 24, 2026 18:26

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

lgtm, thanks

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.

🌈

@andywolff andywolff added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 24, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Nov 24, 2026
Merged via the queue into flutter:master with commit aa52436 Nov 24, 2026
22 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 24, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Nov 25, 2026
Roll Flutter from b75c5b30406a to 06f1c24345a2 (37 revisions)

flutter/flutter@b75c5b3...06f1c24

2026-11-25 [email protected] Roll Skia from a60d883b3fe3 to e84ecd98d9f2 (2 revisions) (flutter/flutter#197375)
2026-11-25 [email protected] Roll Skia from ca229e319550 to a60d883b3fe3 (4 revisions) (flutter/flutter#197371)
2026-11-25 [email protected] Roll Skia from 6f75212e5a23 to ca229e319550 (2 revisions) (flutter/flutter#197369)
2026-11-25 [email protected] Roll Skia from 75d95595f14e to 6f75212e5a23 (1 revision) (flutter/flutter#197364)
2026-11-25 [email protected] [Windows] Fix Korean 3-beolsik IME dropping space, digits and punctuation (flutter/flutter#194270)
2026-11-25 [email protected] [flutter_tools] Strip embedded credentials from repository URLs (flutter/flutter#197219)
2026-11-25 [email protected] [flutter_tools] Add structured extension.log notifications for tool extensions (flutter/flutter#196714)
2026-11-25 [email protected] [flutter_tools] Share Depfile in flutter_tools_core and make BuildTarget.targetPlatform optional (flutter/flutter#194965)
2026-11-25 [email protected] Reply null asynchronously to ignored web platform messages and unskip missing-asset tests (flutter/flutter#197267)
2026-11-25 [email protected] Roll Dart SDK from 87f515c52de9 to 5202130a51b8 (1 revision) (flutter/flutter#197363)
2026-11-25 [email protected] [web] Retain queued scene pictures via ContainerLayer render pinning (flutter/flutter#196748)
2026-11-25 [email protected] [flutter_tools] Include dependency manifests in copyAssets depfile (flutter/flutter#196596)
2026-11-25 [email protected] Print the Intel Mac deprecation warning on every command (flutter/flutter#194071)
2026-11-25 [email protected] Roll Skia from 243c0dc9f662 to 75d95595f14e (2 revisions) (flutter/flutter#197351)
2026-11-25 [email protected] iOS: Ignore platform messages after the engine is destroyed (flutter/flutter#197310)
2026-11-24 [email protected] Bump customer tests to pick up material_ui cache extent test updates (flutter/flutter#197266)
2026-11-24 [email protected] [flutter_tools] Use refreshed FlutterVersion for flutter doctor feature flags (flutter/flutter#196944)
2026-11-24 [email protected] [flutter_tools] Do not crash if buildXcodeProject temporary directory is deleted before cleanup (flutter/flutter#195918)
2026-11-24 [email protected] Fix some `parameter_assignments` warnings (flutter/flutter#196815)
2026-11-24 [email protected] [flutter_tools] Extract PlatformDebuggingOptions and move WebDebugConfig (flutter/flutter#197229)
2026-11-24 [email protected] Fix desktop apps installing to the system prefix after a failed build (flutter/flutter#196482)
2026-11-24 [email protected] [flutter_tools] Write flutter test native_assets.json outside targetDir (flutter/flutter#196300)
2026-11-24 [email protected] iOS: Check the presented composition order in platform view tests (flutter/flutter#197302)
2026-11-24 [email protected] Run the shared Vulkan embedder tests under Impeller as well as Skia (flutter/flutter#193004)
2026-11-24 [email protected] Roll Fuchsia Linux SDK from BOgXtIYxLYcCkRou2... to HtAKfFLbfAQ6g96RY... (flutter/flutter#197334)
2026-11-24 [email protected] Roll Skia from b3dec9325fe1 to 243c0dc9f662 (6 revisions) (flutter/flutter#197333)
2026-11-24 [email protected] [flutter_tools] Delete globals.dart and context_runner.dart (flutter/flutter#196095)
2026-11-24 [email protected] Update viewInsets docs for translucent and rounded system UI (flutter/flutter#196355)
2026-11-24 [email protected] [flutter_tools] Check that dartaotruntime can run before starting the frontend server (flutter/flutter#194206)
2026-11-24 [email protected] [framework] Fix DraggableScrollableSheet '_hold == null' assertion when touch lifts during snap (flutter/flutter#195771)
2026-11-24 [email protected] [web] Release ImageSource on GC and fix Picture finalizer cycles (flutter/flutter#197245)
2026-11-24 [email protected] [flutter_tools] Fix web compiler output tracking in web builds (flutter/flutter#196563)
2026-11-24 [email protected] Upgrade CI to Xcode 27.2 (flutter/flutter#196807)
2026-11-24 [email protected] Roll Packages from 5b93485 to f455dfa (6 revisions) (flutter/flutter#197316)
2026-11-24 [email protected] [Linux] Fix deadlock presenting to a Wayland subsurface (flutter/flutter#196945)
2026-11-24 [email protected] Roll Skia from 2140958ee284 to b3dec9325fe1 (1 revision) (flutter/flutter#197309)
2026-11-24 [email protected] Roll Fuchsia Test Scripts from oEU515sDqSTvD8Spx... to GPtykFNizlaauBqzs... (flutter/flutter#197313)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode 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

...
@jwinarske
jwinarske deleted the pr6/impeller-test-variants branch November 25, 2026 21:49
chingjun added a commit to chingjun/flutter that referenced this pull request Nov 27, 2026
The branch was rebased onto master (ba17b71, 90 commits after the
last base, ac8f87e), with which the pull request no longer merged:
nine files conflicted, the first of them since 689d7b9 ("Upgrade CI
to Xcode 27.2", flutter#196807). The replay gave each conflict
to the replayed commit, so in those files the commits below this one
hold the branch's old text, and they keep the lock file and the
generated files of the old base. Of the 656 commits replayed (the 634
of the last push and 22 new ones) 646 keep their patch ids, nine
changed (they touch files master changed too), and one is gone:
"[flutter_tools] A test added upstream passes featureFlags", whose one
line is upstream's own since flutter#197269.

This commit's tree is the tree of a merge of the same master into the
branch (those 656 commits), with the nine conflicts resolved by hand
and six files more that master's 90 commits need: fifteen files differ
from the merge as git writes it, and no other.

The nine conflicts:

- ci/builders/mac_clang_tidy.json: the branch's three builds, with
  upstream's Xcode (sdk_version 27b52, flutter#196807).
- lib/web_ui/dev/chrome.dart: the branch's --remote-debugging-port=0
  and upstream's --js-flags=--expose-gc (flutter#197245).
- Seven test files of flutter_tools. Upstream removed
  testWithoutContext in favour of test (flutter#197259) and moved tests off
  testUsingContext (flutter#197246, flutter#197254, flutter#197257).
  build_system/targets/android_test.dart and ios_test.dart are
  master's with the branch's one line (the include is
  HostArtifact.shaderLib). localizations_test.dart is master's: the
  branch's one-line fix of it is upstream's flutter#197269 now.
  runner/local_engine_test.dart, android/
  android_gradle_builder_test.dart, ios/xcodeproj_test.dart and
  tester/flutter_tester_test.dart are master's with the branch's
  tests as plain test() calls.

Not conflicts in the text, and needed all the same (the six files):

- artifacts_test.dart merged cleanly and called the removed
  testWithoutContext seven times: test() now.
- The Scenario app's simulator runtime is iOS 27.2, as upstream's
  run_ios_tests.dart and goldens have it since flutter#196807: the
  converter's manifest.dart and the generated
  testing/ios_scenario_app/BUILD.bazel.
- deps.lock.bzl for master's DEPS: the rolls of Skia, Dart and Dart's
  BoringSSL, the Fuchsia SDK and Fuchsia's test scripts.
  pub.lock.bzl does not change (upstream changed no pubspec).
- The converter's output for two BUILD.gn files upstream changed:
  shell/platform/darwin/ios/BUILD.bazel (the new test source
  FlutterPlatformViewsControllerObjCTest.m, flutter#197429) and
  shell/platform/embedder/BUILD.bazel (the dependency on
  //flutter/impeller/renderer/backend/vulkan and two fixtures,
  flutter#193004).
- dart format on two of the merged tests (artifacts_test.dart,
  xcodeproj_test.dart): test( is shorter than the name it replaces.

Checked on this tree, all of it on Linux, with the Dart SDK DEPS pins
(3.15.0-185.0.dev, the engine's prebuilt one):

- gen_deps.dart and gen_pub_lock.dart, and both with --check; the
  converter regenerated and with --check (112 generated files
  current): the three files named above changed and no other.
- dart format over the 98 Dart files that differ from master.
- The analyzer over flutter_tools, dev/bots, flutter_goldens, the
  converter, bazel_tools and lib/web_ui/dev: no issues.
- Tests: the ten tool test files the branch touches,
  localizations_test.dart and the test command's (399 tests); the
  converter's suite (319); dev/bots' bazel_test.dart,
  run_command_test.dart and test_test.dart (59). One of the 59 fails
  where no SHARD is set: upstream's "--dry-run prints every test that
  would run" inherits the environment, and without a shard a dry run
  on Linux ends at the first one, which throws off a Mac (master's
  code reads the same; not run there). With SHARD=framework_tests and
  SUBSHARD=misc, as its bot has them, it passes.
- check_build_configs.sh, check_generated_bazel_files.sh,
  bazel_ci_test.py (36), engine_build_configs (84), bazel_tools (62),
  GN's own check (tools/gn) for a host debug build, tools/gn_test.py
  (7), ci/pylint.sh, ci/format.sh (its Python step through yapf
  directly, 14 files).
- buildifier over the 364 Starlark files that differ from master. One
  warning, and an old one: build/bazel/toolchains/emscripten/spike/
  BUILD.bazel calls sh_test without loading it from rules_shell. The
  file is the last push's; earlier runs gave buildifier only the
  files a change touched. Left as it is here.
- Bazel analysis: ci_host_debug, host_release_test, //:tool_tests
  //:dart_tests, and every Linux build of builds.json with its
  install and its suite under its own configuration (47 of 47, 4 of
  them without RBE). The first analysis with the rolled Skia and
  Dart, whose BUILD files are generated when their repositories are
  set up.

Not run: nothing was built, linked or run under Bazel on this tree,
on Linux or on a Mac, and no Dart tool ran on a Mac. The merge's Mac
and iOS side (the clang-tidy builds' Xcode, the Scenario app's
runtime, the new iOS test source) and the new embedder dependency
have their first build on the bots.
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.

3 participants