5365 Commits

Author SHA1 Message Date
Jonah Williams
9235fbb695 [impeller] add Android flag for disabling surface control for debugging. (flutter/engine#55185)
I've found a few instances where Vulkan worked correctly but surface control did not. lets add a debugging flag we can ask folks to try to narrow down the issue.
2024-09-13 21:39:20 +00:00
Reid Baker
415f89e20a add back test itSendsTextShowPasswordToFrameworkOnAttach with new mock for display metrics (flutter/engine#55110)
Part 1/5 for re adding tests documented in flutter/flutter/issues/154746

## 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] and the [C++,
Objective-C, Java style guides].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.
2024-09-13 13:45:37 -04:00
Reid Baker
f6b728f86f Add copyright notices to java test files (flutter/engine#55155)
Fixes flutter/flutter/issues/155118
2024-09-13 15:31:52 +00:00
Robert Ancell
420b1b5d44 Filter out bad locales returned by g_get_language_names (flutter/engine#55091)
We're seeing issues with and "und" (undefined) locale and exceptions in
applications (see https://github.com/ubuntu/app-center/issues/1659). It
seems the GLib method for getting the language names doesn't clean up
invalid values, so we should do that.
2024-09-13 11:40:52 +12:00
Brandon DeRosier
16acb8258a Remove Impeller Scene 👋 (flutter/engine#55118)
Impeller Scene has been fully rewritten as a Dart library for Flutter: https://pub.dev/packages/flutter_scene
2024-09-12 14:56:08 -07:00
Matan Lurey
ca6c46441e Move zircon_tests from package:litetest to package:async_helper. (flutter/engine#55149)
The engine has historically used `package:litetest`, a home grown invention that is a wrapper around the Dart SDK.

In https://github.com/flutter/flutter/issues/133569, we've moved over to the heavier weight `package:test`, which has been simplified since first evaluated by the Dart SDK vending the dependencies we need. The last user of `package:litetest` is a single test in the Fuchsia SDK, `zircon_tests`.

This PR migrates the test from `litetest` (which will be deleted) to the Dart SK vendored `async_minittest`. For this simple test case, there is only a 1-line behavioral change (`notEquals(foo)` becomes `!= foo, true`), and it allows us to remove dependencies from the tree.
2024-09-12 21:10:52 +00:00
Jonah Williams
82224f9b11 [engine] make UI thread the platform thread for Android. Still allows opt out as g3 escape hatch. (flutter/engine#55111)
Part of  https://github.com/flutter/flutter/issues/150525
2024-09-12 15:21:19 +00:00
bungeman
2289895234 Ensure Vulkan when including Skia Vulkan headers (flutter/engine#55126)
Skia is changing how it handles its internal copy of Vulkan headers to
prevent them from accidentally leaking to users and potentially
overriding the user's Vulkan headers. Users of Skia are responsible for
providing the Vulkan headers when including Skia's public Vk headers.
This change only includes Skia's public Vk headers when Flutter is
providing the Vulkan headers.
2024-09-12 08:55:07 -04:00
Robert Ancell
2a10ec7c44 Fix crash quitting application due to iterating over a changing list. (flutter/engine#55062)
Detected as the FlPlatformHandlerTest.ExitApplicationDispose was
crashing sometimes, valgrind showed invalid memory access.
2024-09-12 09:40:45 +12:00
Robert Ancell
a89c2ae2a4 Use a signal for the pre-engine restart event (flutter/engine#55063)
With multiple FlViews a callback doesn't scale.
2024-09-12 09:25:52 +12:00
Gray Mackall
7a06558bd9 Replace System.loadLibrary with ReLinker.loadLibrary() in FlutterJNI.loadLibrary() (flutter/engine#55095)
Could fix? https://github.com/flutter/flutter/issues/83596

The communication on https://issuetracker.google.com/issues/346717090#comment2 recommends using [ReLinker](https://github.com/KeepSafe/ReLinker) to avoid a bug in how library loading interacts with the [Play delivery feature](https://developer.android.com/guide/playcore/feature-delivery) (used in turn by Flutter's deferred components).

The ReLinker docs also suggest that if you have `minSdk` less than `23`, then you should be using ReLinker regardless, as `System.loadLibrary` is unreliable for other reasons.

I don't have any strong evidence to suggest that either one of these two root causes is the definitive cause of https://github.com/flutter/flutter/issues/83596, but it probably wouldn't hurt 🤷 

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-09-11 21:05:52 +00:00
Reid Baker
930edba64f Add back FlutterViewTest.java (flutter/engine#55048)
Add back FlutterViewTest.java from 8e096b4 (last commit before it was deleted in https://github.com/flutter/engine/pull/44047)

Fixes flutter/flutter/issues/154746
2024-09-11 15:02:56 +00:00
auto-submit[bot]
f84f9c92b5 Reverts "[engine] reland: always post tasks for platform channel responses. (#55006)" (flutter/engine#55022)
Reverts: flutter/engine#55006
Initiated by: jonahwilliams
Reason for reverting: still failling mac module test
Original PR Author: jonahwilliams

Reviewed By: {jason-simmons}

This change reverts the following previous change:
Reland of https://github.com/flutter/engine/pull/54975

Fixes the initial route behavior for iOS. Previously the initial route setting would _always_ be posted as a task, which after merging the threads would fire after isolate creation, thus it would not actually update the initial route setting. Fixed Engine constructor so that it reads the initial route from the settings.
2024-09-07 02:56:46 +00:00
Jonah Williams
8ca7e1cd90 [engine] reland: always post tasks for platform channel responses. (flutter/engine#55006)
Reland of https://github.com/flutter/engine/pull/54975

Fixes the initial route behavior for iOS. Previously the initial route setting would _always_ be posted as a task, which after merging the threads would fire after isolate creation, thus it would not actually update the initial route setting. Fixed Engine constructor so that it reads the initial route from the settings.
2024-09-06 23:48:09 +00:00
Jonah Williams
b9aa7ed855 [Impeller] fix NPE when checking known bad driver. (flutter/engine#54959)
context can be null here which is causing https://github.com/flutter/flutter/issues/154622
2024-09-04 17:44:16 +00:00
Kaylee Lubick
ef050da2b8 Use moved Skia Ganesh header files (flutter/engine#54833)
In http://review.skia.org/892736 and http://review.skia.org/893856, Skia
moved its Ganesh headers to align with the Graphite ones. This updates
Flutter to use those moved files.

All changes are mechanical and there is no API difference between the
headers (indeed, the old ones simply `#include` the new ones).

## 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] and the [C++,
Objective-C, Java style guides].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2024-09-04 07:09:51 -07:00
hellohuanlin
48974293cd [ios][platform_view] fix platform view clipping path intersection (flutter/engine#54820)
It turns out that when there are multiple paths to clip, they are unioned together, rather than intersected. But clipping paths need to be intersected. 

There isn't any good way to intersect arbitrary paths. However, it is easy to intersect rect paths, which is the most common use case. Then we simply fallback to software rendering if we have to intersect non-rect paths. That is: 

**Case 1** Only 1 clipping path (either rect path or arbitrary path):
Hardware rendering. This should be the most common use case

**Case 2** Multiple rect clipping path: 
Hardware rendering. This is also common, and it's the linked issue that we are fixing. 

**Case 3** Other complex case (multiple non-rect clipping path)
Fallback to software rendering. This should be rare. 

After https://github.com/flutter/engine/pull/53826, we don't have a working benchmark that measures the main thread anymore. However, this PR shouldn't impact our ad benchmark, since it only has 1 clipping path. I will verify manually by checking Instruments and make sure no software rendering is happening. But we really should make the benchmark working again, not just for performance improvement, but also for monitoring regression. 

*List which issues are fixed by this PR. You must list at least one issue.*

Fixes https://github.com/flutter/flutter/issues/153904

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-09-03 20:36:48 +00:00
Jonah Williams
1018afbb9b [Impeller] disable Adreno 630 vulkan and add mechanism for android driver denylisting. (flutter/engine#54920)
Fixes https://github.com/flutter/flutter/issues/154103

From local testing, the Adreno 630 returns VK_INCOMPLETE when compiling certain shaders with no other error messages. That is not a valid return code from vkCreateGraphicsPipeline and likely indicates severe problems with the driver.
2024-09-03 18:40:04 +00:00
Robert Ancell
d6415a16c7 Make FlApplication class (flutter/engine#54637)
An app can now be:
```c
#include <flutter_linux/flutter_linux.h>

#include "flutter/generated_plugin_registrant.h"

static void register_plugins_cb(FlApplication *app, FlPluginRegistry *registry) {
  fl_register_plugins(registry);
}

static GtkWindow *create_window_cb(FlApplication *app, FlView *view) {
  GtkApplicationWindow *window =
      GTK_APPLICATION_WINDOW(gtk_application_window_new(GTK_APPLICATION(app)));

  gtk_window_set_title(GTK_WINDOW(window), "flutter_application_test");
  gtk_window_set_default_size(GTK_WINDOW(window), 1280, 720);

  gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));

  return GTK_WINDOW(window);
}

int main(int argc, char** argv) {
  g_autoptr(FlApplication) app = fl_application_new(APPLICATION_ID, G_APPLICATION_NON_UNIQUE);
  g_signal_connect(app, "register-plugins", G_CALLBACK(register_plugins_cb), nullptr);
  g_signal_connect(app, "create-window", G_CALLBACK(create_window_cb), nullptr);
  return g_application_run(G_APPLICATION(app), argc, argv);
}
```

With this simplified, we can now build multi-window behaviour without having to modify the template much in the future.

Fixes https://github.com/flutter/flutter/issues/142920
2024-09-03 16:02:21 +12:00
Jonah Williams
beb4e397b3 [android] Disable AHB swapchain and import on huawei API 29 devices. (flutter/engine#54879)
From local testing, it seems that AHB imports and swapchain usage of AHBs does not work on these Huawei devices. Vulkan does seem to work OK with these optional features disabled, but so far we've only tested on the P40 Pro.

Fixes https://github.com/flutter/flutter/issues/154068

* https://github.com/flutter/flutter/issues/153228
* https://github.com/flutter/flutter/issues/153762
* https://github.com/flutter/flutter/issues/154068
2024-08-30 00:09:24 +00:00
John Bauman
d3d50bb57d Use fuchsia.scheduler.RoleManager protocol (flutter/engine#54587)
As of f20, fuchsia.scheduler.RoleManager is preferred over fuchsia.media.ProfileProvider. The Vulkan ICD uses fuchsia.scheduler.RoleManager and is loaded into the flutter component, so the component needs to use the fuchsia.scheduler.RoleManager protocol.

*List which issues are fixed by this PR. You must list at least one issue.*
Fixes https://github.com/flutter/flutter/issues/153591

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-08-29 20:14:00 +00:00
Jonah Williams
95d3280800 [engine] add an ios noop context. (flutter/engine#54856)
This is required to allow simulators to run without exiting when impeller is enabled and there is no available metal contxt.
2024-08-29 05:07:24 +00:00
Robert Ancell
3fc9ab6c1a Store a set of layers per view. (flutter/engine#54793)
This means when rendering the correct layers are rendered for a view.
2024-08-27 20:28:05 +12:00
Robert Ancell
4b992b898f Use TRUE/FALSE consistently for gboolean values. (flutter/engine#54768)
Some code was using stbool true/false - use the gboolean values
consistently.
2024-08-27 15:43:13 +12:00
Chris Bracken
40ce12e1e1 macOS: Add @available check at macOS 12 workaround (flutter/engine#54784)
Use default mouse event handling behaviour on macOS 13.3.1 onwards. This has two positive effects:

* Avoids the workaround on newer macOS versions where it's unnecessary, thereby giving us confidence that the underlying AppKit issue is fixed and the whole method can later be removed.
* Will be caught by tooling when we drop support for versions of macOS prior to the fixed version.

Issue: https://github.com/flutter/flutter/issues/154063
Issue: https://github.com/flutter/flutter/issues/115015

No tests modified since there is no semantic change, either on versions of macOS where the issue is fixed (and thus the default event handler is correct) or on versions where it is not (and we still use the workaround).

Re-tested manually with the reduced transparency setting on macOS 14.6.1.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-08-26 22:04:24 +00:00
hellohuanlin
146e133c05 [ios] Fix text input edit rotor accessibility (flutter/engine#54351)
Fixes text input edit rotor accessibility missing edit actions.

It also fixes a few edit items that is displayed where it's not supposed to. (e.g. displaying select item while nothing to select).

*List which issues are fixed by this PR. You must list at least one issue.*

Fixes https://github.com/flutter/flutter/issues/151029

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-08-26 19:53:43 +00:00
Jenn Magder
374cc27f5e Revert "Test running the macOS engine has no stray logging" (flutter/engine#54778)
This reverts commit 7e82588c317d56a1fd106efe9e5fa840ff805442.

Revert https://github.com/flutter/engine/pull/54716. This new check is flaking and isn't very high-value.
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8738562907128595441/+/u/test:_Host_Tests_for_host_profile/stdout

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-08-26 17:57:14 +00:00
chunhtai
47bc9a3abb [Android] Drops semantics query when app is not attached (flutter/engine#52040)
Is seems automatic test may send a11y query before the engine is attached. Add a guard to guard against it.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-08-26 16:37:05 +00:00
Chris Bracken
b105e9b1cd [macOS] Add TODOs to remove AppKit bug workaround (flutter/engine#54764)
In https://github.com/flutter/engine/pull/40241, I added a workaround for an AppKit bug wherein mouseDown/Up events were ignored when the *Reduced Transparency* accessibility setting was enabled, and the view was hosted in an `NSPopover`.

I filed a Radar and Apple reported the bug fixed in macOS 13.3.1.

When we drop support for macOS 12 in Flutter, we should remove the workaround.

So long as nothing else has been added to these methods at that time, the method overrides themselves should be removed, so that we fall back to the default behaviour.

See: http://www.openradar.me/FB12050037
See: https://developer.apple.com/documentation/appkit/nsresponder/1535349-mouseup

Issue: https://github.com/flutter/flutter/issues/154063
Issue: https://github.com/flutter/flutter/issues/115015

No tests modified since this only adds a comment.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-08-25 15:00:36 +00:00
Jonah Williams
1ba45ac86e [Engine] Add no op surface (flutter/engine#54694)
Still needs to be tested in metalless environment. This should probably print out some kind of error message that tells folks that this is WAI, but I'm not sure if that would be too disruptive for g3.

Fixes https://github.com/flutter/flutter/issues/153883
2024-08-23 17:06:16 +00:00
Jonah Williams
c8fc2ff531 [engine] make Platform thread the UI thread for iOS Impeller. (flutter/engine#54655)
Does it blend?
2024-08-23 17:06:14 +00:00
Jenn Magder
7e82588c31 Test running the macOS engine has no stray logging (flutter/engine#54716)
Assert that running the macOS engine does not log anything unexpected 
See also issue https://github.com/flutter/flutter/issues/111577
Similar Windows check in https://github.com/flutter/engine/pull/47774

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-08-22 22:40:10 +00:00
Matan Lurey
d68876bb1d More diagnostic clean ups (flutter/engine#54265)
Towards https://github.com/flutter/flutter/issues/152636.

Almost all changes are `dart --fix`.
2024-08-22 21:04:17 +00:00
Joel Winarske
1961f2c5cc Export GPU symbols for embedder (flutter/engine#54662)
This PR exports GPU symbols for the embedder library.

*List which issues are fixed by this PR. You must list at least one issue.*
https://github.com/flutter/flutter/issues/153196

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-08-22 04:37:31 +00:00
Chinmay Garde
74861200d4 [iOS] Tweak note about OpenGL support on mac in a user facing log. (flutter/engine#54690)
We don't have an OpenGL backend on iOS.
2024-08-21 20:46:04 +00:00
Matan Lurey
7279070455 Remove spammy warning message on FlutterView (flutter/engine#54686)
@matanlurey:

> As of 2f6952657d, we are now printing a `W/FlutterView( 7775): API level 34 is too low to query bounding rects.` message which is not user actionable. Was this intended to stay in the merged PR? What value is it supposed to have?

@yaakovschectman:

> You might be right about that
2024-08-21 19:57:52 +00:00
Jonah Williams
248dfb2334 [engine] reland weaken affinity of raster/ui to non-e core instead of only fast core (flutter/engine#54616)
Some android devices have only a single fast core. We set the threading affinity for UI/Raster to the fast core, which can lead to the UI/Raster being serialized on this thread. Instead, we should weaken /invert the affinity to "Not slow cores".

FIxes https://github.com/flutter/flutter/issues/153690

Customer money will see some benchmark regressions but they can deal.
2024-08-21 16:31:55 +00:00
yaakovschectman
2f6952657d Use getBoundingRects to add support inset MediaQuery/SafeArea when in freeform mode controls are shown. (flutter/engine#54294)
Original Title: Add FlutterViewDelegate and BoundingRect methods

Check the bounding rect for caption bar when sending viewport metrics to
Flutter to account for freeform mode. Use the more recent
`getBoundingRects` over `getInsets`.

Tests will need to be kept separate until Robolectric publishes a
version that supports API level 35.
Roboletric tests for this pr will be part of google testing until then. 
Pr for tests here https://critique.corp.google.com/cl/657302386. 

https://github.com/flutter/flutter/issues/146658

## 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] and the [C++,
Objective-C, Java style guides].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [ ] I signed the [CLA].
- [x] All existing and new tests are passing.
2024-08-20 13:09:00 -04:00
Robert Ancell
2bbc3b4b41 Allow the default background color to be changed (flutter/engine#54575)
Fixes https://github.com/flutter/flutter/issues/149920
2024-08-20 08:00:06 +12:00
Jonah Williams
8b7101800f [Impeller] finish experimental canvas changes. (flutter/engine#54569)
Make sure the old dispatcher cannot be used if the new dispatcher is enabled. Migrate tests using old canvas to new canvas, mostly to make deleting the old one easier...
2024-08-19 19:37:17 +00:00
Matej Knopp
7a1fd055b8 Preserve background frame damage (flutter/engine#54540)
Fixes https://github.com/flutter/flutter/issues/153335

When platform views are present, we always repaint entire frame. We must pass the buffer damage all the way to `GPUSurfaceMetalSkia/GPUSurfaceMetalImpeller` so that they know that the other two surfaces are lagging behind front surface and need to be repainted.

This is currently not being done with platform view present, that's why we miss full frame repaint when removing platform view.

With this merged in, it should be safe to reland https://github.com/flutter/engine/pull/54537 without any changes.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-08-13 20:55:36 +00:00
Jonah Williams
1fd6a547fb [iOS] keep threads merged when using Skia renderer on iOS (flutter/engine#54514)
Potential fix for money crasher.
2024-08-12 21:27:54 +00:00
Matej Knopp
70d8d63f6e macOS: Fix crash in attributedSubstringForProposedRange with out of bounds range (flutter/engine#54469)
Fixes https://github.com/flutter/flutter/issues/153157

*If you had to change anything in the [flutter/tests] repo, include a
link to the migration guide as per the [breaking change policy].*

## 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] and the [C++,
Objective-C, Java style guides].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2024-08-12 20:00:46 +02:00
Loïc Sharma
5b06d21661 [Windows] Improve texture format logic (flutter/engine#54329)
This improves Flutter Window's texture format logic:

1. **If the device has extension `GL_EXT_texture_format_BGRA8888`**: backing stores' texture will be created with format `GL_BGRA_EXT` instead of `GL_RGBA8`. This is what fixes https://github.com/flutter/flutter/issues/150546.
2. **Otherwise**: backing stores' texture will be created with format `GL_RGBA` and the engine will use the color type `kRGBA_8888_SkColorType` when creating the `SkSurface`.

   Previously the engine always used color type `kN32_SkColorType`, which could be either RGBA or BGRA depending on the machine that compiled the engine. This caused Skia validation errors as the texture's format did not match the Skia surface's color type.

   I tested this by editing Flutter Windows to force it down this code path.

Huge kudos to @chinmaygarde for the OpenGL expertise!

Fixes: https://github.com/flutter/flutter/issues/150546

> [!WARNING]
> Unfortunately, we are unable to test this.
> This bug appears to only affect older devices; none of our devices reproduce this issue.
> We also do not have the infrastructure to do a native screenshot test on Windows. 
> I will get a test exemption for this change.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-08-12 17:51:48 +00:00
Brandon DeRosier
b19fe31562 Revert "[Impeller] remove scene3d support." (flutter/engine#54502)
Reverts flutter/engine#54453

Not quite ready to remove Impeller Scene yet because I'm still porting
the animation functionality. Keeping it around allows me to switch back
and forth to compare without having to recompile the engine.

Over a month ago I said something like "we can revert this a couple of
weeks from now" in one of the Impeller meetings. But for better or worse
(better, I think), I ended up spending a ton of time trying to make the
PBR good first (which doesn't exist in this C++ version).
2024-08-12 10:28:51 -07:00
Chinmay Garde
c2992b3273 Remove shared mutex from FML and use the C++17 variants. (flutter/engine#54482)
We used to require this only on iOS because the standard library till iOS 9 didn't have support for this. We have moved past that version. No change on other platforms.
2024-08-09 22:59:58 +00:00
Chinmay Garde
f60c0e325a Remove fml::size. (flutter/engine#54476)
std::size because standard in C++17.
2024-08-09 20:01:28 +00:00
Jonah Williams
198d1f1077 [Impeller] remove scene3d support. (flutter/engine#54453)
Now that Flutter GPU is a preview, the technical debt from having an ifdef controlled additional rendering mode can be removed.
2024-08-09 16:38:56 +00:00
Robert Ancell
5c4ffe8f9c Add a precision to the fragment shader (flutter/engine#54109)
This is required for OpenGL ES.

See https://registry.khronos.org/OpenGL/specs/es/3.2/GLSL_ES_Specification_3.20.html#precision-and-precision-qualifiers

https://github.com/flutter/flutter/issues/152297
2024-08-08 20:07:41 +00:00
Hannes Winkler
76e6e34bb5 Add EGL Surface backing store (flutter/engine#43683)
Allows using an EGL surface as a flutter backing store. Way more convenient for GBM than hacking gbm bo's into GL FBOs.

This resolves https://github.com/flutter/flutter/issues/58363

Currently, the embedder API assumes that the compositor (if it exists) will let flutter render into FBOs or Textures and then composite the whole thing onto the actual (EGL) window surface. I think this assumption is also documented a bit in https://github.com/flutter/flutter/issues/38466

However, in my case, I want let the hardware do the composition (using the linux KMS API), and render each flutter layer into it's own EGL surface.

It's possible to hack around this by creating your own GBM BOs, importing those as EGL images, then importing those as GL Render Buffers and attaching those to GL FBOs and that works (tested it). However, that's basically reimplementing 50% of the whole GBM/EGL "window" system integration for no reason.

This PR adds:
1. To the embedder API:
   - a new kind of OpenGL Backing store: `FlutterOpenGLSurface`
     - consisting of just a `make_current` and destruction callback (plus userdata)
     - the make_current callback should make the target surface current, i.e. `eglMakeCurrent(..., surf, surf)`
     - will be called by the engine before rendering onto the backing store
2. Some wiring to call make_current before rendering into the backing store

## TODO:

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-08-08 19:11:22 +00:00