2518 Commits

Author SHA1 Message Date
Jonah Williams
298fba8a45 [Impeller] allocate the impeller onscreen texture from the render target cache. (flutter/engine#55943)
Otherwise with backdrop filters we create and throw away a single fullscreen texture every frame. Very wasteful!

Does not impact iOS because it has the read from resolve option. Removed some unused parts of the inline_pass_context that were only used in the entity pass days.
2024-10-18 22:24:31 +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
Chinmay Garde
cf27a7a314 [Impeller] libImpeller: Allow custom font registrations. (flutter/engine#55934)
Fixes https://github.com/flutter/flutter/issues/156361

cc @lyceel. A bit of miscommunication on the priority of this one. I
thought the default font factories were sufficient for the next release.
But it turns out that was not true on the board which is a custom
platform.

In any case, this should unblock custom font registrations. See the
`CanCreateParagraphsWithCustomFont` case for an example. If you don't
provide the family name alias for the custom font, the name will be read
from the font data. This example uses the custom "WhatTheFlutter" custom
font family in "wtf.otf".

<img width="1136" alt="Screenshot 2024-10-17 at 1 26 36 PM"
src="https://github.com/user-attachments/assets/dbbef2fd-f854-4330-8c82-fc8378489769">
2024-10-18 14:46:58 -07:00
Chinmay Garde
961bddda02 [Impeller] libImpeller: Add a README. (flutter/engine#55940) 2024-10-18 20:26:15 +00:00
auto-submit[bot]
3089ce059c Reverts "[Impeller] one descriptor pool per frame. (#55939)" (flutter/engine#55959)
Reverts: flutter/engine#55939
Initiated by: jonahwilliams
Reason for reverting: failing on scenario test
Original PR Author: jonahwilliams

Reviewed By: {matanlurey}

This change reverts the following previous change:
Creating descriptor pools is expensive, no need to have more than one per frame.

The lifecycle of the descriptor pool is exactly the same as the cmd pool, which indicates that we can probably do some consolidation/refactoring in the future.

Fixes https://github.com/flutter/flutter/issues/157115
2024-10-18 19:23:46 +00:00
Jonah Williams
e203f1d40b [Impeller] one descriptor pool per frame. (flutter/engine#55939)
Creating descriptor pools is expensive, no need to have more than one per frame.

The lifecycle of the descriptor pool is exactly the same as the cmd pool, which indicates that we can probably do some consolidation/refactoring in the future.

Fixes https://github.com/flutter/flutter/issues/157115
2024-10-18 17:50:08 +00: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
Jonah Williams
ccaa49bdb4 [Impeller] use render pass to transition attachments to eGeneral instead of barriers. (flutter/engine#55930)
From local testing:

1. This is slightly faster
2. This still renders correctly even on old phones (S10)
3. This is validation error clean.

---------------

The vk RenderPass has a built in mechanism to transition the attachments between layout states. Since we expect the images to be in eGeneral layout, we can configure the render pass to do an eUnderfined -> eGeneral  transition. eUnderfined means "we don't care what was here before". This is OK because we're about to clear the texture anyway.

Since the RenderPass is doing the transition, we don't need an explicit barrier. All we have to do is update our own state tracking mechanism that the image attachments should behave as if they were in eGeneral layout  - because they are once the render pass is started.
2024-10-18 03:58:23 +00:00
Brandon DeRosier
518ada1675 [Flutter GPU] Remove Command/VertexBuffer usage from Flutter GPU. (flutter/engine#55893)
Resolves https://github.com/flutter/flutter/issues/156764.
Resolves https://github.com/flutter/flutter/issues/155335.

- Remove Command/VertexBuffer from Flutter GPU.
- Separate vertex/index count into `impeller::RenderPass::SetElementCount(size_t count)` & accurately document its behavior.
- Make Flutter GPU uniform/texture bindings re-assignable.
- Remove unnecessary templates.
2024-10-17 22:39:19 +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
d3ed232dab [Impeller] flood input coverage with destructive color filter. (flutter/engine#55758)
Fixes https://github.com/flutter/flutter/issues/126389
Fixes https://github.com/flutter/flutter/issues/137090
Fixes https://github.com/flutter/flutter/issues/154035

If this bit is set, the output of a color filter should flood to the input of a filter to parent clip. We're not checking this right now and so all color filter content is treated as bounded.

This needs to flood the input as the image filter (which occurs afterwards) should process the flooded input.
2024-10-17 02:30:01 +00:00
Brandon DeRosier
b90e88b20f [Impeller] Correct glBlitFramebuffer emulation todo. (flutter/engine#55919) 2024-10-17 01:20:17 +00:00
gaaclarke
b69edd9e6a Starts looking for the bdf fast path in relation to the snapshot_entity's transform (flutter/engine#55890)
fixes https://github.com/flutter/flutter/issues/156871

testing: performance change covered by existing benchmarks.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-10-16 20:13:25 +00:00
Chinmay Garde
0157e502c4 [Impeller] libImpeller: Initialize the base paragraph style lazily. (flutter/engine#55891)
Thanks to the @lyceel for the failing test case.
<img width="1136" alt="Screenshot 2024-10-15 at 4 01 27 PM" src="https://github.com/user-attachments/assets/eeecba1d-eecb-4f29-878f-caf4c674a836">
2024-10-16 00:35:12 +00:00
Jonah Williams
0077bfe80a [Impeller] remove extra copy from drawPoints. (flutter/engine#55872)
Remove the extra host -> host copy performed by the VertexBufferBuilder. Instead, write the drawPoint geometry right into the transients buffer.

https://github.com/flutter/flutter/issues/152702
2024-10-15 15:45:20 +00:00
Brandon DeRosier
50b5307332 [Impeller] Allow binding multiple vertex buffer views. (flutter/engine#55856)
Resolves https://github.com/flutter/flutter/issues/116168.
(Continuation of https://github.com/flutter/engine/pull/49670)

Makes it possible for us to use arbitrary vertex layouts, including SoA layouts with attributes stored in different DeviceBuffers. CanRenderPerspectiveCube was converted to an SoA attribute layout with two separate buffers as an example.

Works on all the backends!

OpenGLES:
<img width="1136" alt="image" src="https://github.com/user-attachments/assets/e2398fde-532f-402d-899a-39aaa556f24f">

Vulkan:
<img width="1136" alt="image" src="https://github.com/user-attachments/assets/1c1bf664-bec1-43cb-ab2e-eb2a74718bfd">

Metal:
<img width="1136" alt="image" src="https://github.com/user-attachments/assets/bf59da17-cf52-4913-88e4-ab6f0bd6fc96">
2024-10-15 01:13:52 +00:00
Jonah Williams
61460afe48 [Impeller] remove STB backend. (flutter/engine#55842)
Delete the STB typographer backend.

Fixes https://github.com/flutter/flutter/issues/156429
2024-10-14 18:16:20 +00:00
Brandon DeRosier
dd68ebf2fb [Impeller] Add miplevel to Buffer->Texture blit. (flutter/engine#55848)
Part of https://github.com/flutter/flutter/issues/156641
2024-10-14 16:53:19 +00:00
Jonah Williams
c9f0e8a458 [Impeller] delete a bunch of dead filter code. (flutter/engine#55841)
All of these filter graph methods are not used or only used to test themselves in a limited unit test. Delete!
2024-10-12 02:15:23 +00:00
Chinmay Garde
225aa6dee4 [Impeller] libImpeller: Fix missing exports on some paint methods. (flutter/engine#55814)
cc @lyceel. I'll followup with a linker script to to verify this later.
2024-10-11 17:51:26 +00:00
Jim Graham
3f0d57e071 [DisplayList] Create DlFoo type variants to start moving away from Skia types in API (flutter/engine#55812)
This is the beginning of the bulk of de-skia-fication work in the engine. All of the standard types in the DlCanvas API now have overloads that specify the corresponding Dl type, mainly for Dl*Rect and DlPoint types. This enables further work to switch from SkFoo types to DlFoo types in the various engine modules culminating in the elimination of the old methods that use the Sk types.

All of the former methods that used the basic Sk types are now implemented as inlinable translation overloads and the underlying implementations of DlCanvas now implement only the newer style interfaces so that they don't need to be further modified as we eliminate the old Skia types from the interface.

There are still a couple of Skia types remaining in the DlCanvas API without any DL type variants which will be handled in a future phase:
- SkRRect
- SkRSXform
- SkTextBlob (will be hidden behind a common interface along with TextFrame)
- SkImageInfo (only used in a few calling sites)
2024-10-11 00:42:23 +00:00
Chinmay Garde
9910c947f6 [Impeller] libImpeller: Publish SDK artifacts. (flutter/engine#55783)
Fixes https://github.com/flutter/flutter/issues/156358
2024-10-09 20:35:28 +00:00
Chinmay Garde
57e4161fd8 [Impeller] libImpeller: Allow creating image color sources. (flutter/engine#55754)
Fixes https://github.com/flutter/flutter/issues/156360

This was missed in the earlier bringup.

cc @lyceel I did not expose the solid color source since (as @jonahwilliams [pointed out](https://github.com/flutter/flutter/issues/156360#issuecomment-2398005436)) all it does it [clear the current color source and set the color on the paint](a01daf5555/display_list/dl_builder.cc (L206)).
2024-10-09 20:11:49 +00:00
Matan Lurey
d62fed45f7 Rename GetTargetRenderPassDescriptor to GetRenderTarget. (flutter/engine#55765)
Closes https://github.com/flutter/flutter/issues/154799.
2024-10-09 15:44:41 +00:00
Chinmay Garde
511ee36f3f [Impeller] libImpeller: Allow fetching OpenGL texture handle. (flutter/engine#55753)
Fixes https://github.com/flutter/flutter/issues/156359

cc @lyceel
2024-10-09 07:44:37 +00:00
Brandon DeRosier
e118869e40 [Flutter GPU] Get the GLES backend/Windows working. (flutter/engine#55694)
Resolves https://github.com/flutter/flutter/issues/156305.

* Resolve pipelines and submit command buffers on the raster thread.
* Don't use desktop GL shader variation on Windows.
* Fix interpretation of `array_elements`.
* Fix texture binding metadata.

Gets Flutter GPU working on Windows!
![image](https://github.com/user-attachments/assets/9eecb67f-a980-4556-8060-b0c947713534)
![image](https://github.com/user-attachments/assets/c8e2071f-e7c0-411c-8f37-e1f3037916f4)
2024-10-09 00:04:39 +00:00
gaaclarke
90cea20d09 fixes mask blurs on stoked gradient geometry (flutter/engine#55717)
fixes https://github.com/flutter/flutter/issues/155930

This starts taking into account the translation of the entity that is
snapshotted when performing the gaussian blur. I'm uncertain under what
conditions, but sometimes the snapshot logic would need this offset. The
linked issue and added tests demonstrate those cases.

## 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-08 15:20:50 -07:00
Jason Simmons
d8d3d6ac4b [Impeller] Do not scale the miter limit applied to stroked text (flutter/engine#55745)
Fixes https://github.com/flutter/flutter/issues/156224
2024-10-08 22:07:19 +00:00
Chinmay Garde
50366d309d [Impeller] libImpeller: Fix typo in public API. (flutter/engine#55750)
cc @lyceel
2024-10-08 20:50:13 +00:00
Chinmay Garde
7af6ae84e6 [Impeller] libImpeller: Allow wrapping external texture handles. (flutter/engine#55664)
Fixes https://github.com/flutter/flutter/issues/156013
2024-10-08 20:33:26 +00:00
gaaclarke
d2e73aef5b Added mutex to the pending gpu tasks deque. (flutter/engine#55748)
b/371513051

The tasks are already capturing their target thread. I had just missed
guarding the deque that is storing the tasks. This has been seen in the
flaking of the newly added `ShellTest.EncodeImageRetryOverflows`.

Example:
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8734621687934134433/+/u/test:_Host_Tests_for_host_debug_unopt/stdout

## 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-08 13:19:42 -07:00
Jonah Williams
32aa60630b [Impeller] remove heap allocation of most geometry objects. (flutter/engine#55677)
Almost all geometry objects can now be stack allocated while rendering, instead of heap allocated - due to the removal of the EntityPass compositor. Clip geometries must still be heap allocated as the geometry objects are not yet stored in the display list, and the clips must be recorded for backdrop filter clip replay.

The canvas stores unique_ptrs to these geometries in a vector that it clears at the end of the frame. The Geometry factory methods were adjusted to return unique ptrs, and the Geometry class given a virtual dtor since we no longer rely on the special property of std::shared_ptr for memorizing the right dtor.

The ColorSourceContents and ClipContents class now hold onto a const ptr to the geometry object.

At some point in the future, we can rework the geometry object to be stored inline in the display list which will further simplify this code.

Part of https://github.com/flutter/flutter/issues/142054
2024-10-08 19:55:21 +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
Jonah Williams
3f50f56235 [Impeller] disable surface control on API 29. (flutter/engine#55708)
Fixes https://github.com/flutter/flutter/issues/155877

Technically SurfaceControl is supported on API 29 but I've observed enough reported bugs that I'm bumping the constraint to 30. If  we had more time to test all of these older devices maybe we could figure out if the problem is something that can be worked around.
2024-10-07 20:10:16 +00:00
Jonah Williams
086e6a63f5 [Impeller] remove Vulkan command encoder abstraction, use command buffer vk. (flutter/engine#55680)
The Vulkan command buffer wrapper delegates almost all of its functionality to the "CommandEncoderVK". I did not find that this separation was useful, as they have a 1-1 relationship and an identical lifecycle. Lets combine them to reduce the number of things to worry about.
2024-10-07 19:52:55 +00:00
Jonah Williams
b4d91f9d68 [Impeller] add parsing of known GPU models (flutter/engine#55196)
We will need to denylist certain Vulkan drivers. This is easier to do if we have some mechanism of determining which GPU model we're currently using. This doesn't add any new denylisting, it just ads a mechanism to parse the driver name into an enum. I mean, there are only so many SoCs, right?

See also https://github.com/flutter/flutter/issues/155185
2024-10-07 19:18:03 +00:00
Jonah Williams
fd33d17487 [Impeller] remove aiks color_filter and image_filter types. (flutter/engine#55654)
Like the color_source, these classes are just copies of the DL types. Use the DLTypes instead.

Part of https://github.com/flutter/flutter/issues/142054
2024-10-05 04:32:08 +00:00
Jonah Williams
767efe1ad7 [Impeller] remove usage of MaxBasisLength in favor of XY variant. (flutter/engine#55670)
MaxBasisXYZ prevents usage of scaling factors less than one since Z is almost always 1.

Fixes https://github.com/flutter/flutter/issues/153451
2024-10-05 00:16:37 +00:00
Jim Graham
7f99da5b92 [Impeller] Use a squircle-sdf-based algorithm for fast blurs (flutter/engine#55604)
Use a Squircle Signed Distance Field based algorithm to do a very fast approximation of rrect blurs.

This PR is to provide reference within the team to discuss the future of the algorithm compared to the Gaussian approximation functions that are currently in use. It isn't a complete solution, but can be completed easily with a little more work.

Notably, it doesn't handle elliptical round rects, only circular corners.
Could stand to include an attribution to the source (https://raphlinus.github.io/graphics/2020/04/21/blurred-rounded-rects.html)
2024-10-04 20:24:15 +00:00
Jonah Williams
9d8929af60 [Impeller] generate mipmaps for toImage. (flutter/engine#55655)
Fixes https://github.com/flutter/flutter/issues/156161

Mips must be eagerly generated for Picture.toImage and friends so that filter quality (mip sampling) works as expected.
2024-10-04 17:49:55 +00:00
Jonah Williams
959b7c6b60 [Impeller] clamp render target size at max texture size. (flutter/engine#55628)
Part of https://github.com/flutter/flutter/issues/128912

If an intermediate render target would be larger than the max texture size, then clamp the texture.
2024-10-04 03:39:14 +00:00
Jonah Williams
1cdd8d06be [Impeller] remove aiks color_source. (flutter/engine#55603)
Aiks color source is more or less a one to one copy of the impeller::DisplayListColorSource. We can rip it out, instead of flutter::DisplayList::ColorSource -> impeller::Aiks::ColorSource -> impelller:Entity::ColorSourceContents, just go directly flutter::DisplayList::ColorSource -> impelller:Entity::ColorSourceContents.

Part of https://github.com/flutter/flutter/issues/142054
2024-10-04 02:20:33 +00:00
Chinmay Garde
592c393867 [Impeller] A text layout and shaping API for the standalone library. (flutter/engine#55598)
This uses the same shaper as the rest of Flutter. The minimal ICU data configuration comes embedded in the dylib so there are no out-of-band packaging concerns.

<img width="1136" alt="Screenshot 2024-10-02 at 4 11 17 PM" src="https://github.com/user-attachments/assets/ce63dc99-7c3d-4b71-ac5d-926dffa5269b">

Fixes https://github.com/flutter/flutter/issues/156015
2024-10-03 19:36:02 +00:00
Jason Simmons
3ad82894c5 [Impeller] Do not cull in TextFrameDispatcher::drawDisplayList if the transform has perspective (flutter/engine#55602)
Fixes https://github.com/flutter/flutter/issues/155947
2024-10-03 19:26:05 +00:00
Jason Simmons
8478ab1dfb [Impeller] Fix handling of perspective matrices in Matrix::Translate (flutter/engine#55536)
Fixes https://github.com/flutter/flutter/issues/155450
2024-10-03 15:28:47 +00:00
gaaclarke
569ddd287e Vectorize rrect_blur (flutter/engine#55576)
issue: https://github.com/flutter/flutter/issues/148496

28% speed improvement in the rrect_blur shader.

## before
<img width="1728" alt="Screenshot 2024-10-01 at 3 45 46 PM" src="https://github.com/user-attachments/assets/643068a5-ab1e-4fa3-bc03-184b2ee4a6cf">

## after
<img width="1728" alt="Screenshot 2024-10-01 at 3 42 30 PM" src="https://github.com/user-attachments/assets/41445231-ffea-4279-8142-ce126df8187c">

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-10-03 00:07:22 +00:00
Jonah Williams
192939c3a6 [impeller] merge aiks directory into impeller/display_list directory. (flutter/engine#55471)
Aiks has been gutted, and most of the reming types need to be merged with dl/entity types and deleted. this is difficult to do with impeller/display_list and aiks as separate gn targets as it requires circular deps.

Lets merge them and remove the aiks directory.
2024-10-02 19:07:57 +00:00
Chinmay Garde
55cdf532e5 [Impeller] Create a libImpeller dylib and expose symbols. (flutter/engine#55526) 2024-09-30 20:04:15 +00:00
Jason Simmons
faa865b425 [Impeller] Apply some recent color filter fixes to BlendFilterContents::CreateForegroundAdvancedBlend (flutter/engine#55470)
Some recent changes affecting color filters (https://github.com/flutter/engine/pull/55411, https://github.com/flutter/engine/pull/55448) need to be done for both Porter-Duff and advanced blend modes
2024-09-27 21:42:49 +00:00