291 Commits

Author SHA1 Message Date
Jonah Williams
b9d92a4d0c [Impeller] remove entity pass and re-combine canvas implementations. (flutter/engine#55019)
Shouldn't land until experimental canvas bakes a while

Major milestone along the route to making display list the impeller API. Removes the secondary compositor in entity pass. After this point, we can begin ripping out the DL->Aiks conversions and making entities more efficient.

Fixes https://github.com/flutter/flutter/issues/132417
Fixes https://github.com/flutter/flutter/issues/126386
Fixes https://github.com/flutter/flutter/issues/155114

Part of https://github.com/flutter/flutter/issues/142054
2024-09-26 21:20:23 +00:00
Jonah Williams
dd7948b2fe [Impeller] add basic culling checks during text frame dispatcher. (flutter/engine#55168)
Fixes https://github.com/flutter/flutter/issues/155133

Dl dispatching still relies on cull rects computed during that dispatch process. Make sure that the text frame dispatcher doesn't populate text frames that are way offscreen.

This culling is more conservative than the rendering dispatcher. We'd need to do some refactoring so the logic isn't repeated multiple times.
2024-09-24 23:37:06 +00:00
Jonah Williams
849f1d7170 [Impeller] Fix memory leak I introduced by fixing memory leak. (flutter/engine#55087)
If we don't reset host buffer then leak
2024-09-10 22:16:55 +00:00
Jonah Williams
f679a6aa54 [Impeller] fix obvious memory leak. (flutter/engine#55036)
Fixes https://github.com/flutter/flutter/issues/154549

Each overlay surface gets its own content context and each cc gets its own transient buffer. So not reseting the overlay surfaces causes a memory leak. The overlay surfaces would just continue to allocate into the same buffer which would allocate endlessly
2024-09-09 18:18:02 +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
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
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
Jonah Williams
67cc9696a8 [Impeller] Switch from AIKS canvas to DL based canvas implementation. (flutter/engine#53781)
The first part of switching Impeller/Aiks to using the display list instead of re-recording rendering operations. This should eventually let us cut CPU overhead of the raster thread for complex applications, though it should have no impact on GPU performance.

This does introduce a GLES only rendering bug that I haven't had luck tracking down, but is almost certainly due to switching to DL computed depth values. I'd like to handle this as a follow up when we prioritize GLES. https://github.com/flutter/flutter/issues/153504

Part of https://github.com/flutter/flutter/issues/142054
2024-08-15 19:03:43 +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
62a1ddeaee [Impeller] perform final blit and gpu end frame tracing earlier. (flutter/engine#54452)
Fixes the reported GPU time regression when rendering platform views. The problem was that we delayed the tracing of the end of the frame until the CATransaction, which artificially stretches out GPU frame time. Instead add a new method SurfaceMTL::PreparePResent which performs the final blit and tracing, call this in the encode callback.

Fixes: https://flutter-flutter-perf.skia.org/e/?queries=sub_result%3Daverage_gpu_frame_time%26test%3Dplatform_views_scroll_perf_ios__timeline_summary&selected=commit%3D41853%26name%3D%252Carch%253Dintel%252Cbranch%253Dmaster%252Cconfig%253Ddefault%252Cdevice_type%253DiPhone_11%252Cdevice_version%253Dnone%252Chost_type%253Dmac%252Csub_result%253Daverage_gpu_frame_time%252Ctest%253Dplatform_views_scroll_perf_ios__timeline_summary%252C

Test: benchmarks.
2024-08-08 19:46:04 +00:00
Jason Simmons
f0f2dd5a14 Directly include the Skia header that defines GrVkImageInfo (flutter/engine#54417)
See https://skia.googlesource.com/skia/+/5fb01f00262bbbef99571953fb5a987b0bed4d45
2024-08-08 00:05:38 +00:00
Jonah Williams
82c43d466a [iOS] Supported rendering platform views without merging the raster thread. (flutter/engine#53826)
Remove the need to merge raster and platform thread in the presence of platform views by defering UIView mutation and presentation of flutter views into separate platform thread task. Fixes priority inversion problem cause by platform thread blocking on drawable aquisition.

Open questions:

* Fixed ~What is a better interface for handling the partial submit with impeller. (TBD)~
* Fixed ~Update: We Don't | How do we fix this for Skia~ Fixed
* Fixed ~Update: Done, we post a task to the platform thread. Is there a shorter term solution for creating overlay layers on the raster thread.~ Fixed
* Fixed ~Update: seems to. Does this perform well enough (independent of platform/ui thread merge and w/ thread merge).~ Fixed

Fixes https://github.com/flutter/flutter/issues/142841
part of https://github.com/flutter/flutter/issues/150525
2024-08-01 20:40:12 +00:00
Jonah Williams
9650917c7e [engine] Split encode and submit into two different surface frame callbacks. (flutter/engine#54200)
This makes it much easier to implement the deferred submit required for https://github.com/flutter/engine/pull/53826
2024-07-30 19:58:21 +00:00
Jonah Williams
f2c5ad0b1e [Impeller] delete rasterizer class. (flutter/engine#54196)
The rasterizer class doesn't actually do anything besides call impeller::Surface to get the render target. lets just remove it. Simplifies refactores needed to make https://github.com/flutter/engine/pull/53826 work well.
2024-07-29 22:59:11 +00:00
Jonah Williams
80fd1f7fbf [iOS] Switch to FlutterMetalLayer by default. (flutter/engine#54086)
For this to work, we need to provide our own capture scope otherwise the default scope won't capture our commands.

This is required as part of the work to switch to unmerged threads for PVs (https://github.com/flutter/engine/pull/53826), as I can confirm @knopp 's observations that the performance is much worse with the default CAMetalLayer.

Fixes https://github.com/flutter/flutter/issues/140901
2024-07-24 23:10:11 +00:00
Jonah Williams
ef889f9d05 [Impeller] implement experimental canvas in snapshot controller. (flutter/engine#53750)
Fixes https://github.com/flutter/flutter/issues/150994

This ensures that the dart:ui API toImage and toImageSync use the experimental canvas API when the define is set. No other changes.
2024-07-09 19:19:57 +00:00
Jonah Williams
efbf7ddc57 [Impeller] mark the end of a frame boundary for system compositor interop. (flutter/engine#53722)
Fixes https://github.com/flutter/flutter/issues/151274

This is only an issue on iOS (so far) because of the platform view rendering strategy that involves submitting multiple impeller frames per compositor frame.

FYI @bdero
2024-07-04 03:48:17 +00:00
Jonah Williams
d152d7632f [Impeller] experimental canvas bdf support. (flutter/engine#53597)
Almost working bdf for experimentcal canvas.

Currently there are some problems with the clip depth, and positioning of the backdrop filter. I think I am not taking the blur transform into account at the very least.

FYI @bdero
2024-06-28 20:42:07 +00:00
Jonah Williams
b01c5c3002 [Impeller] wire up bdf and blend detection in experimental canvas. (flutter/engine#53151)
Use the flags in https://github.com/flutter/engine/pull/53104 + context capabilities to determine if we need to begin the first pass as an offscreen.

Part of https://github.com/flutter/flutter/issues/142054
2024-06-04 21:10:01 +00:00
Kaylee Lubick
a4db5f1ce4 Replace several calls to GrGLMakeNativeInterface with more direct APIs (flutter/engine#53064)
We are restructuring Skia and plan to remove GrGLMakeNativeInterface at
some point. This updates as many places as possible to use the direct
and explicit instantiation instead of having "Skia guess". This should
ideally not be changing behavior - if it does, then the PR should be
modified.

## 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.
- [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-05-30 08:14:53 -04:00
Brandon DeRosier
2ffd763cfb [Impeller] Reland: Remove Entity capture/AiksInspector. (flutter/engine#52932)
Resolves https://github.com/flutter/flutter/issues/134748.

This was a really fun experiment. I learned a lot from it, and it
genuinely helped me solve some coverage-related problems, but the
reality is it was too little too late -- by the time we had this
capture system, we had already solved most of the problems that would
have benefitted from this.

It's been a few months since I've used or extended the capabilities of
this capture system for something, and I don't have the spare
time/energy to give it the love it needs to realize the vision I had
for it. I still almost exclusively use a combination of native frame
captures and print debugging to solve problems.

RIP in peace.

This reverts commit 104eb98e62. (https://github.com/flutter/engine/pull/52680)
2024-05-21 00:59:14 +00:00
Chinmay Garde
f3934883b0 Delete Settings::msaa_samples. (flutter/engine#52780)
Fixes https://github.com/flutter/flutter/issues/148257
2024-05-13 23:51:11 +00:00
Chinmay Garde
f20b17a2ae [Impeller] Prepare a SkiaGPU-less iOS build. (flutter/engine#52748)
The size of the LTO build of the engine with the dylib compressed is as follows:

```sh
$ du -k libFlutter*
5236	libFlutter.dylib.tar.gz
4324	libFlutterSlimpeller.dylib.tar.gz
```

Sizes are in KiB. This represents a binary size reduction of 17.41% of the compressed artifacts. The compression ratios will likely differ based on the compression scheme.

Uncompressed, the sizes are:

```sh
$ du -k libFlutter*
16920	libFlutter.dylib
14044	libFlutterSlimpeller.dylib
```

This represents a binary size reduction of 16.99% which is in the same ballpark.

The really mucky bit was backing out the raster cache and persistent cache. I want to clean that up in a later patch so that those TUs are part of a separate submodule.

Opting out of Impeller will lead to a fatal log at startup saying the opt-out is disallowed.

Fixes https://github.com/flutter/flutter/issues/126606
2024-05-13 21:43:47 +00:00
gaaclarke
104eb98e62 Revert 7130c5c3b3f16d549bca6b81c51c751780c454d4 (flutter/engine#52680)
reverts https://github.com/flutter/engine/pull/52526
fixes https://github.com/flutter/flutter/issues/147989

That PR has broken playgrounds.  It's non essential so we can revert it an bdero can take a look whenever he gets another chance.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-05-08 18:27:32 +00:00
Jonah Williams
0fefa45af5 [Impeller] support requires readback from onscreen texture in experimental canvas. (flutter/engine#52640)
This doesn't yet add support for backdrop filters or emulated advanced blends, but will allow them to work if `surface_frame.framebuffer_info().supports_readback` is true.

part of https://github.com/flutter/flutter/issues/142054
2024-05-08 05:06:09 +00:00
Brandon DeRosier
7130c5c3b3 [Impeller] Remove Entity capture/AiksInspector. (flutter/engine#52526)
Resolves https://github.com/flutter/flutter/issues/134748.

This was a really fun experiment. I learned a lot from it, and it genuinely helped me solve some coverage-related problems, but the reality is it was too little too late -- by the time we had this capture system, we had already solved most of the problems that would have benefitted from this.

It's been a few months since I've used or extended the capabilities of this capture system for something, and I don't have the spare time/energy to give it the love it needs to realize the vision I had for it. I still almost exclusively use a combination of native frame captures and print debugging to solve problems.

RIP in peace.
2024-05-03 01:08:22 +00:00
Jim Graham
2f1254623a [Impeller] Use the new DisplayList depth info in the experimental canvas prototype (flutter/engine#52214)
Plumbing the new DL depth data into the experimental direct rendering Impeller canvas prototype.
2024-04-19 18:35:06 +00:00
Jonah Williams
bccb307c2c [Impeller] Off by default experimental canvas. (flutter/engine#52035)
Canvas implementation that renders directly, requires ENABLE_EXPERIMENTAL_CANVAS to be set to true and only wired up for android/vulkan.

Currently missing:
* Clips
* backdrop filters
* opacity peephole
* More?

This will eventually allow us to delete the aiks layer and cut out most conversion costs. Part of https://github.com/flutter/flutter/issues/142054
2024-04-17 22:38:16 +00:00
K Lubick
4ec8483024 Use moved GrBackendTexture factories for Skia's Metal backend (flutter/engine#51828)
In https://skia-review.googlesource.com/c/skia/+/833302, Skia moved the
constructors for Metal versions of GrBackendTexture (and other
functions/methods). This updates uses in Flutter to use the new APIs.

## 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.
- [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-04-02 11:49:15 -04:00
Jonah Williams
b18dfd5fa7 [Impeller] add missing null check. (flutter/engine#51711)
surface can return null if we failed to allocate MSAA or depth/stencil textures.
2024-03-27 17:55:04 +00:00
K Lubick
95d17af1aa Migrate use of deprecated GrDirectContext::MakeMetal (flutter/engine#51537)
This was deprecated in https://skia-review.googlesource.com/c/skia/+/826397. Furthermore, some metal files were relocated, so this changes those also.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-03-20 18:07:33 +00:00
Jason Simmons
c0159abf1b Implement the render_to_surface flag in GPUSurfaceGLImpeller (flutter/engine#50669)
Without this, the EmbedderExternalViewEmbedder's call to SurfaceFrame::Submit will render an empty display list that will overwrite the output rendered by the external view embedder's layers.

See https://github.com/flutter/flutter/issues/143387
2024-02-20 19:27:09 +00:00
Dan Field
b763483b43 [Impeller] Do not reference this in the submit callback for Metal GPU Surfaces (flutter/engine#50361)
Fixes https://github.com/flutter/flutter/issues/141351 (speculatively - I have not directly reproduced this in an application, but without this change the added test crashes with a segfault in the submit callback).

If the rasterizer gets torn down, the surface gets released and the submit callback may fire on a collected object. Capturing `this` isn't safe. I'm not quite sure how that could happen from the linked stack trace though, since the draw call and the teardown call should be happening on the raster thread, and if the surface was reset then the draw call should've failed earlier...

The added test causes a segfault without the change.
2024-02-05 20:58:17 +00:00
Jonah Williams
c18d6e3a08 [Impeller] reland: write directly to device buffer. (flutter/engine#49691)
Reland of https://github.com/flutter/engine/pull/49505

---

part of https://github.com/flutter/flutter/issues/140804

We can't use the existing host buffer abstraction as that requires us to collect all allocations up front. By itself, this isn't sufficient for #140804 , because we'll need a way to mark ranges as dirty and/or flush if we don't have host coherent memory. But by itself this change should be beneficial as we'll create fewer device buffers and should do less allocation in general.

The size of the device buffers is 1024 Kb, somewhat arbitrarily chosen.
2024-01-10 22:10:03 +00:00
auto-submit[bot]
6236178dac Reverts "[Impeller] have Hostbuffer write directly to block allocated device buffers." (flutter/engine#49688)
Reverts flutter/engine#49505
Initiated by: jonahwilliams
This change reverts the following previous change:
Original Description:
part of https://github.com/flutter/flutter/issues/140804

We can't use the existing host buffer abstraction as that requires us to collect all allocations up front. By itself, this isn't sufficient for #140804 , because we'll need a way to mark ranges as dirty and/or flush if we don't have host coherent memory. But by itself this change should be beneficial as we'll create fewer device buffers and should do less allocation in general.

The size of the device buffers is 1024 Kb, somewhat arbitrarily chosen.
2024-01-10 21:09:18 +00:00
Jonah Williams
eaae4c5d1a [Impeller] have Hostbuffer write directly to block allocated device buffers. (flutter/engine#49505)
part of https://github.com/flutter/flutter/issues/140804

We can't use the existing host buffer abstraction as that requires us to collect all allocations up front. By itself, this isn't sufficient for #140804 , because we'll need a way to mark ranges as dirty and/or flush if we don't have host coherent memory. But by itself this change should be beneficial as we'll create fewer device buffers and should do less allocation in general.

The size of the device buffers is 1024 Kb, somewhat arbitrarily chosen.
2024-01-10 17:18:07 +00:00
Jim Graham
91806f60d6 [Impeller] Make Rect origin and size fields private (flutter/engine#49168)
Make the implementation fields of Rect private in preparation for switching its internal operations from XYWH to LTRB fields.
2023-12-18 22:48:10 +00:00
Matan Lurey
02f6c46771 Fix header-guard naming convention in shell/. (flutter/engine#49006)
Part of landing https://github.com/flutter/engine/pull/48903.

Some of these actually seem like potential owchy spots, i.e. `#ifndef FLUTTER_FLUTTER_H_`.
2023-12-14 23:37:22 +00:00
Dan Field
28fbba2098 Delete unused/test only code from FML (flutter/engine#48327)
This is more-or-less a revert of https://github.com/flutter/engine/pull/14011

This code never ended up being used outside of tests, and it's not how we handle asset loading at this point anyway.

I was hopeful we could kill off all runtime dependencies on Dart in `FML` when looking at this, but it looks like trace_event.h still wants to import dart_api_tools.h for some Dart enum types. This may or may not matter if we ever want to build FML for web/wasm. /cc @eyebrowsoffire. If we really need to do that, we can refactor the trace event stuff so that it has a web and Dart implementation that's selected at build time.
2023-11-22 20:49:56 +00:00
Jonah Williams
5dd5cd253a [Impeller] null check drawable. (flutter/engine#47488)
Speculative fix for the first crash noted in https://github.com/flutter/flutter/issues/136628#issue-1944779964

nextDrawble can return null if the method times out.

Fixes https://github.com/flutter/flutter/issues/136525
2023-11-08 16:35:03 +00:00
Zachary Anderson
e24e3b5746 Don't use Skia BUILD.gn files (flutter/engine#47677)
The new `BUILD.gn` files in the Engine tree can't go under
`build/secondary` because Skia still has its own, and they'd be selected
first. So, this PR puts the new `BUILD.gn` files under `flutter/skia`.
2023-11-07 11:12:29 -08:00
Jason Simmons
fa02835346 [Impeller] Use a weak pointer factory in GPUSurfaceGLImpeller that supports the raster thread merger (flutter/engine#47081)
This is required for platform view scenarios that merge the raster task runner into the platform thread.
2023-10-19 20:22:04 +00:00
Dan Field
1e318d57d4 [Impeller] flutter_tester --enable-impeller (flutter/engine#46389)
This patch does the following:

- Updates `flutter_tester` to set up an Impeller rendering context and surface if `--enable-impeller` is set to true, using the Vulkan backend with Swiftshader.
- Updates `run_tests.py` to run all tests except the smoke test (that one really has no rendering impact whatsoever) with and without `--enable-impeller`.
- Updates a few tests to work that were trivial:
  - A couple tests needed updated goldens for very minor rendering differences. Filed https://github.com/flutter/flutter/issues/135684 to track using Skia gold for this instead.
  - Disabled SKP screenshotting if Impeller is enabled, and updated the test checking that to verify an error is thrown if an SKP is requested.
  - The Dart GPU based test now asserts that the gpu context is available if Impeller is enabled, and does not deadlock if run in a single threaded mode.
  - We were missing some trace events around `Canvas::SaveLayer` for Impeller as compared to Skia.
  - A couple other tests had strict checks about exception messages that are slightly different between Skia and Impeller.
- I've filed bugs for other tests that may require a little more work, and skipped them for now. For FragmentProgram on Vulkan I reused an existing bug.

This is part of my attempt to address https://github.com/flutter/flutter/issues/135693, although @chinmaygarde and I had slightly different ideas about how to do this.

The goals here are:

- Run the Dart unit tests we already have with Impeller enabled.
- Enable running more of the framework tests (including gold tests) with Impeller enabled.
- Run all of these tests via public `dart:ui` API rather than mucking around in C++ internals in the engine.
2023-10-11 21:42:24 +00:00
AJI
86b582a6bc Fix damage calculation when not providing populate_existing_damage for gl embedder (flutter/engine#45611)
# Description

This PR fixes the `gl_populate_existing_damage` in embedder.cc, which currently returns an empty rectangle when a full repaint is needed. This leads to the `frame_damage` being considered empty in rasterizer.cc, causing incorrect partial repaint within Flutter when `gl_populate_existing_damage` is not provided by the embedder.

# Related Issue

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

# Tests

Add a new test. Also fixes damage calculation related tests in EmbedderTest by

* Use a new Dart embedder fixture entry point `render_gradient_retained` which retains the old layer to make sure layer tree diff happens.
* Add `latch.Wait()` after `SetGLPresentCallback` to make sure assertions have been executed.
* Make `existing_damage_rects` static since it should be valid after `populate_existing_damage` returns.
2023-09-28 20:06:51 +00:00
Kevin Lubick
8656e6b1d4 Update to use GrDirectContexts::MakeGL (flutter/engine#46308)
This was added in https://skia-review.googlesource.com/c/skia/+/760017
and the old versions were deprecated.

## 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].
- [ ] 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
2023-09-27 10:17:05 -04:00
Kevin Lubick
7da278b05b Migrate GrMipmapped->skgpu::Mipmapped (flutter/engine#45881)
Skia's Graphite and Ganesh backend coalesced two enums regarding mipmaps
into one and deprecated the public Ganesh version. This migrates Flutter
to use the preferred type.

No functional changes expected. See also
https://skia-review.googlesource.com/c/skia/+/753567

## 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
2023-09-15 11:48:20 -04:00
Brian Osman
c11672e29a Migrate VK calls of GrBackend* (flutter/engine#45325)
In https://skia-review.googlesource.com/c/skia/+/742797 Skia refactored
GrBackend* to not require #ifdefs. This changes
callsites in Flutter to use static functions instead of methods that
were conditionally compiled on those classes.

There should be no functional change.
2023-08-31 14:15:17 -04:00
Zachary Anderson
aad0b0f680 Revert dl split (flutter/engine#45326)
Reverting for https://github.com/flutter/flutter/issues/133525
fixes: https://github.com/flutter/engine/pull/45326
2023-08-31 17:46:12 +00:00
Dan Field
ffa16ec08f [Impeller] Reland DlAiksCanvas (flutter/engine#45232)
Relands https://github.com/flutter/engine/pull/45131

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

Differences from last time:

- Some minor merge conflict fixes
- Use the RTree to get the bounds instead of recalculating the bounds
- Make the iOS platform view controller implementation use the impeller-aware slices instead of the display list ones. This has been fixed for Android and the desktop embedding, but I missed iOS. The unit tests weren't actually running before I branched for my PR, @zanderso fixed them up separately and this resulted in catching the failures on post submit last time.
2023-08-31 00:29:23 +00:00
Jonah Williams
a04635d9e6 Revert "[Impeller] DlAiksCanvas as a DlCanvas wrapper for impeller::Canvas" (flutter/engine#45149)
Reverts flutter/engine#45131

This is failing the Impeller variants of the unobstructed platform views tests:

https://ci.chromium.org/ui/p/flutter/builders/prod/Mac%20Production%20Engine%20Drone/132249/overview

```
Failing tests:
	-[UnobstructedPlatformViewTests testPlatformViewsMaxOverlays]
	-[UnobstructedPlatformViewTests testOneOverlay]
	-[UnobstructedPlatformViewTests testOneOverlayPartialIntersection]
	-[UnobstructedPlatformViewTests testTwoIntersectingOverlays]
	-[UnobstructedPlatformViewTests testOneOverlayAndTwoIntersectingOverlays]

** TEST FAILED **
```

We've retried it a few times so I suspect this isn't a flake.
2023-08-26 19:31:39 +00:00