1748 Commits

Author SHA1 Message Date
Jonah Williams
73ec326b80 [UI] fix scene builder parameter naming. (flutter/engine#55969)
This is reponsible for the bdf golden breaking shader mask.
2024-10-18 17:45:23 -07:00
Jonah Williams
f0f29ce37f [Impeller] add mechanism for sharing bdf inputs. (flutter/engine#55701)
Introduces a mechanism to allow backdrop filters to 1) share backdrop inputs and 2) fuse filter applications for faster blurs.

This is a proposed solution to https://github.com/flutter/flutter/issues/131568

Implemented:
* Developer can specify a "backdrop id" which indicates that a backdrop layer should share the input texture and potentially cached filter for a layer.
* Removes second save layer for each backdrop filter
* Removes save layer trace event for backdrop filter
* Can fuse backdrop filters if there is more than one identical filter

TBD:
* Adjust heruristic to avoid applying bdf filter to entire screen

Suggestions: applying a bdf should be a distinct operation from a save layer in the DL builder/dispatcher. The saveLayer implmenentation in the impeller dispatcher is super convoluted because it needs to handle both.

### Video

Video starts with normal bdf then I hot reload to specify that the bdfs share inputs/filters. This is running on a pixel 8 pro

Change to the macrobenchmark app is just:
```dart
  Widget build(BuildContext context) {
    Widget addBlur(Widget child, bool shouldBlur) {
      if (shouldBlur) {
        return ClipRect(
          child: BackdropFilter(
            filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
            backdropId: 1, // Added ID
            child: child,
          ),
        );
      } else {
        return child;
      }
    }
```

https://github.com/user-attachments/assets/22707f97-5825-43f1-91b4-1a02a43437f5

Requires framework changes in https://github.com/jonahwilliams/flutter/pull/new/backdrop_id
2024-10-18 15:38:34 +00:00
Jonah Williams
7a2227ddc8 [Impeller] simpler labels for render target textures and cmd buffers. (flutter/engine#55936)
Avoid Sprintf'ing labels for textures/cmd buffers/render passes. For the render target textures, defer combined label construction until we know the label will be used.
2024-10-18 04:01:50 +00:00
Yegor
4a93a6a08b Introduce SemanticsFlag.hasSelectedState to the engine API (flutter/engine#55780)
Introduce `SemanticsFlag.hasSelectedState` to the engine API. At this point the flag is not backed by any engine functionality. See also: https://github.com/flutter/flutter/issues/66673#issuecomment-2402903402

| ⚠️ WARNING           |
|:----------------------------|
| Submit _AFTER_ https://github.com/flutter/flutter/pull/157017 and https://github.com/flutter/flutter/pull/157061 land in the framework     |

A step towards https://github.com/flutter/flutter/issues/66673
2024-10-17 22:01:34 +00:00
Jonah Williams
243ea95602 [Impeller] make labeling APIs exclusively use std::string_view. (flutter/engine#55918)
Many of our labeling APIs accepted a std::string. When provided with a string literal (const char*), this would force the allocation of a new std::string object and a copy of the original char*. std::string_view is a view of either a std::string, or a const char* (or other), which allows an API that doesn not need to store the string to accept both without a copy. Of course, we can't store a std::string_view, as that doesn't provide memory ownership - so many of the GLES implementations will still copy the string_view into a string locally.

Also updates several of the debug labelling functions to no-op in release mode and removes some expensive interpolations that aren't super necessary.
2024-10-17 16:54:03 +00:00
Jonah Williams
5c6ab792a2 [Impeller] fix memory leak during gif upload. (flutter/engine#55920)
Fixes https://github.com/flutter/flutter/issues/156728

Need to periodically flush the TLS command buffer pools in multiframe codec just like single frame codec.
2024-10-17 01:17:59 +00:00
Harlen Batagelo
8737cce879 Handle out-of-order add/remove pointer events (flutter/engine#55740)
Fixes [#146251](https://github.com/flutter/flutter/issues/146251).

On Windows, a "pointer add" event to a new view is sometimes sent before the "pointer remove" event from the old view. When `PointerDataPacketConverter` handles the add event, it asserts that the device's pointer state has been cleared. Since the pointer state is cleared only when the remove event is processed, the assertion fails if the events arrive out of order.

The solution proposed here is to synthesize a remove event if an add event is received while the pointer state hasn't been cleared (i.e., if the pointer is added without being removed from the previous view).

To avoid duplicate remove events, the view ID is now tracked in `PointerState`. If the original "remove" arrives after the synthesized one, the state's view ID will differ from the pointer data's view ID, allowing it to be safely ignored.

When synthesizing the remove event, it's possible that the old view has already been destroyed, meaning no remove event will be received later. For example, this occurs when a window is destroyed while the pointer is inside it. However, the framework expects an "add" event to always follow a "remove" event, and "remove" events with invalid views are ignored. To meet the framework's expectations, the view ID of the "add" event will be used for the "remove" event if the old view has been destroyed.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-10-16 20:19:49 +00:00
gaaclarke
96b0bf0ce3 Speculative fix for memory issues related to retrying image decompression (flutter/engine#55704)
b/371512414

This issue had no reproduction but the stacktrace was provided.  The theory of this fix is that the `ImageResult` type is capturing something that doesn't handle being copied and deallocated twice so instead of copying it, we std::move it into a shared_ptr so that it will only be deallocated once.

Also, I just avoid using a `std::move` when overflowing.  The idea here is maybe sometimes deleting the std::move'd item isn't kosher.  We know from the stacktrace that it has something to do with overflowing because that would be the only case where something is being deleted.

I've added 2 integration tests that exercises the code where the crash appears to be happening.  This is good coverage to have but neither of them reproduced the issue, even with MallocScribble enabled.  That's the best we can do without a reproduction.

```
Thread 7  (id: 0x0000a103)crashed
0x000000010a48ae8c(Flutter -function.h)std::_fl::allocator<impeller::ContextMTL::PendingTasks>::destroy[abi:v15000](impeller::ContextMTL::PendingTasks*)
0x000000010a48b9fc(Flutter -allocator_traits.h:309)impeller::ContextMTL::StoreTaskForGPU(std::_fl::function<void ()> const&, std::_fl::function<void ()> const&)
0x000000010a48b9fc(Flutter -allocator_traits.h:309)impeller::ContextMTL::StoreTaskForGPU(std::_fl::function<void ()> const&, std::_fl::function<void ()> const&)
0x000000010a4d49e4(Flutter -image_decoder_impeller.cc:422)std::_fl::__function::__func<flutter::ImageDecoderImpeller::UploadTextureToPrivate(std::_fl::function<void (sk_sp<flutter::DlImage>, std::_fl::basic_string<char, std::_fl::char_traits<char>, std::_fl::allocator<char>>)>, std::_fl::shared_ptr<impeller::Context> const&, std::_fl::shared_ptr<impeller::DeviceBuffer> const&, SkImageInfo const&, std::_fl::shared_ptr<SkBitmap> const&, std::_fl::optional<SkImageInfo> const&, std::_fl::shared_ptr<fml::SyncSwitch> const&)::$_1, std::_fl::allocator<flutter::ImageDecoderImpeller::UploadTextureToPrivate(std::_fl::function<void (sk_sp<flutter::DlImage>, std::_fl::basic_string<char, std::_fl::char_traits<char>, std::_fl::allocator<char>>)>, std::_fl::shared_ptr<impeller::Context> const&, std::_fl::shared_ptr<impeller::DeviceBuffer> const&, SkImageInfo const&, std::_fl::shared_ptr<SkBitmap> const&, std::_fl::optional<SkImageInfo> const&, std::_fl::shared_ptr<fml::SyncSwitch> const&)::$_1>, void ()>::operator()()
0x000000010a06c234(Flutter -function.h:512)fml::SyncSwitch::Execute(fml::SyncSwitch::Handlers const&) const
0x000000010a4d42f8(Flutter -image_decoder_impeller.cc:408)flutter::ImageDecoderImpeller::UploadTextureToPrivate(std::_fl::function<void (sk_sp<flutter::DlImage>, std::_fl::basic_string<char, std::_fl::char_traits<char>, std::_fl::allocator<char>>)>, std::_fl::shared_ptr<impeller::Context> const&, std::_fl::shared_ptr<impeller::DeviceBuffer> const&, SkImageInfo const&, std::_fl::shared_ptr<SkBitmap> const&, std::_fl::optional<SkImageInfo> const&, std::_fl::shared_ptr<fml::SyncSwitch> const&)
0x000000010a4d3838(Flutter -image_decoder_impeller.cc:538)std::_fl::__function::__func<flutter::ImageDecoderImpeller::Decode(fml::RefPtr<flutter::ImageDescriptor>, unsigned int, unsigned int, std::_fl::function<void (sk_sp<flutter::DlImage>, std::_fl::basic_string<char, std::_fl::char_traits<char>, std::_fl::allocator<char>>)> const&)::$_1, std::_fl::allocator<flutter::ImageDecoderImpeller::Decode(fml::RefPtr<flutter::ImageDescriptor>, unsigned int, unsigned int, std::_fl::function<void (sk_sp<flutter::DlImage>, std::_fl::basic_string<char, std::_fl::char_traits<char>, std::_fl::allocator<char>>)> const&)::$_1>, void ()>::operator()()
0x000000010a06dd1c(Flutter -function.h:512)fml::ConcurrentMessageLoopDarwin::ExecuteTask(std::_fl::function<void ()> const&)
0x000000010a06737c(Flutter -concurrent_message_loop.cc:101)void* std::_fl::__thread_proxy[abi:v15000]<std::_fl::tuple<std::_fl::unique_ptr<std::_fl::__thread_struct, std::_fl::default_delete<std::_fl::__thread_struct>>, fml::ConcurrentMessageLoop::ConcurrentMessageLoop(unsigned long)::$_0>>(void*)
0x000000021d4ff378(libsystem_pthread.dylib + 0x00006378)_pthread_start
```

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-10-07 20:46:16 +00:00
Todd Volkert
7b84f908ec Added Dart docs (flutter/engine#54506)
Added docs to `FrameCallback` and `FrameData`
2024-10-01 22:08:04 -07:00
gaaclarke
9e2746c137 updated Color docstring to address equality (flutter/engine#55496)
issue: https://github.com/flutter/flutter/issues/155803

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-09-27 21:41:08 +00:00
John McDole
14caa2fe19 Disallow time traveling frame times (flutter/engine#55310)
Address bad developer experience in
https://github.com/flutter/flutter/issues/106277

Leave as an error log and hope for more repro reports


```mermaid
sequenceDiagram
  Animator ->> Animator: AwaitVSync
  Animator ->> VsyncWaiter: AsyncWaitForVsync(callback)
  VsyncWaiter -> VsyncWaiterAndroid: AwaitVSync
  note over VsyncWaiterAndroid: GetUITaskRunner
  VsyncWaiterAndroid -> Choreographer: PostFrameCallback
  Choreographer -> NDK: AChoreographer_postFrameCallback64
  note over Choreographer,NDK: The time that the frame is being<br/>rendered as nanoseconds in the <br/>CLOCK_MONOTONIC time base
  NDK --> Choreographer: callback(nanos)
  Choreographer -> VsyncWaiterAndroid: callback
  note over VsyncWaiterAndroid: // Rollback suspicion<br/>if (frame_time > now) frame_time = now;
  VsyncWaiterAndroid -> VsyncWaiterAndroid: OnVsyncFromNDK(frame_nanos)
  VsyncWaiterAndroid -> VsyncWaiter: FireCallback(\n  frame_start_time,\n  target_time)
  VsyncWaiter -> Animator: callback(frame_timings_recorder)

  Animator -> Animator: BeginFrame(frame_timings_recorder)
  Animator -> Shell: OnAnimatorBeginFrame
  Shell -> Engine: BeginFrame(frame_time, frame_number)
  Engine -> RuntimeController: BeginFrame(frame_time, frame_number)
  RuntimeController -> PlatformConfiguration: BeginFrame(frame_time, frame_number)
  PlatformConfiguration -> hooks.dart: begin_frame_
```
2024-09-24 15:33:45 -07:00
Jason Simmons
d333cf4224 [Impeller] Delete command pools held by the CommandPoolRecyclerVK after decoding an image on the IO thread (flutter/engine#55398)
In the Vulkan backend, the CommandPoolRecyclerVK stores command pools that can be reused while rendering a frame.  For each frame, SurfaceContextVK::AcquireNextSurface calls CommandPoolRecyclerVK::Dispose to clear the cached pools.

However, the CommandPoolRecyclerVK's cache of pools is placed in thread-local storage.  So command pools used on the IO thread will not be cleaned up if frame rendering calls Dispose on the raster thread.

This PR adds a Context API that the IO thread can call after using a command pool in order to ensure that cached resources are disposed.

Fixes https://github.com/flutter/flutter/issues/155519
2024-09-24 22:16:37 +00:00
gaaclarke
9f66178386 Reland: Update Color to do all calculations with floating point components (flutter/engine#55231)
Reason for revert: Broke customer tests
Reland depends on https://github.com/flutter/flutter/issues/155113

This transforms the rest of Color to use the floating point parameters.  This will likely break existing tests very subtly.  For example, colors will be slightly different in golden tests if `lerp` was ever used.

issue: https://github.com/flutter/flutter/issues/127855

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-09-23 17:43:52 +00:00
Brandon DeRosier
ea026548ce [Flutter GPU] Add golden test for rendering a triangle. (flutter/engine#55262)
Resolves https://github.com/flutter/flutter/issues/144640.

New golden:
![flutter_gpu_test_triangle](https://github.com/user-attachments/assets/0b39380e-1aa5-4369-ae5b-a8764d5701cb)
2024-09-17 20:00:33 +00:00
Jim Graham
7da9ad1862 Delete VolatilePathTracker in favor of Dispatch tracking (flutter/engine#55125)
ui.Canvas and ui.SceneBuilder now use the DlPath object directly from the ui.Path object. This results in increased sharing of the wrapper objects which then increases the sharing of both the converted Impeller paths and Skia's volatile flag.

The VolatilePathTracker mechanism is deleted and rather than count the number of frames that a path is stable for, instead we count the number of times it is used for rendering. If a path is used 100 times in a single frame, it will become non-volatile and start being cached almost immediately. The cached Impeller paths are now also tracked for all instances of the same path, rather than for each call site that originated from a DisplayList dispatch.
2024-09-13 21:49:09 +00:00
Matan Lurey
02d5118165 Remove assert(() {... }) and other unnecessary patterns in dart:ui tests (flutter/engine#55165)
Closes https://github.com/flutter/flutter/issues/155054, where we
decided this was correct to do.

As a bonus I improved an `assert` message :)
2024-09-12 17:40:52 -07:00
Brandon DeRosier
16acb8258a Remove Impeller Scene 👋 (flutter/engine#55118)
Impeller Scene has been fully rewritten as a Dart library for Flutter: https://pub.dev/packages/flutter_scene
2024-09-12 14:56:08 -07:00
gaaclarke
f9093e1b13 Revert "Update Color to do all calculations with floating point components" (flutter/engine#55153)
Reverts flutter/engine#54981

This is causing failures in customer tests that need to be updated:
https://github.com/flutter/flutter/pull/155107/checks?check_run_id=30069840819
2024-09-12 13:01:37 -07:00
gaaclarke
c7d96a38bc Update Color to do all calculations with floating point components (flutter/engine#54981)
This transforms the rest of Color to use the floating point parameters.  This will likely break existing tests very subtly.  For example, colors will be slightly different in golden tests if `lerp` was ever used.

issue: https://github.com/flutter/flutter/issues/127855

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-09-12 16:30:06 +00:00
Jonah Williams
547dbe4c4c [impeller] fake image for fake tests. (flutter/engine#54974)
Simulator only change to allow toImage and toByteData to not fail when there is no metal context w/ impeller.
2024-09-06 18:53:53 +00:00
gaaclarke
bba852ec0c Removes the int storage from Color (flutter/engine#54714)
issue: https://github.com/flutter/flutter/issues/127855
This depends on https://github.com/flutter/flutter/pull/153938 being
landed.
## 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-09-05 19:11:25 -07:00
gaaclarke
02b8207c9a Framework wide color linear gradients (flutter/engine#54748)
This implements wide gamut color support for gradients in the engine.

issue: https://github.com/flutter/flutter/issues/127855
integration test: https://github.com/flutter/flutter/pull/153976

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-09-04 23:50:19 +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
gaaclarke
6596a35625 Reland: Hooks up framework wide gamut to engine wide gamut (flutter/engine#54906)
relands https://github.com/flutter/engine/pull/54567
depends on https://github.com/flutter/engine/pull/54905

This was reverted because the PR that it depends on was reverted.  There is nothing to be addressed here.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-08-30 18:22:04 +00:00
gaaclarke
df9fc7786b Reland: Framework wide color (#54415) (#54737) (flutter/engine#54905)
[This PR](https://github.com/flutter/engine/pull/54415) was reverted
because it required customer testing updates.

issue: https://github.com/flutter/flutter/issues/127855
integration test: https://github.com/flutter/engine/pull/54415

This does the preliminary work for implementing wide gamut colors in the
Flutter framework. Here are the following changes: 1) colors now specify
a colorspace with which they are to be interpreted 1) colors now store
their components as floats to accommodate bit depths more than 8

The storage of this Color class is weird with float/int storage but that
is a temporary solution to support a smooth transition. Here is the plan
for landing this: 1) Land this PR
1) Wait for it to roll into the Framework
1) Land https://github.com/flutter/flutter/pull/153938 which will make
CupertinoDynamicColor implement Color 1) Land another engine PR that
rips out the int storage: https://github.com/flutter/engine/pull/54714

Here are follow up PRs:
1) https://github.com/flutter/engine/pull/54473 - changes DlColor so the
wide gamut colors are rendered 1)
https://github.com/flutter/engine/pull/54567 - Hooks up these changes to
take advantage of wide DlColor 1)
https://github.com/flutter/flutter/pull/153319 - the integration test
for the framework repo

There are some things that have been left as follow up PRs since they
are technically breaking: 1) The math on `lerp` hasn't been updated to
take advantage of the higher bit depth 1) `operator==` hasn't been
updated to take advantage of the higher bit depth 1) `hashCode` hasn't
been updated to take advantage of the higher bit depth 1) `alphaBlend`
hasn't been updated to take advantage of the higher bit depth 1)
`toString` hasn't been updated to take advantage of the higher bit depth

## Reland 2 notes

This was reverted because it changes the math on `_lerpDouble`. While
those changes were mathematcially equivalent, they had different
behaviors when working with non-numbers which created unexpected
changes. The change has been reverted and a test added.

## 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-08-30 10:33:07 -07:00
auto-submit[bot]
7b38e8d173 Reverts "Reland: Framework wide color (#54415) (#54737)" (flutter/engine#54885)
Reverts: flutter/engine#54737
Initiated by: chingjun
Reason for reverting: Breaking internal tests. See b/363125155
Original PR Author: gaaclarke

Reviewed By: {matanlurey, jonahwilliams}

This change reverts the following previous change:
[This PR](https://github.com/flutter/engine/pull/54415) was reverted because it requires a manual roll into the framework.

issue: https://github.com/flutter/flutter/issues/127855
integration test: https://github.com/flutter/engine/pull/54415

This does the preliminary work for implementing wide gamut colors in the Flutter framework. Here are the following changes: 1) colors now specify a colorspace with which they are to be interpreted 1) colors now store their components as floats to accommodate bit depths more than 8

The storage of this Color class is weird with float/int storage but that is a temporary solution to support a smooth transition. Here is the plan for landing this:
1) Land this PR
1) Wait for it to roll into the Framework
1) Land https://github.com/flutter/flutter/pull/153938 which will make CupertinoDynamicColor implement Color
1) Land another engine PR that rips out the int storage: https://github.com/flutter/engine/pull/54714

Here are follow up PRs:
1) https://github.com/flutter/engine/pull/54473 - changes DlColor so the wide gamut colors are rendered
1) https://github.com/flutter/engine/pull/54567 - Hooks up these changes to take advantage of wide DlColor
1) https://github.com/flutter/flutter/pull/153319 - the integration test for the framework repo

There are some things that have been left as follow up PRs since they are technically breaking:
1) The math on `lerp` hasn't been updated to take advantage of the higher bit depth
1) `operator==` hasn't been updated to take advantage of the higher bit depth
1) `hashCode` hasn't been updated to take advantage of the higher bit depth
1) `alphaBlend` hasn't been updated to take advantage of the higher bit depth
1) `toString` hasn't been updated to take advantage of the higher bit depth
2024-08-30 04:31:26 +00:00
auto-submit[bot]
677c70aa8a Reverts "Hooks up framework wide gamut to engine wide gamut (#54567)" (flutter/engine#54884)
Reverts: flutter/engine#54567
Initiated by: chingjun
Reason for reverting: Breaking internal tests. See b/363125155
Original PR Author: gaaclarke

Reviewed By: {jonahwilliams, chinmaygarde}

This change reverts the following previous change:
issue: https://github.com/flutter/flutter/issues/127855
integration test: https://github.com/flutter/engine/pull/54415

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-08-30 04:27:48 +00:00
gaaclarke
fdc343efec Hooks up framework wide gamut to engine wide gamut (flutter/engine#54567)
issue: https://github.com/flutter/flutter/issues/127855
integration test: https://github.com/flutter/engine/pull/54415

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-08-29 23:22:07 +00:00
gaaclarke
3b2f540e54 Reland: Framework wide color (#54415) (flutter/engine#54737)
[This PR](https://github.com/flutter/engine/pull/54415) was reverted because it requires a manual roll into the framework.

issue: https://github.com/flutter/flutter/issues/127855
integration test: https://github.com/flutter/engine/pull/54415

This does the preliminary work for implementing wide gamut colors in the Flutter framework. Here are the following changes: 1) colors now specify a colorspace with which they are to be interpreted 1) colors now store their components as floats to accommodate bit depths more than 8

The storage of this Color class is weird with float/int storage but that is a temporary solution to support a smooth transition. Here is the plan for landing this:
1) Land this PR
1) Wait for it to roll into the Framework
1) Land https://github.com/flutter/flutter/pull/153938 which will make CupertinoDynamicColor implement Color
1) Land another engine PR that rips out the int storage: https://github.com/flutter/engine/pull/54714

Here are follow up PRs:
1) https://github.com/flutter/engine/pull/54473 - changes DlColor so the wide gamut colors are rendered
1) https://github.com/flutter/engine/pull/54567 - Hooks up these changes to take advantage of wide DlColor
1) https://github.com/flutter/flutter/pull/153319 - the integration test for the framework repo

There are some things that have been left as follow up PRs since they are technically breaking:
1) The math on `lerp` hasn't been updated to take advantage of the higher bit depth
1) `operator==` hasn't been updated to take advantage of the higher bit depth
1) `hashCode` hasn't been updated to take advantage of the higher bit depth
1) `alphaBlend` hasn't been updated to take advantage of the higher bit depth
1) `toString` hasn't been updated to take advantage of the higher bit depth
2024-08-29 19:02:59 +00:00
Jonah Williams
c88eb87bd5 [ui] fix missing color conversion in drawAtlas. (flutter/engine#54750)
Ensure that int32 ui colors are correctly converted to Dl Colors (convert instead of reinterpret cast).
2024-08-26 16:28:21 +00:00
Jim Graham
2932511ae8 Revert "Framework wide color" (flutter/engine#54728)
Reverts flutter/engine#54415

Reverting for failures in the engine roll: https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8738846858081700577/+/u/run_test.dart_for_customer_testing_shard_and_subshard_None/stdout
2024-08-23 08:11:16 +00:00
gaaclarke
6f9776424c Framework wide color (flutter/engine#54415)
issue: https://github.com/flutter/flutter/issues/127855
integration test: https://github.com/flutter/engine/pull/54415

This does the preliminary work for implementing wide gamut colors in the
Flutter framework. Here are the following changes:
1) colors now specify a colorspace with which they are to be interpreted
1) colors now store their components as floats to accommodate bit depths
more than 8

The storage of this Color class is weird with float/int storage but that
is a temporary solution to support a smooth transition. Here is the plan
for landing this:
1) Land this PR
1) Wait for it to roll into the Framework
1) Land https://github.com/flutter/flutter/pull/153938 which will make
CupertinoDynamicColor implement Color
1) Land another engine PR that rips out the int storage:
https://github.com/flutter/engine/pull/54714

Here are follow up PRs:
1) https://github.com/flutter/engine/pull/54473 - changes DlColor so the
wide gamut colors are rendered
1) https://github.com/flutter/engine/pull/54567 - Hooks up these changes
to take advantage of wide DlColor
1) https://github.com/flutter/flutter/pull/153319 - the integration test
for the framework repo

There are some things that have been left as follow up PRs since they
are technically breaking:
1) The math on `lerp` hasn't been updated to take advantage of the
higher bit depth
1) `operator==` hasn't been updated to take advantage of the higher bit
depth
1) `hashCode` hasn't been updated to take advantage of the higher bit
depth
1) `alphaBlend` hasn't been updated to take advantage of the higher bit
depth
1) `toString` hasn't been updated to take advantage of the higher bit
depth

## 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-08-22 12:36:28 -07:00
Jonah Williams
02a6c7a676 [Impeller] use blit pass to resize decoded images. (flutter/engine#54606)
Fixes https://github.com/flutter/flutter/issues/153623
Fixes https://github.com/flutter/flutter/issues/153788

* Avoids slow CPU resizer
* Avoids us having to write any code at all to resize these images
* Avoids reading from the GPU staging buffers that are not read cached (similar to Glyph cache performance issues).

Also changes the single frame codec upload to either use the device private storage path or to defer upload until the GPU returns. This allows us to ensure that mips are always constructed and makes sure that we don't need to keep around the CPU texture reisze that depends on the Skia software backend.

Separately, I updated the deferred task system to allow separate success/failure tasks to make it easier to track the final state.
2024-08-21 20:22:09 +00:00
gaaclarke
a6c6c50a25 Changes DlColor to support wide gamut colors (#54473) (flutter/engine#54648)
relands https://github.com/flutter/engine/pull/54473
issue: https://github.com/flutter/flutter/issues/127855
integration test: https://github.com/flutter/engine/pull/54415

This is the engine side changes required for wide gamut framework support.  It changes the internal representation of DlColor to be floats.  It will be married with https://github.com/flutter/engine/pull/54415 when it lands in https://github.com/flutter/engine/pull/54567.

## Difference from last attempt

1) The default color is now opaque black, not transparent black (not the issue for revert)
1) Updated a test to send in valid numbers when constructing a color and added asserts to avoid those problems in the future.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-08-20 21:44:24 +00:00
auto-submit[bot]
8aabbdd12f Reverts "Changes DlColor to support wide gamut colors (#54473)" (flutter/engine#54636)
Reverts: flutter/engine#54473
Initiated by: jonahwilliams
Reason for reverting: golden diffs like https://flutter-engine-gold.skia.org/detail?grouping=name%3Dimpeller_Play_AiksTest_BlendModeSrcAlphaLuminosity_OpenGLES%26source_type%3Dflutter-engine&digest=107ccd2cd1170746b1ffc4d31184e789 look incorrect, potentially an alpha issue
Original PR Author: gaaclarke

Reviewed By: {flar}

This change reverts the following previous change:
issue: https://github.com/flutter/flutter/issues/127855
integration test: https://github.com/flutter/engine/pull/54415

This is the engine side changes required for wide gamut framework support.  It changes the internal representation of DlColor to be floats.  It will be married with https://github.com/flutter/engine/pull/54415 when it lands in https://github.com/flutter/engine/pull/54567.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-08-20 02:19:47 +00:00
gaaclarke
1fde0ad466 Changes DlColor to support wide gamut colors (flutter/engine#54473)
issue: https://github.com/flutter/flutter/issues/127855
integration test: https://github.com/flutter/engine/pull/54415

This is the engine side changes required for wide gamut framework support.  It changes the internal representation of DlColor to be floats.  It will be married with https://github.com/flutter/engine/pull/54415 when it lands in https://github.com/flutter/engine/pull/54567.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-08-19 23:16:55 +00:00
Oleg Magomedov
e55ebe1d32 Fix typo in AppLifecycleState documentation (flutter/engine#54544)
Fixes small typo in AppLifecycleState enum documentation. Documentation to enum references iOS article about managing app lifecycle in UIKit. So, "IOKit" is a misspelled word "UIKit"

I found out Apple has [IOKit framework](https://developer.apple.com/documentation/iokit) but it is not related to app lifecycle

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-08-15 20:27:39 +00:00
Brandon DeRosier
b19fe31562 Revert "[Impeller] remove scene3d support." (flutter/engine#54502)
Reverts flutter/engine#54453

Not quite ready to remove Impeller Scene yet because I'm still porting
the animation functionality. Keeping it around allows me to switch back
and forth to compare without having to recompile the engine.

Over a month ago I said something like "we can revert this a couple of
weeks from now" in one of the Impeller meetings. But for better or worse
(better, I think), I ended up spending a ton of time trying to make the
PBR good first (which doesn't exist in this C++ version).
2024-08-12 10:28:51 -07:00
Jonah Williams
198d1f1077 [Impeller] remove scene3d support. (flutter/engine#54453)
Now that Flutter GPU is a preview, the technical debt from having an ifdef controlled additional rendering mode can be removed.
2024-08-09 16:38:56 +00:00
Alexander Aprelev
9cfb0f4947 Remove obsolete dependency (flutter/engine#54161)
The concurrent_api/concurrent_api_product targets were made obsolete by
95f5efc697
2024-07-27 07:18:17 -07:00
auto-submit[bot]
7b931a25de Reverts "Reverts "Drop deprecated hash_code functions (#54000)" (#54002)" (flutter/engine#54004)
Reverts: flutter/engine#54002
Initiated by: kevmoo
Reason for reverting: the issue in google 3 has been fixed.
Original PR Author: auto-submit[bot]

Reviewed By: {fluttergithubbot}

This change reverts the following previous change:
Reverts: flutter/engine#54000
Initiated by: chingjun
Reason for reverting: Broke Google Testing.

See b/352191023 for more details.
Original PR Author: kevmoo

Reviewed By: {jonahwilliams}

This change reverts the following previous change:
Fixes https://github.com/flutter/flutter/issues/151679
2024-07-19 14:54:29 +00:00
auto-submit[bot]
b23bc03d6d Reverts "Drop deprecated hash_code functions (#54000)" (flutter/engine#54002)
Reverts: flutter/engine#54000
Initiated by: chingjun
Reason for reverting: Broke Google Testing.

See b/352191023 for more details.
Original PR Author: kevmoo

Reviewed By: {jonahwilliams}

This change reverts the following previous change:
Fixes https://github.com/flutter/flutter/issues/151679
2024-07-19 05:33:47 +00:00
Kevin Moore
fdd23ed3f2 Drop deprecated hash_code functions (flutter/engine#54000)
Fixes https://github.com/flutter/flutter/issues/151679
2024-07-19 02:11:17 +00:00
Matan Lurey
50e4e12c2e Add a "pub workspace" to the root of the engine repository (flutter/engine#53539)
... and use it in `engine_tool` to prove everything is working, i.e. on CI and elsewhere.

Partial work towards https://github.com/flutter/flutter/issues/147883.
Supersedes and closes https://github.com/flutter/engine/pull/51782 (which was a prototype).

See also:
- https://flutter.dev/go/pub-workspace, the design doc on the feature.
- https://github.com/dart-lang/pub-dev/pull/7762, an example PR.

I'll probably end up moving the inline docs in `pubspec.yaml` to a `docs/*.md` once that's a thing.
2024-07-18 16:18:09 +00:00
Yegor
d7c9dafda7 [web] switch to SemanticsAction.focus (attempt 3) (flutter/engine#53689)
This relands https://github.com/flutter/engine/pull/53679.

The difference from the previous attempt is in the last commit, which prevents synthetic focus requests from echoing back into the framework. That part broke too many tests in g3 and needs to be revisited.

## Original description

Stop using `SemanticsAction.didGain/LoseAccessibilityFocus` on the web, start using `SemanticsAction.focus`. This is because on the web, a11y focus is not observable, only input focus is. Sending `SemanticsAction.focus` will guarantee that the framework move focus to the respective widget. There currently is no "unfocus" signal, because it seems to be already covered: either another widget gains focus, or an HTML DOM element outside the Flutter view does, both of which have their respective signals already.

More details in the discussion in the issue https://github.com/flutter/flutter/issues/83809.

Fixes https://github.com/flutter/flutter/issues/83809
Fixes https://github.com/flutter/flutter/issues/148285
Fixes https://github.com/flutter/flutter/issues/143337
2024-07-15 17:12:21 +00:00
Kevin Moore
8c1a2c2c51 Drop self-references to hash functions from doc comments (flutter/engine#53844)
Towards https://github.com/flutter/flutter/issues/151679
2024-07-13 04:33:48 +00:00
Jason Simmons
604637e41f Manual roll Dart SDK from fb546f313557 to 797d3df745d1 (8 revisions) (flutter/engine#53832)
Includes patches needed for the dart:concurrent package (see https://dart.googlesource.com/sdk/+/d2bc055651cf62c549933ed379d6b23d84a07598)

Manual roll requested by jsimmons@google.com

https://dart.googlesource.com/sdk.git/+log/fb546f313557..797d3df745d1

2024-07-11 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com Version 3.6.0-34.0.dev 2024-07-11 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com Version 3.6.0-33.0.dev 2024-07-11 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com Version 3.6.0-32.0.dev 2024-07-11 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com Version 3.6.0-31.0.dev 2024-07-11 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com Version 3.6.0-30.0.dev 2024-07-11 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com Version 3.6.0-29.0.dev 2024-07-11 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com Version 3.6.0-28.0.dev 2024-07-11 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com Version 3.6.0-27.0.dev

If this roll has caused a breakage, revert this CL and stop the roller using the controls here:
https://autoroll.skia.org/r/dart-sdk-flutter-engine Please CC bdero@google.com,dart-vm-team@google.com,jsimmons@google.com on the revert to ensure that a human is aware of the problem.

To file a bug in Flutter Engine: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
2024-07-12 01:28:10 +00:00
Jonah Williams
ac871bacc2 [dart:ui] remove expensive index assertion in Vertices. (flutter/engine#53558)
Iterating through every index value is really, really expensive. Especially if users are suppllying hundreds of thousands of vertices.
2024-07-11 22:13:04 +00:00
auto-submit[bot]
5a218a1b99 Reverts "dart:ui - drop deprecated hash functions (#53787)" (flutter/engine#53794)
Reverts: flutter/engine#53787
Initiated by: jiahaog
Reason for reverting: There are still internal users of these hash functions (b/352191023). Flutter also exports it [here](72f83d3237/packages/flutter/lib/src/painting/basic_types.dart (L58)) so its easy for developers to use them even without importing `dart:ui`. Though it's an easy fix, I'd imagine this to be a breaking change for the OSS ecosystem a
Original PR Author: kevmoo

Reviewed By: {jonahwilliams}

This change reverts the following previous change:
These were deprecated a LONG time ago
2024-07-10 03:16:50 +00:00
John McDole
ea09bae632 Impeller really wants premultiplied alpha (flutter/engine#53770)
Fixes flutter/flutter#151210 by premultiplying alpha in the rare case we
get straight alpha.
2024-07-09 17:07:31 -07:00