DisplayList by default contains Skia paths stored as `SkPath` objects. Impeller must convert these to its internal `impeller::Path` format on every dispatch of the DisplayList on every frame.
This change allows Impeller to store a cached copy of its version of the path into the DisplayList and reuse that instance if it ever encounters the same DisplayList again (likely to happen as most paths come from the Framework which does a lot of work to re-use ui.Picture objects - i.e. DisplayLists).
In order to facilitate this change, `impeller::Path` was modified to have fast-copy-constructors that share the data and the PathBuilder will copy the mutable data into an immutable version in `TakePath()`.
Reverts flutter/engine#50028
Initiated by: jonahwilliams
This change reverts the following previous change:
Original Description:
Once a hardware buffer has been imported (a VkImage created for it), we don't ever need to re-create a VkImage, even when the contents change. The same hardware buffer can be identified by ID. Part of https://github.com/flutter/flutter/issues/142153
Otherwise we spend a lot of time re-creating VkImages:

Draft is here, but is currently leaky: https://github.com/flutter/engine/pull/50028
We only need something like a LRU with the max image size (seems to be 3 for me). This does log locally that I'm not calling close correctly:
```
E/flutter ( 5580): [ERROR:flutter/shell/platform/android/image_external_texture_vk.cc(51)] Size: 3
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
```
FYI @johnmccutchan
Once a hardware buffer has been imported (a VkImage created for it), we don't ever need to re-create a VkImage, even when the contents change. The same hardware buffer can be identified by ID. Part of https://github.com/flutter/flutter/issues/142153
Otherwise we spend a lot of time re-creating VkImages:

Draft is here, but is currently leaky: https://github.com/flutter/engine/pull/50028
We only need something like a LRU with the max image size (seems to be 3 for me). This does log locally that I'm not calling close correctly:
```
E/flutter ( 5580): [ERROR:flutter/shell/platform/android/image_external_texture_vk.cc(51)] Size: 3
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
W/System ( 5580): A resource failed to call HardwareBuffer.close.
```
FYI @johnmccutchan
Closes https://github.com/flutter/flutter/issues/133415.
This includes a performance optimization for the runner itself, where
`--include=...`s are used as a base to check, versus checking _every_
file and seeing if it exists in a list. This works better with what is
expected in `ci/bin/format.dart` without any contract change.
Also added a few more functional tests of the system.
Changes since last roll
```
58665e3dee4 Version 3.4.0-79.0.dev
6b0b4d425b0 Macro. Keep FileState for macro file, refresh if its content changes.
f4c3572c18a [deps] Rev `native` packages.
f4dae883559 [co19] Roll co19 to af2ac968c0ca28b7dd94325b00a3acf569f6e858
e2aac0b8e86 [web docs] add package:web to the main sdk docs - api.dart.dev
3d4a39e9c24 Revert "Revert two CLs that remove WithoutNullSafetyMixin usages."
20a27fee111 Fix for data driven rename when class is used in as expression
ecb5fc2228a [dart2wasm] Improve dispatch table packing from 49% to 99%
cdad90dfb81 [frontend_server] frontend_server_flutter_suite
```
Requires manual roll due to ffi package move as part of `f4c3572c18a`.
Adds two new APIs that insert memory barriers for compute -> compute dependencies.
```c++
// |ComputePass|
void AddBufferMemoryBarrier() override;
// |ComputePass|
void AddTextureMemoryBarrier() override;
```
Also makes the ComputePassVK automatically insert a compute -> vertex dependency when encoding. This change is sufficient to let the GPU compute implementation of draw points work on Pixel and Samsung Android devices.
For more explaination on these specific barriers, see the documentation added in this PR.
Fixes https://github.com/flutter/engine/pull/49946
Closes https://github.com/flutter/flutter/issues/133415.
---
This is a prototype I threw together in about 1-2 hours. It enforces and
automatically fixes header guards that don't match the [the Google C++
style
guide](https://google.github.io/styleguide/cppguide.html#The__define_Guard).
For example, here is (trimmed) output at HEAD:
```txt
line 5, column 1 of impeller/aiks/picture.h: Unexpected #pragma once
╷
5 │ #pragma once
│ ^^^^^^^^^^^^
╵
line 5, column 1 of flow/stopwatch.h: Expected #ifndef FLUTTER_FLOW_STOPWATCH_H_
╷
5 │ #ifndef FLUTTER_FLOW_INSTRUMENTATION_H_
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
The following 731 files have invalid header guards:
```
When a view gets disposed of, its rasterizer completely clears up the singleton `PlatformViewManager`. Particularly, it removes all registered platform view factories.
This is wrong because the remaining PlatformViews on the page cannot be re-rendered, and the default Platform View factories (used by `pointer_interceptor`, for example), disappear.
This PR attempts to preserve the `dispose` logic of the canvaskit rasterizer, without using the `debugClear` method of the `PlatformViewManager` (which is supposedly test-only).
## Issues
* Fixes https://github.com/flutter/flutter/issues/142094
## Tests
* Added unit-test
* Deployed demo app: https://dit-maps-tests.web.app
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Generated by https://github.com/flutter/engine/pull/48903 (`dart ./tools/header_guard_check/bin/main.dart --fix`).
As discussed with @cbracken and @jmagman, the guards are not technically needed on the Mac/iOS code, but they (a) do not hurt and (b) still provide value if for some reason `#include` is used instead of `#import` (though I suspect we could try to add that to the tool in the future as well).
Fixes https://github.com/flutter/flutter/issues/141571
Shell::Screenshot was impelemnted in a Skia-only way and would crash when invoked. Adds test coverage for the breaking path on iOS that ends up calling `FlutterView drawLayer`.
Adds a Dart API so Application/Plugin programmers can retrieve the `initialData` configuration value that may be passed when adding a view from JS in a multiViewEnabled app.
When adding a view to an app like this:
```js
flutterApp.addView({
hostElement: someElement,
initialData: {
randomUUID: globalThis.crypto.randomUUID(),
}
});
```
`initialData` can be accessed from Dart by defining a JS-interop class like:
```dart
import 'dart:js_interop';
// The JS-interop definition of the `initialData` object passed to the views of this app.
@JS()
@staticInterop
class InitialData {}
/// The attributes of the [InitialData] object.
extension InitialDataExtension on InitialData {
external String? get randomUUID;
}
```
And then, from the code of the application:
```dart
...
Widget build(BuildContext context) {
final int viewId = View.of(context).viewId;
final InitialData? data = ui_web.views.getInitialData(viewId) as InitialData?;
return Text('${data?.randomUUID}');
}
...
```
## Testing
Will add unit tests once naming is sorted out :)
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
- ImageReaderSurfaceProducer no longer drops frames when the producer
and the consumers are up to two frames out of sync.
- Have the native C++ side of the Android external textures check if a
new frame has been pushed and that the texture needs to be updated. This
avoids having to schedule a task on the raster thread for each updated
texture.
- Notify the engine earlier that a frame is needed when updating a TLHC
texture.
- Reland fix: Call SurfaceTextureExternalTexture::ProcessFrame if
dl_image_ is null.
Reverts flutter/engine#50033
Initiated by: zanderso
This change reverts the following previous change:
Original Description:
- ImageReaderSurfaceProducer no longer drops frames when the producer and the consumers are up to two frames out of sync.
- Have the native C++ side of the Android external textures check if a new frame has been pushed and that the texture needs to be updated. This avoids having to schedule a task on the raster thread for each updated texture.
- Notify the engine earlier that a frame is needed when updating a TLHC texture.
The AppKit state machine was not well understood before. Sometimes the engine would leave orphan PanZoomStart after a certain sequences including NSEventPhaseMayBegin
Now track each gesture's specific phase instead of boolean true/false which doesn't really accurately represent the system state.
Fixes https://github.com/flutter/flutter/issues/140730
FIxes https://github.com/flutter/flutter/issues/136622
- ImageReaderSurfaceProducer no longer drops frames when the producer
and the consumers are up to two frames out of sync.
- Have the native C++ side of the Android external textures check if a
new frame has been pushed and that the texture needs to be updated. This
avoids having to schedule a task on the raster thread for each updated
texture.
- Notify the engine earlier that a frame is needed when updating a TLHC
texture.
Potentially fixes https://github.com/flutter/flutter/issues/141495
The texture used as a render target attachment can have miplevels, but
the image view cannot. Unconditionally create two image views per
texture (this could be optimized in some cases), where the specific
"render target texture view" always sets a mipcount of 1.
In theory this should allow us to generate mipmaps for textures that are
used as render target attachments, including toImage and toImageSync
textures which are currently missing this functionality.
---------
Co-authored-by: Aaron Clarke <aaclarke@google.com>
Co-authored-by: gaaclarke <30870216+gaaclarke@users.noreply.github.com>
Now that host buffer writes go directly to device buffers, there is no advantage to creating dedicated device buffers for the vertices contents.
Fixes https://github.com/flutter/flutter/issues/141202