Skip to content

[Flutter GPU] Run gpu_unittests with the host engine tests, and three small fixes - #197187

Open
bdero wants to merge 5 commits into
flutter:masterfrom
bdero:bdero/flutter-gpu-followup-fixes
Open

bdero wants to merge 5 commits into
flutter:masterfrom
bdero:bdero/flutter-gpu-followup-fixes

Conversation

@bdero

@bdero bdero commented Nov 23, 2026

Copy link
Copy Markdown
Member

Related to #193745. Split out of #196621.

gpu_unittests was built in CI but never run, so it now runs with the host engine tests. Three small fixes come along with it.

  • A submit completion runs once when the backend reports kError and then also returns failure. The second run used a consumed Dart handle.
  • Texture.fromImage reads the texture the image already holds instead of building an AiksContext, with its content context and pipelines, on the calling thread.
  • Pass encoding, submission, and shader registration are traced.

Pre-launch Checklist

…lure

Some backends report kError for a failed submission before returning the
failure, so the callback ran twice, and the second run used a consumed Dart
handle.
Texture.fromImage built an AiksContext on the calling thread to read an
image's texture, which created the content context and its pipelines there.
It now reads the texture the image already holds.
The target was built in CI but never run.
@bdero bdero added engine flutter/engine related. See also e: labels. flutter-gpu CICD Run CI/CD team-fluttergpu Owned by Flutter GPU team labels Nov 23, 2026
@github-project-automation github-project-automation Bot moved this to 🤔 Needs Triage in Flutter GPU Nov 23, 2026
@github-actions github-actions Bot added the e: impeller Impeller rendering backend issues and features requests label Nov 23, 2026
@bdero
bdero marked this pull request as ready for review November 23, 2026 01:08

@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 introduces GetResolvedTexture to retrieve backing textures without a renderer, replacing the previous GetImpellerTexture path that relied on AiksContext. It also adds performance tracing, ensures command buffer completion callbacks run at most once using an atomic flag, and includes new unit tests. Feedback raises a concern that switching to GetResolvedTexture in GetTextureFromImage will cause a regression by returning nullptr for CPU-backed images, and suggests exploring a lighter resolution path using impeller::Context instead.

Comment thread engine/src/flutter/lib/gpu/texture.cc Resolved
@gaaclarke
gaaclarke self-requested a review November 23, 2026 18:21

@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, just a minor nit to make the getter return a ref to the shared_ptr to avoid atomic refcounts when we can.

return texture_;
}

std::shared_ptr<impeller::Texture> DlImageImpellerTexture::GetResolvedTexture()

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.

Suggested change
std::shared_ptr<impeller::Texture> DlImageImpellerTexture::GetResolvedTexture()
const std::shared_ptr<impeller::Texture>& DlImageImpellerTexture::GetResolvedTexture()

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.

This overrides a virtual that returns by value, and the deferred image types can't hand out a reference because their texture is filled in later on the raster thread. The one caller copies it into its own return value either way.

@bdero
bdero requested a review from gaaclarke November 26, 2026 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD e: impeller Impeller rendering backend issues and features requests engine flutter/engine related. See also e: labels. flutter-gpu team-fluttergpu Owned by Flutter GPU team

Projects

Status: 🤔 Needs Triage

Development

Successfully merging this pull request may close these issues.

2 participants