1724 Commits

Author SHA1 Message Date
Brandon DeRosier
ba21393f49 Drop APNG frames that don't fit entirely within the destination surface. (flutter/engine#56928)
As per the [spec](https://www.w3.org/TR/png/#fcTL-chunk):

> The frame must be rendered within the region defined by x_offset, y_offset, width, and height. This region may not fall outside of the default image; thus x_offset plus width must not be greater than the [IHDR](https://www.w3.org/TR/png/#11IHDR) width; similarly y_offset plus height must not be greater than the [IHDR](https://www.w3.org/TR/png/#11IHDR) height.
2024-12-05 09:34:32 +00:00
Robert Ancell
fd12f3489c Remove LSAN supressions for Linux embedder (flutter/engine#56913)
Fixes https://github.com/flutter/flutter/issues/90155
2024-12-05 11:44:08 +13:00
LongCatIsLooong
18cf7ae0a7 Reland "[iOS] Full keyboard access scrolling (#56606)" (flutter/engine#56842)
Reverts flutter/engine#56802

https://github.com/flutter/flutter/pull/159517 should address the engine roll failure.

I'm not planning to land this until the coming Monday.
2024-12-02 21:53:21 +00:00
Jim Graham
0c245ce56b [DisplayList] Delete (publicly) unused DlColorColorSource (flutter/engine#56825)
While recently updating the DlColorSource sources I noticed some questionably implementation choices in the Color variant of the color sources.

I then realized that there was no public use of these classes (other than mostly their own unit tests) and so they should be deleted to focus on implementing the variants that are actually used by Flutter.
2024-11-27 00:13:22 +00:00
Jim Graham
2a55c9edd8 [DisplayList] migrate DlColorFilter objects to new source layout (flutter/engine#56785)
A new source code/header structure was introduced when the DlColorSource and DlImageFilter objects were migrated to Impeller geometry classes. Even though the DlColorFilter objects did not depend on Skia geometry objects, they need to be updated to the new source layout for consistency.
2024-11-26 20:48:20 +00:00
auto-submit[bot]
57b102520b Reverts "[iOS] Full keyboard access scrolling (#56606)" (flutter/engine#56802)
Reverts: flutter/engine#56606
Initiated by: LongCatIsLooong
Reason for reverting: https://github.com/flutter/flutter/issues/159456
Original PR Author: LongCatIsLooong

Reviewed By: {chunhtai, cbracken}

This change reverts the following previous change:
This PR adds basic FKA scrolling support: when the iOS focus (the focus state is maintained separately from the framework focus, see the previous PR) switches to an item in a scrollable container that is too close to the edge of the viewport, the container will scroll to make sure the next item is visible. 

Previous PR for context: https://github.com/flutter/engine/pull/55964

https://github.com/user-attachments/assets/84ae5153-f955-4d23-9901-ce942c0e98ac

### Why the UIScrollView subclass in the focus hierarchy

The iOS focus system does not provide an API that allows apps to notify it of focus highlight changes. So if we were to keep using the transforms sent by the framework as-is and not introducing any UIViews in the focus hierarchy, the focus highlight will be positioned at the wrong location after scrolling (via FKA or via framework). That does not seem to be part of the public API and the focus system seems to only know how to properly highlight focusable UIViews.

### Things that currently may not work

1. Nested scroll views (have not tried to verify) 

The `UIScrollView`s are always subviews of the `FlutterView`. If there are nested scrollables the focus system may not be able to properly determine the focus hierarchy (in theory the iOS focus system should never depend on `UIView.parentView` but I haven't tried to verify that).

2. If the next item is too far below the bottom of the screen and there is a tab bar with focusable items, the focus will be transferred to tab bar instead of the next item in the list

Video demo (as you can see the scrolling is really finicky):

https://github.com/user-attachments/assets/51c2bfe4-d7b3-4614-aa49-4256214f8978

I've tried doing the same thing using a `UITableView` with similar configurations but it seems to have the same problem. I'll try to dig a bit deeper into this and see if there's a workaround.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-11-26 00:39:15 +00:00
LongCatIsLooong
8a1d4c0a08 [iOS] Full keyboard access scrolling (flutter/engine#56606)
This PR adds basic FKA scrolling support: when the iOS focus (the focus state is maintained separately from the framework focus, see the previous PR) switches to an item in a scrollable container that is too close to the edge of the viewport, the container will scroll to make sure the next item is visible. 

Previous PR for context: https://github.com/flutter/engine/pull/55964

https://github.com/user-attachments/assets/84ae5153-f955-4d23-9901-ce942c0e98ac

### Why the UIScrollView subclass in the focus hierarchy

The iOS focus system does not provide an API that allows apps to notify it of focus highlight changes. So if we were to keep using the transforms sent by the framework as-is and not introducing any UIViews in the focus hierarchy, the focus highlight will be positioned at the wrong location after scrolling (via FKA or via framework). That does not seem to be part of the public API and the focus system seems to only know how to properly highlight focusable UIViews.

### Things that currently may not work

1. Nested scroll views (have not tried to verify) 

The `UIScrollView`s are always subviews of the `FlutterView`. If there are nested scrollables the focus system may not be able to properly determine the focus hierarchy (in theory the iOS focus system should never depend on `UIView.parentView` but I haven't tried to verify that).

2. If the next item is too far below the bottom of the screen and there is a tab bar with focusable items, the focus will be transferred to tab bar instead of the next item in the list

Video demo (as you can see the scrolling is really finicky):

https://github.com/user-attachments/assets/51c2bfe4-d7b3-4614-aa49-4256214f8978

I've tried doing the same thing using a `UITableView` with similar configurations but it seems to have the same problem. I'll try to dig a bit deeper into this and see if there's a workaround.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-11-25 21:05:18 +00:00
Jonah Williams
8aabbdf368 [Impeller] delete Impeller sim opt out. (flutter/engine#56706)
Impeller only on simulators.
2024-11-22 21:10:00 +00:00
Jim Graham
dee413e427 [DisplayList] migrate DlColorSource objects to Impeller geometry (flutter/engine#56735)
The DlColorSource code uses Skia geometry classes for its internal computations. This PR switches those implementations to use the Impeller geometry classes for consistency and 3rd party header file independence.
2024-11-22 20:30:21 +00:00
Chinmay Garde
daa09b9a64 [Impeller] Run simulator tests with Impeller enabled. (flutter/engine#56740)
The Info.plist override was missed earlier.

The main changes to the tests are due to the UI thread merge with the platform thread. The amendment to the "spawn" API are due to the fact that the assertions checked for the presence of GrDirectContext which will never exist with Impeller.

Unblocks https://github.com/flutter/engine/pull/56706
2024-11-21 23:48:59 +00:00
Daco Harkes
09e3b52bdf [native assets] Consume NativeAssetsManifest.json (flutter/engine#56727)
This PR introduces a `NativeAssetsManifest.json` next to the `AssetManifest.json` and `FontManifest.json`. This removes the need for embedding the native assets mapping inside the kernel file and will enable decoupling native assets building and bundling from the kernel compilation in flutter tools. This will then allow us to remove dry-run from the build hook protocol.

(It also means all isolate groups will have the same native assets. However, since Flutter does not support `Isolate.spawnUri` from kernel files anyways, this is not a regression.)

This manifest is parsed eagerly on startup by the engine in a manner similar to how the font manifest is parsed. The manifest contents need to be available in the callback for resolving assets, which does not have access to the engine. Therefore the parsed manifest is `NativeAssetsManager` stored in the `IsolateGroupData`. The engine passes it in on isolate group creation, and the FFI callbacks access it from the isolate group data.

Issue:

* https://github.com/flutter/flutter/issues/154425

Related PRs:

* https://dart-review.googlesource.com/c/sdk/+/388161

Follow up work:

* This PR does not yet remove the engine callbacks registered via the dart_api that rely on kernel embedding. If we were to do that in this PR, it would require a manual roll of the engine into flutter/flutter with the PR that switches flutter_tools to emit the native assets manifest instead of embedding in kernel, and a manual roll into g3 to switch emitting a manifest instead of embedding in kernel. A TODO is left in the code for those callbacks to be removed.

## Testing

Most of this PR cannot be tested in isolation. The code in this PR is heavily exercised in the follow up flutter_tools PR which creates the `NativeAssetsManifest.json` and removes the embedding of native assets in kernel files.

* This PR adds a unit test for parsing the JSON manifest.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-11-21 18:01:46 +00:00
AthulJoseph
4705535548 [Flutter GPU] Added support to set Scissor. (flutter/engine#56302)
Added support to set scissors. This resolves issue #157199
2024-11-21 05:52:54 +00:00
Jim Graham
e3d616ca84 [DisplayList] migrate DlImageFilter code to Impeller geometry classes (flutter/engine#56720)
The DlImageFilter code uses Skia geometry classes for its internal computations. This PR switches those implementations to use the Impeller geometry classes for consistency and 3rd party header file independence.
2024-11-20 20:47:37 +00:00
Chris Bracken
1a60defc96 TestMetalContext: Use ARC-managed Metal types (flutter/engine#56717)
Previously, we could not include any Objective-C types in test_metal_context.h, since that file was transitively included in pure C++ translation units. All users have been refactored into backend-specific files, and all Metal-related files are Objective-C++ files.

We now use Metal types directly in the header, without the workarounds.

Issue: https://github.com/flutter/flutter/issues/158998
Issue: https://github.com/flutter/flutter/issues/137801

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-11-19 22:50:10 +00:00
Michael Ludwig
c0e6c19e09 Remove SK_USE_LEGACY_BLUR_RASTER staging flag (flutter/engine#56618)
Also updates the image_filter_test.dart expected color values for a blur unit test. The legacy blur algorithm would a) treat very small blur sigmas as the identity even though the effect was still perceptible and b) was very inaccurate for sigmas < 2.  The unit test used a sigma of 1.0 so fell within the inaccurate range but the expected values appear to have been taken directly from the original Skia output.  This updates them to match the output of the new algorithm (which is also more consistent between CPU and GPU).

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-11-19 02:28:26 +00:00
Chris Bracken
6226520c45 Extract TestGLContext to separate translation unit (flutter/engine#56647)
For consistency with the Test.*Context classes for other backends, which live in their own implementation file with their own header, extract TestEGLContext to its own header and TU so that in cases where only a TestEGLContext is required (e.g. EmbedderTestBackingStoreProducerGL), we don't need to include all the various test GL surface classes as well.

GetEGLError is used by both TestEGLContext and the TestGLSurface classes, so moves to its own utils file.

No tests because this is a refactoring with no semantic changes, and the code itself is test code.

Issue: https://github.com/flutter/flutter/issues/158998

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-11-18 21:56:05 +00:00
Chris Bracken
bcbcb6631e iOS,macOS: Enable ARC in flutter_cflags_objc[c] (flutter/engine#56685)
Enables the `-fobjc-arc` compiler flag for Objective-C and Objective-C++
translation units.

Eliminates the flutter_cflags_objc[c]_arc settings, since they're now
redundant.

All Obj-C/Obj-C++ code in our codebase has now been migrated to ARC.

Issue: https://github.com/flutter/flutter/issues/137801
2024-11-18 13:37:40 -08:00
gaaclarke
9f1adb8ff4 [impeller] enable framebuffer blit when available (flutter/engine#56596)
depends on https://github.com/flutter/engine/pull/56573
fixes https://github.com/flutter/flutter/issues/158523

## 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-11-18 09:54:06 -08:00
Chris Bracken
9154a5285b Move TestMetalContext/Surface to testing namespace (flutter/engine#56602)
The Metal context/surface code was only in the `flutter` namespace but should have been in `flutter::testing` for consistency with everything else in the `testing` directory.

Also squashes the declarations in the rest of that directory to match the style guide while I've got the macro still handy.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-11-15 02:36:17 +00:00
Chris Bracken
c74f169f93 Migrate Metal translation units to Obj-C++ (flutter/engine#56592)
Since Metal code frequently uses Objective-C types like id<MTLTexture>
etc. this migrates Metal translation units to Obj-C++. In particular,
this allows transitively including headers that include such types. This
in turn helps with refactoring `EmbedderTest`, `TestMetalContext`,
`TestMetalSurface` to avoid specifying `void*` types in headers and
manually refcounting via ARC bridge casts.

Reformats the source, since Objective-C files are linted to 100 columns
rather than the 80 column limit we impose on C++ files.

This change introduces no semantic changes.

Issue: https://github.com/flutter/flutter/issues/137801
2024-11-14 14:03:01 -08:00
Chris Bracken
87fbedf2e3 iOS,macOS: Build/test test_metal_surface_unittests (flutter/engine#56586)
Years ago, @chinmaygarde created TestMetalSurface and wrote a unit test
for it in 2866095b584bbdc7d9b24076fcb9d07716d673c9.

And some things that should not have been forgotten were lost. History
became legend. Legend became myth. And for four and a half years, the
test passed out of all knowledge. Until, when chance came, it ensnared a
new bearer. The test came to the creature @cbracken, who took it deep
into the tunnels of the GN build files. And there it consumed him. The
test brought to @cbracken unnatural long life. For 500 hours, it
poisoned his mind. And in the gloom of @cbracken's cave, it waited.
Darkness crept back into the forests of the world. Rumour grew of a
shadow in the East - whispers of a nameless fear. And the Test of Unit
perceived its time had now come.
2024-11-14 13:11:37 -08:00
Chris Bracken
b773005a98 iOS,macOS: Refactor TestMetalContext for ARC (flutter/engine#56510)
`TestMetalContext` cannot include any Objective-C types in its header file since that header is included in pure C++ translation units. Previously, we declared these fields as `void*`, which then requires manual `__bridge_retained` and `__bridge_transfer` casts to perform the necessary retain/relase manipulation while opting the object in and out of ARC management.

Instead, we extract these to a struct in the implementation file and allow the fields to be managed by ARC. This is an interim measure consistent with the approach we've taken [elsewhere][1] until we implement the proper long-term solution.

The proper long-term solution is to refactor `EmbedderTest` (see: https://github.com/flutter/flutter/issues/157942) and other related code to split out backends into separate translation units, with the Metal backend code in Objective-C++ implementation files, which would then mean the headers could include Objective-C ivars.

No changes to tests, since this change introduces no behaviour changes.

Issue: https://github.com/flutter/flutter/issues/157942

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-11-11 21:57:04 +00:00
Jonah Williams
0489b6bbab [Impeller] fix line/polygon depth and GLES scissor state. (flutter/engine#56494)
Two problems:

1. We were incorrectly clearing scissor state in the GLES render pass. I suspect this is the cause of all of the clipping problems in wonderous.

2. We were incrementing the depth value in drawPoints with line/polygon mode: these actually need to use the same depth values.

Fixed in the same PR because the golden actually demonstrates both problems with GLES, and luckily I found 2. when I noticed 1.

## Before

### Metal/Vulkan

![image](https://github.com/user-attachments/assets/a5541a51-bdf6-4a47-9638-610d9562df6f)

### GLES

![image](https://github.com/user-attachments/assets/9f3ad7e1-8193-405d-98c0-49141c8ab662)
2024-11-11 19:59:53 +00:00
Jim Graham
2fb2e3e70a [Impeller] Switch to uniform arrays for gradient data on non-SSBO hardware (flutter/engine#56441)
Currently the most generalized form of the Impeller gradient shaders uses an SSBO to store the gradient information, but SSBO data is not supported on older platforms. To make the capability more general we introduce variants of the gradient shaders that uses uniform arrays which are more widely supported.
2024-11-08 18:18:05 +00:00
Jonah Williams
bc59375978 [Impeller] Add support for ImageFilter.shader (flutter/engine#53490)
Copy-pasta docs:

```
  /// Creates an image filter from a [FragmentShader].
  ///
  /// The fragment shader provided here has additional requirements to be used
  /// by the engine for filtering. The first uniform value must be a vec2, this
  /// will be set by the engine to the size of the bound texture. There must
  /// also be at least one sampler2D uniform, the first of which will be set by
  /// the engine to contain the filter input.
  ///
  /// For example, the following is a valid fragment shader that can be used
  /// with this API. Note that the uniform names are not required to have any
  /// particular value.
  ///
  /// ```glsl
  /// #include <flutter/runtime_effect.glsl>
  ///
  /// uniform vec2 u_size;
  /// uniform float u_time;
  ///
  /// uniform sampler2D u_texture_input;
  ///
  /// out vec4 frag_color;
  ///
  /// void main() {
  ///   frag_color = texture(u_texture_input, FlutterFragCoord().xy / u_size) * u_time;
  ///
  /// }
  ///
  /// ```
  ///
  /// This API is only supported when using the Impeller rendering engine. On
  /// other backends a [UnsupportedError] will be thrown. This error can be
  /// caught and used for feature detection.
  ```

Fixes https://github.com/jonahwilliams/flutter_shaders/issues/34
Fixes https://github.com/jonahwilliams/flutter_shaders/issues/26
Fixes https://github.com/flutter/flutter/issues/132099
2024-11-08 01:15:22 +00:00
Jonah Williams
d0bb78ccaf [Impeller] keep imgui hostbuffer alive. (flutter/engine#56409)
Fixes https://github.com/flutter/flutter/issues/158275

We are now counting on the content context to keep the host buffer alive. the imgui overlay does not use a content context, so it has to manage the lifetime of the host buffer correctly, keeping it alive for as many frames as needed and destroying it in the correct order (before context destruction).
2024-11-06 21:53:55 +00:00
Chris Bracken
5a3f245710 iOS,macOS: Add Obj-C cflags to all Obj-C targets (flutter/engine#56386)
Ensure that all Objective-C code in the codebase is being built with the standard set of Flutter Objective-C compiler flags with ARC enabled.

Also bumps the cflags config up to the top of the first block within each target in which Objective-C sources appear, so that the location is consistent.

Migrates The following targets to ARC, which had been missed in previous passes since they didn't declare the standard Flutter Obj-C[++] cflags:
* `//flutter/fml:fml_unittests`
* `//flutter/impeller/golden_tests:metal_screenshot`
* `//flutter/impeller/playground:playground`
* `//flutter/impeller/backend/metal:metal`
* `//flutter/impeller/backend/metal:metal_unittests`
* `//shell/gpu:gpu_surface_metal_unittests`
* `//flutter/shell/platform/embedder:embedder_unittests`

This patch includes no semantic changes.

Issue: https://github.com/flutter/flutter/issues/137801

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-11-06 20:17:08 +00:00
Chinmay Garde
bcb04a6ea8 [Impeller] Avoid errors due to triangle fans usage on Molten. (flutter/engine#56321)
Added the test case for https://github.com/flutter/flutter/issues/157885 to the corpus but Jonah fixed it in https://github.com/flutter/engine/pull/56310.

Fixes https://github.com/flutter/flutter/issues/158024 which is more of an inconvenience on macOS.
2024-11-06 18:36:48 +00:00
Matan Lurey
b60b012f51 Add and document and explicit toARGB32. (flutter/engine#56329)
Closes https://github.com/flutter/flutter/issues/157128.
2024-11-06 01:07:20 +00:00
Chris Bracken
8582bd3b7a fml: delete scoped_nsobject.h,mm (flutter/engine#56382)
fml::scoped_nsobject and fml::scoped_nsprotocol classes are no longer
necessary now that the entire codebase has been migrated to ARC.

This also eliminates the fml_arc_unittests target which tests that code.
All references to that target in documentation, run_tests.py have been
removed. This target was used in various `et` build/query unit tests and
has been replaced with the fml_unittests target in those cases.

Issue: https://github.com/flutter/flutter/issues/137801
2024-11-05 12:59:05 -08:00
Chris Bracken
8f6ef1c909 iOS: Eliminate fml::scoped_nsobject pointer use (flutter/engine#56295)
Eliminates use of `fml::scoped_nsobject` now that the codebase has been migrated to ARC.

Issue: https://github.com/flutter/flutter/issues/137801

No changes to tests since this patch makes no semantic changes.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-11-04 18:58:05 +00:00
Jason Simmons
90c1427af1 Write run_tests console logs to stdout instead of stderr (flutter/engine#56312)
Users of this script typically expect that the normal output of the tests will be written to stdout.  However, the logging.StreamHandler writes to stderr by default unless another stream is specified.
2024-11-01 21:34:53 +00:00
Jason Simmons
09c811781d [Impeller] Fix handling of destination opacity in advanced blends (flutter/engine#56251)
The framebuffer blend pipeline needs to support a dst_input_alpha parameter in order to implement the AbsorbOpacity flag.

Also, dst_input_alpha should only be applied to the alpha channel of the unpremultiplied destination color.

Fixes https://github.com/flutter/flutter/issues/157716
2024-11-01 01:02:10 +00:00
gaaclarke
f81ed55e63 reland: Allow BufferViews to have non-owning references to DeviceBuffers (flutter/engine#56286)
relands https://github.com/flutter/engine/pull/56224

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-10-31 23:46:55 +00:00
auto-submit[bot]
528967bfae Reverts "Allow BufferViews to have non-owning references to DeviceBuffers (#56224)" (flutter/engine#56285)
Reverts: flutter/engine#56224
Initiated by: jonahwilliams
Reason for reverting: merge issue.
Original PR Author: gaaclarke

Reviewed By: {jonahwilliams}

This change reverts the following previous change:
issue: https://github.com/flutter/flutter/issues/157538

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-10-31 22:48:46 +00:00
gaaclarke
1d90823917 Allow BufferViews to have non-owning references to DeviceBuffers (flutter/engine#56224)
issue: https://github.com/flutter/flutter/issues/157538

## 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-10-31 15:28:10 -07:00
Jim Graham
861a9a4ac8 [Impeller] Do not use fast mask blur for stroked shapes (flutter/engine#56247)
A compound test for whether to use the fast blur mechanism for shapes was failing to check for a stroked shape due to misplaced parentheses.
2024-10-31 21:33:18 +00:00
Chris Bracken
8a97900ef4 iOS: migrate Metal testing types to ARC (flutter/engine#56156)
This migrates Flutter's TestMetalContext and TestMetalSurface to ARC.

Also migrates to using `sk_cfp::retain` (which retains the passed in pointer) rather than `sk_cfp::reset`, which only releases the previous pointer but doesn't retain the incoming pointer.

No changes to tests since no semantic changes.

Issue: https://github.com/flutter/flutter/issues/137801

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-10-31 20:50:03 +00:00
Chris Bracken
a4bb83e6e8 iOS: Eliminate strong retain loop in Scenario tests (flutter/engine#56249)
`FlutterViewControllerTest testDrawLayer` created a callback which strongly referenced itself in its own body as part of an asynchronous recursive loop. The recursion was unnecessary and the test consistently passes, even if run on repeat > 100 times without it.

Now that there's only one call, eliminates the unnecessary local and inlines it into the `dispatch_after` call.

This was originally introduced in https://github.com/flutter/engine/pull/50072.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-10-31 00:37:26 +00:00
Brandon DeRosier
3fed10bf0d [Flutter GPU] Fix MSAA sample size and HostBuffer alignment. (flutter/engine#56218)
- Align HostBuffer emplacements properly (fix Metal validation failures).
- Correctly set the pipeline sample size.
- Throw an error when attempting to bind `deviceTransient` textures.
2024-10-29 22:52:21 +00:00
Jim Graham
80d757ef56 Change default TileMode for blur ImageFilter objects to null (flutter/engine#55552)
Fixes https://github.com/flutter/flutter/issues/154935

Historically ImageFilter.blur supported setting a TileMode and had a default mode of `clamp`, but few developers actually set the value and the default was not appropriate for some common uses like as a backdrop filter where the clamp mode produces flashing when scrolling high frequency pixel content underneath a blurred title bar.

This PR removes the default tile mode instead allowing a null value as the default which will allow the engine to use an appropriate context-dependent default tile mode depending on the action being performed. Typically:

- decal for rendering operations and saveLayers and ImageFilterLayer
- clamp for image operations
- mirror for backdrop filters
2024-10-29 22:47:32 +00:00
Jason Simmons
ac991b9a6e [Impeller] Clip the DrawImageRect source rect to the bounds of the image (flutter/engine#56183)
The destination rect will then be updated to a mapping of the clipped source rect.

This matches the behavior of Skia's SkCanvas::drawImageRect.

Fixes https://github.com/flutter/flutter/issues/157167
2024-10-29 17:10:31 +00:00
Brandon DeRosier
40062dbfe5 [Flutter GPU] Replace HostBuffer with Dart version. (flutter/engine#56054)
Resolves https://github.com/flutter/flutter/issues/157431.
2024-10-28 21:16:17 +00:00
Gray Mackall
c5d163fccb Delete v1 android engine embedding (flutter/engine#52022)
Fixes https://github.com/flutter/flutter/issues/143531

Other failures from the initial attempt are fixed in https://github.com/flutter/flutter/pull/146523/
2024-10-23 21:12:52 +00:00
Brandon DeRosier
026062f08b [Flutter GPU] Fix assert failure in createDeviceBufferWithCopy. (flutter/engine#56039)
Resolves https://github.com/flutter/flutter/issues/157336

`DartByteData` gets raw pointers into the Dart heap via `Dart_TypedDataAcquireData`. So it must be destructed before `AssociateWithDartWrapper` is called, which mutates the heap.

Re-enables failing test for Linux unopt.
2024-10-23 05:08:03 +00:00
yaakovschectman
32d9706cec Fix typo in testing script (flutter/engine#56029)
Just fix the spelling of `warning`.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-10-22 19:08:12 +00:00
Brandon DeRosier
3b568c8d68 [Flutter GPU] Fix conditional when checking DeviceBuffer bounds. (flutter/engine#56017)
Resolves https://github.com/flutter/flutter/issues/157324

Fix a silly off-by-one that I didn't catch because none of the tests are using `DeviceBuffer` directly. 🤦
2024-10-22 10:58:38 +00:00
Brandon DeRosier
493177b5ed [Flutter GPU] Add missing MSAA stuff. (flutter/engine#55424)
Resolves https://github.com/flutter/flutter/issues/144264.
2024-10-22 01:16:25 +00:00
Jim Graham
6b912e50de [Impeller] New impeller round rect class (flutter/engine#55946)
Impeller geometry class analogous to SkRRect - soon to be the standard round rectangle class throughout most of the engine that doesn't talk directly to Skia.

More unit tests are being written, but this PR will enable developers to look at the API of the new class and comment as well as test its effect on any goldens (there should be none).
2024-10-20 18:59:23 +00:00
gaaclarke
4ffade7c5b Started filtering out close line segments in rrect polylines. (flutter/engine#55929)
fixes https://github.com/flutter/flutter/issues/156422

tests: AiksTest.GradientOvalStrokeMaskBlurSigmaZero

This filtering needs to happen somewheres.  I opted for putting it inside of the AddLinearComponent instead of where it was affected me in the test: 45237cc63f/impeller/geometry/path_builder.cc (L180)

This seems preferable.  A tiny line segment should never matter.  The rub is that its only happening here.  We might want to do this in other places as well.  It's equally unimportant to have a tiny curve.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-10-18 21:54:04 +00:00