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.
This is a reland of https://github.com/flutter/engine/pull/44248
Fixes https://github.com/flutter/flutter/issues/132416
Changes from last time:
- The `drawPoints` benchmark was failing to render anything meaningful because of an error in `AiksLayer` that resulted in an infinitely sized bounding rectangle poisoning the bounds with `NaN` (this happens, for example, with a `drawPaint` call, which that benchmark happens to use). Added a test covering this and filed https://github.com/flutter/flutter/issues/132770 to explore ways to avoid this in the future.
- There was a bug in `DlAiksCanvas::SaveLayer` where a `nullptr` `paint` but non-`nullptr` `backdrop` was failing to actually save the layer. This resulted in incorrect rendering.
- There was a bug in `impeller::Canvas::DrawPicture` that resulted in incorrect stencil depth counting. That was fixed separately by @bdero, but was the cause of incorrect rendering in some Wonderous screens.
- I've added a simple implementation for `AiksLayer::IsReplacing`. It does not currently compare as deeply as the `DisplayListLayer` version potentially does, but it is good enough to avoid the regression noted in https://github.com/flutter/flutter/issues/132071. That regression was on a benchmark that greatly benefits from partial repaint. With the new implementation, it still gains partial repaint where it previously did not. There is more work that can be done here, filed https://github.com/flutter/flutter/issues/133361 to track that work.
I merged but did not fully integrate the `DisplayListBuilder`/`CanvasToReceiver` work that @flar has done. I have a local experiment with that, but would prefer to see this land and run through the device lab so we get some better comparison numbers for which one performs better.
## Description
This PR completes the documentation for `RasterStatus::kSkipAndRetry` in the `compositor_context.h` file. The previous comment ended abruptly, leaving ambiguity regarding the behavior when the thread merger is disabled.
### Changes:
- Added clarification on the behavior when the thread merger is disabled.
- Explained the potential performance implications when threads are not merged.
## Related Issues
https://github.com/flutter/flutter/issues/131814
## Tests
No tests were added as this PR only involves documentation changes.
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Reverts flutter/engine#45097
Many failures on CI like:
```
ld: warning: ignoring file ../../../../out/ios_debug_sim_arm64_extension_safe/libocmock_shared.dylib, building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64
ld: warning: ignoring file ../../../../out/ios_debug_sim_arm64_extension_safe/libios_test_flutter.dylib, building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64
```
https://ci.chromium.org/ui/p/flutter/builders/prod/Mac%20Production%20Engine%20Drone/131188/overview
Not sure if there are also other tests failing in different ways.
We call allocateAndBindDescriptorSets once for every cmd rendered, so this time can bubble up quite a bit. From the traces I've gathered map emplacement (emplace_unique_key_args) and std::vector growth (__push_back_slow_path) contribute the most to this trace.
I think we have physical limits on the number of descriptors we can bind, though I'm not sure if we enforce that anywhere?
This refactor makes recycling render passes easier since it starts to
split out setting the layout of textures with creating the render pass
description.
I didn't fully implement the split since it would technically be slower.
Until we get caching of render passes working it would require us to
calculate the attachment descriptions twice, once to make the render
pass and once to set the texture layout.
teases out some of the work from:
https://github.com/flutter/engine/pull/44527
in the service of implementing:
https://github.com/flutter/engine/pull/44861
issue: https://github.com/flutter/flutter/issues/133182
The final split will have this function for recycled render passes:
```c++
void SetTextureLayouts(const RenderTarget& render_target,
const std::shared_ptr<CommandBufferVK>& command_buffer) {
for (const auto& [bind_point, color] : render_target.GetColorAttachments()) {
SetTextureLayout(color,
CreateAttachmentDescription(color, &Attachment::texture),
command_buffer, &Attachment::texture);
if (color.resolve_texture) {
SetTextureLayout(
color,
CreateAttachmentDescription(color, &Attachment::resolve_texture),
command_buffer, &Attachment::resolve_texture);
}
}
if (auto depth = render_target.GetDepthAttachment(); depth.has_value()) {
SetTextureLayout(
depth.value(),
CreateAttachmentDescription(depth.value(), &Attachment::texture),
command_buffer, &Attachment::texture);
}
if (auto stencil = render_target.GetStencilAttachment();
stencil.has_value()) {
SetTextureLayout(
stencil.value(),
CreateAttachmentDescription(stencil.value(), &Attachment::texture),
command_buffer, &Attachment::texture);
}
}
```
## 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 Hixie said 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
[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
Reverts flutter/engine#45029
It appears this is causing a regression in the length of time some of our integration tests are taking, causing them to take twice as long, which is causing timeouts in CI. We should revert while we investigate.
This flag removes some code from CanvasKit to reduce size by a little bit. I went ahead and did a run of the benchmarks (https://github.com/flutter/flutter/pull/133208) to see if it negatively affected anything, and there was no difference beyond noise between the current benchmark numbers and the benchmarks with this flag enabled.
The size differences are as follows:
Before the change:
```
total 30616
drwxr-xr-x 11 jacksongardner primarygroup 352 Aug 23 14:33 .
drwxr-xr-x 7 jacksongardner primarygroup 224 Aug 10 18:14 ..
-rw-r--r--@ 1 jacksongardner primarygroup 6148 May 12 17:41 .DS_Store
-rw-r--r-- 2 jacksongardner primarygroup 94899 Aug 23 14:23 canvaskit.js
-rwxr-xr-x 2 jacksongardner primarygroup 6631693 Aug 23 14:23 canvaskit.wasm
-rwxr-xr-x 1 jacksongardner primarygroup 2102151 Aug 23 14:23 canvaskit.wasm.br
drwxr-xr-x 5 jacksongardner primarygroup 160 Aug 23 14:33 chromium
-rw-r--r-- 2 jacksongardner primarygroup 161478 Aug 23 14:28 skwasm.js
-rwxr-xr-x 2 jacksongardner primarygroup 3296038 Aug 23 14:28 skwasm.wasm
-rwxr-xr-x 1 jacksongardner primarygroup 1101502 Aug 23 14:28 skwasm.wasm.br
-rw-r--r-- 2 jacksongardner primarygroup 3095 Aug 23 14:28 skwasm.worker.js
./chromium:
total 15520
drwxr-xr-x 5 jacksongardner primarygroup 160 Aug 23 14:33 .
drwxr-xr-x 11 jacksongardner primarygroup 352 Aug 23 14:33 ..
-rw-r--r-- 2 jacksongardner primarygroup 94545 Aug 23 14:25 canvaskit.js
-rwxr-xr-x 2 jacksongardner primarygroup 5223378 Aug 23 14:25 canvaskit.wasm
-rwxr-xr-x 1 jacksongardner primarygroup 1492433 Aug 23 14:25 canvaskit.wasm.br
```
After the change:
```
total 28568
drwxr-xr-x 11 jacksongardner primarygroup 352 Aug 23 14:42 .
drwxr-xr-x 7 jacksongardner primarygroup 224 Aug 10 18:14 ..
-rw-r--r--@ 1 jacksongardner primarygroup 6148 May 12 17:41 .DS_Store
-rw-r--r-- 2 jacksongardner primarygroup 94899 Aug 23 14:37 canvaskit.js
-rwxr-xr-x 2 jacksongardner primarygroup 6401703 Aug 23 14:37 canvaskit.wasm
-rwxr-xr-x 1 jacksongardner primarygroup 2038390 Aug 23 14:37 canvaskit.wasm.br
drwxr-xr-x 5 jacksongardner primarygroup 160 Aug 23 14:42 chromium
-rw-r--r-- 2 jacksongardner primarygroup 161478 Aug 23 14:41 skwasm.js
-rwxr-xr-x 2 jacksongardner primarygroup 3143431 Aug 23 14:41 skwasm.wasm
-rwxr-xr-x 1 jacksongardner primarygroup 1050854 Aug 23 14:41 skwasm.wasm.br
-rw-r--r-- 2 jacksongardner primarygroup 3095 Aug 23 14:41 skwasm.worker.js
./chromium:
total 15392
drwxr-xr-x 5 jacksongardner primarygroup 160 Aug 23 14:42 .
drwxr-xr-x 11 jacksongardner primarygroup 352 Aug 23 14:42 ..
-rw-r--r-- 2 jacksongardner primarygroup 94545 Aug 23 14:39 canvaskit.js
-rwxr-xr-x 2 jacksongardner primarygroup 4993586 Aug 23 14:39 canvaskit.wasm
-rwxr-xr-x 1 jacksongardner primarygroup 1427979 Aug 23 14:39 canvaskit.wasm.br
```
The brotli-compressed wasm modules save about 50-70kb each with this flag.