Skip to content

Enable unit tests for compilation of compute shaders on non-metal backends#179683

Merged
auto-submit[bot] merged 4 commits into
flutter:masterfrom
planetmarshall:enable-gles-compute-compile
Jun 13, 2026
Merged

Enable unit tests for compilation of compute shaders on non-metal backends#179683
auto-submit[bot] merged 4 commits into
flutter:masterfrom
planetmarshall:enable-gles-compute-compile

Conversation

@planetmarshall

@planetmarshall planetmarshall commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

Enables the unit tests that verifies that compute shaders can be compiled. This unit test was previously only enabled for Metal backends, however compilation is supported on all backends (provided the ESSL language version is at least 310), except SKSL.

Closes #179708

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

@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 enables unit tests for compute shader compilation on non-Metal backends. This is achieved by introducing a gles_language_version parameter to the CanCompileAndReflect test helper function, allowing tests to specify the required ESSL version. The compute shader test is updated to use ESSL version 310, and the test is now enabled for all backends except SkSL. The changes are well-structured, and the updated test is now more explicit and cleaner with the removal of a redundant assertion. The implementation is correct and follows the project's C++ styling conventions.

@planetmarshall planetmarshall force-pushed the enable-gles-compute-compile branch from a0eaf0f to 15656b5 Compare December 10, 2025 21:57
Comment thread engine/src/flutter/impeller/compiler/compiler_unittests.cc Outdated
@Piinks

Piinks commented Feb 23, 2026

Copy link
Copy Markdown
Contributor

Greetings from stale PR triage! 👋
Is this change still something you would like to move forward with?

@planetmarshall

Copy link
Copy Markdown
Contributor Author

Greetings from stale PR triage! 👋 Is this change still something you would like to move forward with?

Yes please. It's currently awaiting a response from the engine team.

@gaaclarke

Copy link
Copy Markdown
Member

Sorry @planetmarshall, looks like this got lost when chinmay left the team. If you want to resolve the conflicts I can give it a look.

@gaaclarke gaaclarke requested review from flar and gaaclarke and removed request for chinmaygarde April 27, 2026 22:12

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

Not very familiar with this code, but it looks fine to me. I'm not approving as I'd rather @gaaclarke take a look and weigh in.

I'd like to see the new enum language version adopted more globally, and perhaps rely less on casts to/from int in the implementation, but I don't see any functional issues with the changes.

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

Does it make more sense to rely on version directives in the source code?

@planetmarshall planetmarshall force-pushed the enable-gles-compute-compile branch from 15656b5 to 5beae51 Compare May 12, 2026 15:26
@planetmarshall

Copy link
Copy Markdown
Contributor Author

Does it make more sense to rely on version directives in the source code?

The version refers to the version of ESSL that is being generated by the compiler, so we can't read the #version directive as it hasn't been generated yet.

That said, I'm not sure what the purpose of source_options.gles_language_version is, since the ESSL Language version could probably be inferred from the TargetPlatform (which is either GLES or GLES3).

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

Okay, we don't need to explicitly list 310 when compiling compute shaders, since 310 is required for compiling compute shaders.

So, instead of percolating this option up to CanCompileAndReflect, I'd like us just to automatically shift to 310 if we are compiling compute shaders.

--- a/engine/src/flutter/impeller/compiler/compiler.cc
+++ b/engine/src/flutter/impeller/compiler/compiler.cc
@@ -176,9 +176,11 @@ static CompilerBackend CreateGLSLCompiler(const spirv_cross::ParsedIR& ir,
   if (source_options.target_platform == TargetPlatform::kOpenGLES ||
       source_options.target_platform == TargetPlatform::kRuntimeStageGLES ||
       source_options.target_platform == TargetPlatform::kRuntimeStageGLES3) {
+    uint32_t default_version =
+        source_options.type == SourceType::kComputeShader ? 310 : 100;
     sl_options.version = source_options.gles_language_version > 0
                              ? source_options.gles_language_version
-                             : 100;
+                             : default_version;
     sl_options.es = true;
     if (source_options.target_platform == TargetPlatform::kRuntimeStageGLES3) {
       sl_options.version = 300;
@@ -195,9 +197,11 @@ static CompilerBackend CreateGLSLCompiler(const spirv_cross::ParsedIR& ir,
           }
         });
   } else {
+    uint32_t default_version =
+        source_options.type == SourceType::kComputeShader ? 430 : 120;
     sl_options.version = source_options.gles_language_version > 0
                              ? source_options.gles_language_version
-                             : 120;
+                             : default_version;
     sl_options.es = false;
   }
   gl_compiler->set_common_options(sl_options);

@gaaclarke gaaclarke added the CICD Run CI/CD label May 13, 2026
gaaclarke
gaaclarke previously approved these changes May 13, 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! thanks

@gaaclarke gaaclarke requested a review from flar May 13, 2026 17:53
@planetmarshall planetmarshall force-pushed the enable-gles-compute-compile branch from 7eb3405 to 394688c Compare May 13, 2026 17:57
@github-actions github-actions Bot removed the CICD Run CI/CD label May 13, 2026
@planetmarshall

Copy link
Copy Markdown
Contributor Author

looks good to me! thanks

You were too quick! I realised I'd borked the logic but that should be good to go now.

@planetmarshall planetmarshall requested a review from gaaclarke May 13, 2026 20:11
@planetmarshall planetmarshall requested a review from gaaclarke June 12, 2026 09:18
@gaaclarke gaaclarke added the CICD Run CI/CD label Jun 12, 2026
@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 12, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 12, 2026
@auto-submit

auto-submit Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/179683, because This PR has not met approval requirements for merging. The PR author is not a member of flutter-hackers and needs 1 more review(s) in order to merge this PR.

  • Merge guidelines: A PR needs at least one approved review if the author is already part of flutter-hackers or two member reviews if the author is not a member of flutter-hackers before re-applying the autosubmit label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@gaaclarke gaaclarke requested a review from andywolff June 12, 2026 17:54
@gaaclarke

Copy link
Copy Markdown
Member

@andywolff can I get a quick review, please?

@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! The compiler tests are passing for me on a local checkout

@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 12, 2026
@auto-submit auto-submit Bot added this pull request to the merge queue Jun 12, 2026
Merged via the queue into flutter:master with commit be62921 Jun 13, 2026
208 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 13, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Jun 15, 2026
Roll Flutter from b7cb925419e6 to 5827d5fd2b8d (35 revisions)

flutter/flutter@b7cb925...5827d5f

2026-06-15 engine-flutter-autoroll@skia.org Roll Skia from 7128af60575a to c8d9f80f13e4 (1 revision) (flutter/flutter#188015)
2026-06-15 jason-simmons@users.noreply.github.com In the APNG decoder, validate the chunk data length before calling GetChunkSize to avoid potential overflow in the chunk size calculation (flutter/flutter#187949)
2026-06-15 engine-flutter-autoroll@skia.org Roll Skia from 6b4ac3bfb39d to 7128af60575a (1 revision) (flutter/flutter#188011)
2026-06-15 engine-flutter-autoroll@skia.org Roll Skia from 0a3b8549cbf0 to 6b4ac3bfb39d (7 revisions) (flutter/flutter#188007)
2026-06-15 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[a11y] Map some framework semantics roles to android classes.  (#185217)" (flutter/flutter#188008)
2026-06-15 chris@bracken.jp [ios] Filter UIScene events to those relating to Flutter VC scene (flutter/flutter#187987)
2026-06-15 jhy03261997@gmail.com [a11y] Map some framework semantics roles to android classes.  (flutter/flutter#185217)
2026-06-15 engine-flutter-autoroll@skia.org Roll Skia from f46928e7f50c to 0a3b8549cbf0 (1 revision) (flutter/flutter#188004)
2026-06-14 stuartmorgan@google.com Rework docs for flutter/packages changelogs (flutter/flutter#187666)
2026-06-14 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from nvzMQAmuRSzo7-wAP... to TbB86Po_HDe1dvXvT... (flutter/flutter#187997)
2026-06-14 engine-flutter-autoroll@skia.org Roll Skia from 4e2c9b5e4dad to f46928e7f50c (1 revision) (flutter/flutter#187996)
2026-06-14 engine-flutter-autoroll@skia.org Roll Skia from c52667607242 to 4e2c9b5e4dad (1 revision) (flutter/flutter#187990)
2026-06-14 737941+loic-sharma@users.noreply.github.com Improve RenderTargetCache docs (flutter/flutter#187893)
2026-06-13 brackenavaron@gmail.com [Test cross_imports] Check cross imports in flutter_test/** (flutter/flutter#187587)
2026-06-13 matt.kosarek@canonical.com Fixing corrupted window size OnEmptyFrameGenerated due to transpsed width/height (flutter/flutter#187954)
2026-06-13 engine-flutter-autoroll@skia.org Roll Skia from 42355271a335 to c52667607242 (2 revisions) (flutter/flutter#187979)
2026-06-13 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from A3eaUn9mQ_EkSNxVI... to nvzMQAmuRSzo7-wAP... (flutter/flutter#187975)
2026-06-13 engine-flutter-autoroll@skia.org Roll Skia from 9ef46390c2d1 to 42355271a335 (1 revision) (flutter/flutter#187974)
2026-06-13 bdero@google.com [Flutter GPU] Make ShaderLibrary.fromAsset asynchronous (flutter/flutter#187716)
2026-06-13 engine-flutter-autoroll@skia.org Roll Skia from 8c89bf2b0ee3 to 9ef46390c2d1 (6 revisions) (flutter/flutter#187968)
2026-06-12 bdero@google.com [Flutter GPU] Add surface API for framework presentation (flutter/flutter#187358)
2026-06-12 bkonyi@google.com [gen_l10n] Exclude inherited keys from untranslated-messages-file (flutter/flutter#187950)
2026-06-12 31859944+LongCatIsLooong@users.noreply.github.com Update `MediaQueryData` docs for devicePixelRatio overriding (flutter/flutter#187542)
2026-06-12 bdero@google.com [Impeller] Fix dirty-range race in DeviceBufferGLES uploads (flutter/flutter#187932)
2026-06-12 pascal@phntm.xyz Compare isModifiedAfter against the given time (flutter/flutter#187727)
2026-06-12 planetmarshall@users.noreply.github.com Enable unit tests for compilation of compute shaders on non-metal backends (flutter/flutter#179683)
2026-06-12 matt.boetger@gmail.com [flutter_tools] Add doctor validator warning for multiple adb installations (flutter/flutter#186031)
2026-06-12 matt.boetger@gmail.com Optimize SHA hash calculation of generated APK (flutter/flutter#187184)
2026-06-12 mu7ammadkamel@hotmail.com Scope widget inspector overlay to the selected widget's modal route (flutter/flutter#186784)
2026-06-12 30870216+gaaclarke@users.noreply.github.com Switches Windows to OpenGLESSDF (flutter/flutter#187877)
2026-06-12 matt.boetger@gmail.com [integration_test] Update README to support modern Kotlin-based setups by default (flutter/flutter#186080)
2026-06-12 jason-simmons@users.noreply.github.com Convert the PNG signature constant in APNGImageGenerator to a std::array and use it in the APNG tests (flutter/flutter#187930)
2026-06-12 matt.boetger@gmail.com Correct backoff retry time cap unit and add regression tests (flutter/flutter#187250)
2026-06-12 chingjun@google.com Fix std::vector out-of-bounds access in Flutter Android JNI and Delegate (flutter/flutter#187218)
2026-06-12 matt.boetger@gmail.com [Android] Adding 30-second timeouts to adb stopApp and uninstallApp (flutter/flutter#187876)

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 bmparr@google.com,stuartmorgan@google.com 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
...
via-guy pushed a commit to via-guy/flutter that referenced this pull request Jun 26, 2026
…kends (flutter#179683)

Enables the unit tests that verifies that compute shaders can be
compiled. This unit test was previously only enabled for Metal backends,
however compilation is supported on all backends (provided the ESSL
language version is at least 310), except SKSL.

Closes flutter#179708

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] 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.
- [x] All existing and new tests are passing.

---------

Co-authored-by: gaaclarke <30870216+gaaclarke@users.noreply.github.com>
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unit tests for compilation of compute shaders on non-metal backends are disabled

7 participants