[impeller] Use the GLES3 shaders in the embedder if supported#180072
[impeller] Use the GLES3 shaders in the embedder if supported#180072auto-submit[bot] merged 16 commits intoflutter:masterfrom
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
There was a problem hiding this comment.
Code Review
This pull request updates the embedder to use GLES3 shaders when supported by the driver. The logic for creating shader mappings has been refactored into a new helper function GetShaderMappings. My review identified a critical issue in this new function where the logic for selecting between GLES2 and GLES3 shaders is inverted, which would lead to loading the incorrect shader set. I've provided a code suggestion to correct this logic.
engine/src/flutter/shell/platform/embedder/embedder_surface_gl_impeller.cc
Show resolved
Hide resolved
753394a to
db49ef4
Compare
gaaclarke
left a comment
There was a problem hiding this comment.
What about test coverage for this?
Sure, I'll take a look and see if I can add something. |
…ted with the v3 shaders present
…3-shaders # Conflicts: # engine/src/flutter/impeller/playground/backend/gles/playground_impl_gles.cc
|
f96a6a1 to
3cec016
Compare
|
CI failing due to an error in ANGLE. Will ask on Discord. |
|
ANGLE needs a patch for |
|
Upstream PR added for ANGLE by @jason-simmons https://flutter-review.googlesource.com/c/third_party/angle/+/75120 |
…3-shaders # Conflicts: # engine/src/flutter/impeller/fixtures/BUILD.gn
gaaclarke
left a comment
There was a problem hiding this comment.
Approach looks good to me. Testing looks good. I just have some stylistic feedback and one code quality request.
| std::shared_ptr<ReactorWorker> worker_; | ||
| const bool use_angle_; | ||
| void* angle_glesv2_; | ||
| mutable bool is_gles3_ = false; |
There was a problem hiding this comment.
Please remove this mutable ivar. You should be able to query the worker_ instead. Somewhere we can query this instead of caching it.
There was a problem hiding this comment.
I've made it a property of the local worker class. I'm not sure that this is all that much better but I'm happy to take advice as it wasn't all that obvious how to do it.
There was a problem hiding this comment.
My last review was in reference to this. Sorry, if it wasn't clear. Everything else looks good =)
engine/src/flutter/shell/platform/embedder/tests/embedder_test_surface_gl_impeller.cc
Outdated
Show resolved
Hide resolved
engine/src/flutter/shell/platform/embedder/tests/embedder_test_surface_gl_impeller.cc
Outdated
Show resolved
Hide resolved
engine/src/flutter/shell/platform/embedder/tests/embedder_test_surface_gl_impeller.cc
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
I'm not a fan of this approach because that aspect doesn't really belong to the ReactorWorker, it reflects no meaningful state for its behavior.
I took a look and there are 2 clean ways to address this:
- Stop caching the result to a bool and just call
gl->GetDescription()->GetGlVersion().IsAtLeast(Version(3))when you need it. - Set
is_gles3_in thePlaygroundImplGLESconstructor.
Setting it in the constructor will probably mean a bit of refactoring that you would want to avoid. We'd probably have to make the constructor private and create a factory function that returns an absl::StatusOr<PlaygroundImplGLES> for the case the proc table fails to get created.
If you think this is a performance bottleneck that needs to be cached, just throw a TODO into the code and we can refactor it later. This is testing code so performance isn't super critical.
| reactions_allowed_[std::this_thread::get_id()] = allowed; | ||
| } | ||
|
|
||
| bool IsGLES3() { return is_gles3_; } |
There was a problem hiding this comment.
| bool IsGLES3() { return is_gles3_; } | |
| bool IsGLES3() const { return is_gles3_; } |
No it's not a performance concern. Just lack of familiarity with the code and as you say I don't want to do any heavyweight refactoring. I've had another attempt :) |
gaaclarke
left a comment
There was a problem hiding this comment.
Thanks, I know this may be slower but it's better to avoid surprising side effects for the sake of performance, especially in non-production code. We can make it faster in the future with some refactoring if we need to.
|
autosubmit label was removed for flutter/flutter/180072, 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. |
|
autosubmit label was removed for flutter/flutter/180072, 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.
|
| private: | ||
| mutable RWMutex mutex_; | ||
| std::map<std::thread::id, bool> reactions_allowed_ IPLR_GUARDED_BY(mutex_); | ||
| bool is_gles3_; |
There was a problem hiding this comment.
Remove this - it's no longer used after the latest changes
|
autosubmit label was removed for flutter/flutter/180072, 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. |
flutter/flutter@195ae7b...3f400d7 2026-03-11 [email protected] Roll Clang to 80743bd43fd5b38fedc503308e7a652e23d3ec93 (flutter/flutter#182919) 2026-03-11 [email protected] Roll Fuchsia Linux SDK from 8C_qfgWgoNhkV0_Mn... to QD887D4OanteB7UKM... (flutter/flutter#183492) 2026-03-11 [email protected] Roll Dart SDK from fecf806be5d0 to 8531f7c2bdae (2 revisions) (flutter/flutter#183489) 2026-03-11 [email protected] [impeller] Use the GLES3 shaders in the embedder if supported (flutter/flutter#180072) 2026-03-11 [email protected] Roll Dart SDK from ae2be9700800 to fecf806be5d0 (1 revision) (flutter/flutter#183482) 2026-03-11 [email protected] Add GLES support for the same pixel formats for copying texture -> buffer as when copying buffer -> texture (flutter/flutter#183428) 2026-03-11 [email protected] Roll Skia from 257d04225d0c to 0cab3e4ee34b (8 revisions) (flutter/flutter#183476) 2026-03-10 [email protected] Fix GitHub workflows to use the `flutteractionsbot` mirror for PR branches. (flutter/flutter#183470) 2026-03-10 [email protected] [material/menu_anchor.dart] Ensure positioned menus always begin animating at the target position (flutter/flutter#182932) 2026-03-10 [email protected] Roll pub packages (flutter/flutter#183467) 2026-03-10 [email protected] Roll Dart SDK from ebef6c849489 to ae2be9700800 (4 revisions) (flutter/flutter#183460) 2026-03-10 [email protected] Roll Skia from 4b35832cc7ea to 257d04225d0c (5 revisions) (flutter/flutter#183457) 2026-03-10 [email protected] dev: Use a super-parameter in several missed cases (flutter/flutter#182251) 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] 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
Adds the GLES3 shaders to the embedder (used by Linux and custom embedders) if they are supported.
Fixes #179185
Pre-launch Checklist
///).