1738 Commits

Author SHA1 Message Date
gaaclarke
e683e1031c
Added special case for fat width arcs (#161255)
fixes https://github.com/flutter/flutter/issues/158567

This draws arcs as oval sectors when the stroke width is large enough.

## 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], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [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/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-01-14 16:55:30 +00:00
Matan Lurey
d102e1197e
Remove references to cirrus, mostly in doc comments. (#161529)
Towards https://github.com/flutter/flutter/issues/161387.
2025-01-13 23:49:04 +00:00
Matan Lurey
1d38029c3b
Copy linux_host_engine as linux_host_engine_test, removing archives: [...]. (#161532)
Towards https://github.com/flutter/flutter/issues/161406.

The goal is to, assuming this is WAI, move the `bringup: true` build
(the newly created one) to presubmit, and then in a follow-up PR, remove
the `tests: [...]` (and test dependencies) from
`linux_host_engine.json`, meaning that it would be a build/archive only
builder, and this _new_ builder would be a build/test one.

We talked about it being hypothetically better to _not_ build the engine
multiple times, and decided for now to depend on RBE and not try to
create stages or download artifacts created from another builder, but if
@zanderso has another suggestion here is the place to chime in :)

(Btw if we like this approach, I'll create a task list of every builder
that needs to be migrated)
2025-01-13 23:45:41 +00:00
Matan Lurey
1d79946ecb
Remove last two references to Cirrus CI. (#161530)
Towards https://github.com/flutter/flutter/issues/161387.
2025-01-13 23:44:40 +00:00
Matan Lurey
e3b301f23d
Stamp golden files to verify engine Skia Gold is WAI. (#161240)
Auto-generated by `dart testing/skia_gold_client/tool/generate.dart`.

This is just to make sure that everything is working after the recent
configuration.
2025-01-07 18:23:39 +00:00
Matan Lurey
e66e04f39f
Remove verbose: true from canvas_test.dart. (#161211)
General cleanup after https://github.com/flutter/flutter/issues/157206.
2025-01-07 16:23:52 +00:00
Matan Lurey
cda3515126
Use flutter repo for engine golds instead of flutter-engine. (#160556)
Closes https://github.com/flutter/flutter/issues/157206.

I also added a `prefix` that will default to `engine.` to avoid
accidentally stomping on golden names across repos.

/cc @gaaclarke for visibility, @Piinks for visibility.

(I would love to get rid of this "engine copy" of the client as part of
longer-term mono repo deduplication).
2025-01-07 03:37:36 +00:00
Matan Lurey
95c1bc1c3e
[Engine] Make SkiaGoldClient a NOP when the branch is not main or master. (#161187)
Unblocks https://github.com/flutter/flutter/pull/160556.

Currently the merge queue runs in post-submit mode, which looks for (and
fails to find) digests for PRs that have not yet been submitted,
blocking the engine goldens from being enabled/checked in
https://github.com/flutter/flutter/pull/160556. This PR is a proposal to
fix that by skipping the tests.

We might decide instead that tests should not be running in the merge
queue at all, in which case we will _not_ merge this PR and will change
how the merge queue works instead. Otherwise this PR is a proof of
concept of [aligning implementations with the
framework](a9b3f6c042/packages/flutter_goldens/lib/flutter_goldens.dart (L338)).
2025-01-07 01:38:52 +00:00
Jim Graham
a513498487
[DisplayList] Migrate DlVertices onto Impeller/DisplayList geometry classes (#160633)
DlVertices was already half migrated onto the DL geometry classes, this
completes the conversion.
2024-12-20 07:01:52 +00:00
Michael Goderbauer
8e0993eda8
Auto-format Dart code in engine (#160576)
This auto-formats all *.dart files in the `engine` subdirectory and
enforces that these files stay formatted with a presubmit check.
2024-12-19 17:13:07 +00:00
Michael Goderbauer
b38bf972ae Adjust some ignores for 'dart format' (flutter/engine#57208)
When running `dart format` over these lines the `// ignore` ended up on a line where it wasn't properly ignoring the lint. This adjusts the placement of `// ignore`s so they will continue to ignore the right thing even after the code is auto formatted.

I am hoping that if we do this now the large PR that formats the entire repo will go in smoother without manual intervention.
2024-12-14 02:09:06 +00:00
Tess Strickland
ee9024da88 Add entry-point annotations for test-only code. (flutter/engine#57158)
This change adds entry-point annotations to methods and classes accessed
by native code during engine tests. Currently, entry point annotations
are not checked by the Dart VM when running in JIT mode, only in AOT
mode. In order to also enforce entry point annotations in JIT mode,
first tests in Flutter must be appropriately annotated to avoid roll
failures.

Related issues:
* https://github.com/flutter/flutter/issues/118608
* https://github.com/dart-lang/sdk/issues/50649
2024-12-13 16:22:17 +01:00
Brandon DeRosier
83d36af187 Cover offset+bounds wrapping in the APNG frame region check. (flutter/engine#57025)
The `offset + bounds` calculation in the bounds checks could wrap around, bypassing the check.

(Follow up to https://github.com/flutter/engine/pull/56928)
2024-12-06 23:26:31 +00:00
Michael Goderbauer
75f9549553 Bump Dart SDK to 3.7 (flutter/engine#56989) 2024-12-06 01:41:03 +00:00
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