Skip to content

Conversation

@planetmarshall
Copy link
Contributor

@planetmarshall planetmarshall commented Dec 10, 2025

There are existing compute unit tests in compute_unittests.cc but they were not added to the build. Add them if impeller_enable_compute is enabled.

Closes #179709

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • 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.

@github-actions github-actions bot added engine flutter/engine related. See also e: labels. e: impeller Impeller rendering backend issues and features requests labels Dec 10, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request successfully integrates existing compute unit tests into the build system, conditional on impeller_enable_compute. Additionally, it refactors the creation of HostBuffer instances in compute_unittests.cc into a dedicated helper function, CreateHostBufferFromContext. This refactoring significantly improves code maintainability by centralizing the HostBuffer initialization logic and reducing duplication across multiple test cases. The use of an anonymous namespace for the helper function is appropriate for its file-local scope.

Comment on lines +19 to +26
namespace {
std::shared_ptr<impeller::HostBuffer> CreateHostBufferFromContext(
const std::shared_ptr<impeller::Context>& context) {
return impeller::HostBuffer::Create(
context->GetResourceAllocator(), context->GetIdleWaiter(),
context->GetCapabilities()->GetMinimumUniformAlignment());
}
} // namespace
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Extracting the HostBuffer creation logic into CreateHostBufferFromContext is a good practice. It improves maintainability by centralizing the initialization details, making the code cleaner and easier to update if the HostBuffer::Create signature changes in the future. This also aligns with the Google C++ Style Guide's emphasis on readability and avoiding duplication.

Reference: Google C++ Style Guide - Function Names

References
  1. C++ code should follow the Google C++ Style Guide, which promotes readability and maintainability through practices like extracting repetitive logic into functions. (link)

@chinmaygarde chinmaygarde added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 5, 2026
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jan 5, 2026
@auto-submit
Copy link
Contributor

auto-submit bot commented Jan 5, 2026

autosubmit label was removed for flutter/flutter/179689, because The base commit of the PR is older than 7 days and can not be merged. Please merge the latest changes from the main into this branch and resubmit the PR.

@jason-simmons jason-simmons force-pushed the add-existing-compute-unittests branch from 95eec19 to f6439ab Compare January 5, 2026 19:39
@jason-simmons jason-simmons added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 5, 2026
@auto-submit auto-submit bot added this pull request to the merge queue Jan 5, 2026
Merged via the queue into flutter:master with commit 77dba65 Jan 5, 2026
181 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jan 5, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 6, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 6, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 6, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 6, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 6, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 6, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 7, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 7, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 7, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 7, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Compute pipeline unit tests have not been added to the build

3 participants