1343 Commits

Author SHA1 Message Date
Brandon DeRosier
072ed208cf [Impeller] Use 32 bit for positional stuff in the rrect blur (flutter/engine#42797)
Resolves https://github.com/flutter/flutter/issues/128410.

16 bit floats aren't precise enough for positional computations, like
computing SDFs in the case of the RRect blur.
2023-06-17 22:57:14 -07:00
Jonah Williams
4114b30b01 Revert "[Impeller] correct default PSO pixel format and sample count." (flutter/engine#42962)
Reverts flutter/engine#42902

This is breaking iOS builds:

https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8778085761769326737/+/u/run_platform_views_scroll_perf_non_intersecting_impeller_ios__timeline_summary/test_stdout
2023-06-18 04:39:22 +00:00
Brandon DeRosier
080271007d [Impeller] Print malioc errors on CI (flutter/engine#42906)
Resolves https://github.com/flutter/flutter/issues/128989.

Also bumps the buildroot to head for:
https://github.com/flutter/buildroot/pull/744
2023-06-16 21:37:37 -07:00
Jonah Williams
68ce594530 [Impeller] correct default PSO pixel format and sample count. (flutter/engine#42902)
Despite compiling an initial PSO variant for every shader, in practice these were completely useless as they had a sample count of 1 (instead of 4 for MSAA) and an invalid pixel format.

Correct the defaults so they may be usful.

Not enough to fix https://github.com/flutter/flutter/issues/128963 , because we still have far too much state for Vulkan to handle
2023-06-16 20:53:02 +00:00
gaaclarke
c3105fa995 [Impeller] Joined obligatory vulkan swapchain submits (flutter/engine#42865)
Every frame we submit to the queue a layout transition and a notify to the `acquire` fence.  This joins those together into one `vkQueueSubmit` call.  Thus eliminating a fence that was happening after the layout transition.

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

## testing results from the gallery driver test
```
Before:
  "average_frame_build_time_millis": 1.379130952380952,
  "90th_percentile_frame_build_time_millis": 1.965,
  "99th_percentile_frame_build_time_millis": 20.246,
  "worst_frame_build_time_millis": 29.578,
  "missed_frame_build_budget_count": 7,
  "average_frame_rasterizer_time_millis": 20.447408955223867,
  "90th_percentile_frame_rasterizer_time_millis": 25.398,
  "99th_percentile_frame_rasterizer_time_millis": 160.198,
  "worst_frame_rasterizer_time_millis": 178.042,
  "missed_frame_rasterizer_budget_count": 122,
  "frame_count": 336,
  "frame_rasterizer_count": 335,
  "new_gen_gc_count": 0,
  "old_gen_gc_count": 0,
  "frame_build_times": [
after:
  "average_frame_build_time_millis": 1.1907232876712324,
  "90th_percentile_frame_build_time_millis": 1.926,
  "99th_percentile_frame_build_time_millis": 16.666,
  "worst_frame_build_time_millis": 27.39,
  "missed_frame_build_budget_count": 5,
  "average_frame_rasterizer_time_millis": 15.525100817438704,
  "90th_percentile_frame_rasterizer_time_millis": 20.116,
  "99th_percentile_frame_rasterizer_time_millis": 33.835,
  "worst_frame_rasterizer_time_millis": 56.075,
  "missed_frame_rasterizer_budget_count": 156,
  "frame_count": 365,
  "frame_rasterizer_count": 367,
  "new_gen_gc_count": 0,
  "old_gen_gc_count": 0,
```

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-06-15 19:50:10 +00:00
Jonah Williams
b1f2905fbf [Impeller] Make interleaved layout (more) explicit in generated headers. (flutter/engine#42628)
Working on https://github.com/flutter/engine/pull/42415 , I found that it was difficult to customize the buffer layout as the interleaved layout is implicitly confiured in the backends. Rather than bake another built in layout, I've pulled (most) information about buffer layout into the generated headers so it is explicitly confiured, which should allow easier customization as the backend has fewer choices to make.

TBD whether or not we need to do something weird for GLES since stride has a different meaning there...

Work towards https://github.com/flutter/flutter/issues/116168
2023-06-14 20:04:35 +00:00
Dan Field
8cbdaca6a8 Make validation logs ERROR level (flutter/engine#42825)
INFO logs do not show up in normal logging unless an extra flag is passed by the tool (and it is a different flag from the "-v" flag).

This means bug reports that include logs about impeller are missing the validation errors, which makes them harder to triage and dedupe.

Fixes https://github.com/flutter/flutter/issues/128808
2023-06-13 22:43:53 +00:00
gaaclarke
162698d8fd [Impeller] Added cache for command buffers in vulkan (flutter/engine#42793)
issue https://github.com/flutter/flutter/issues/118727

## 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 Hixie said 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
[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
2023-06-13 15:03:10 -07:00
Jason Simmons
2a730bfe52 [Impeller] Null check for the device holder in the Vulkan context destructor (flutter/engine#42821) 2023-06-13 21:03:12 +00:00
Jonah Williams
99b4037a19 [Impeller] Ensure vulkan offscreen pixelformat is the same as the onscreen format (flutter/engine#42788)
Fixes https://github.com/flutter/flutter/issues/128604

THe problem was that we were selecting kB8G8R8A8UNormInt for the
offscreen and kR8G8B8A8UNormInt for the onscreen, so the blit was
swapping the color channels.
2023-06-12 18:21:51 -07:00
Jonah Williams
0721bf1a95 [Impeller] Fix text jitter on Vulkan. (flutter/engine#42792)
Fixes https://github.com/flutter/flutter/issues/128624
2023-06-12 23:48:11 +00:00
Jonah Williams
a9b8415bfc [Impeller] Correct attachment description for offscreen MSAA resolve. (flutter/engine#42753)
Two issues:

1. The resolve texture is created from the same impeller attachment as the msaa attachment, so the store mode was getting set to dont care instead of store.

2. the image layout for the resolve attachment should be ePresentSrcKHR, at least from following the guide at https://vulkan-tutorial.com/Multisampling

Fixing both of these locally fixes all of the weird offscreen cursed rendering.

Fixes https://github.com/flutter/flutter/issues/128600
2023-06-12 18:01:07 +00:00
Jonah Williams
6eb184bed6 [Impeller] opt all vertex shader position/uvs into highp (flutter/engine#42746)
Fixes https://github.com/flutter/flutter/issues/128605

f16 doesn't have enough resolution at large pixel values to be safely used for positions. Opt all shaders into highp. I think we might be able to get away with mediump for uv since values from 0-1 should have plenty of precisision, but we can worry about that later.
2023-06-12 16:11:47 +00:00
gaaclarke
25e060e7bc [Impeller] added debug info to frame debuggers like AGI (flutter/engine#42717)
fixes https://github.com/flutter/flutter/issues/128629

Screenshot of the change in action:
<img width="740" alt="Screenshot 2023-06-09 at 4 30 48 PM"
src="https://github.com/flutter/engine/assets/30870216/3923c992-323b-466c-bab7-18097c6d1ee2">


## 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.
- [ ] I added new tests to check the change I am making or feature I am
adding, or Hixie said 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
[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
2023-06-12 09:11:12 -07:00
Jim Graham
0b6d9a337c Reland "add non-rendering operation culling to DisplayListBuilder" (#41463) (flutter/engine#42584)
This reverts commit 01aeff259aa37b93304d5dea20e38302e79bf84a.

Fixes https://github.com/flutter/flutter/issues/125338

This PR should fix the blendmode/color analysis that caused failures for https://github.com/flutter/engine/pull/41463 as well as the bounds failures for inverted rectangles that caused failures for https://github.com/flutter/engine/pull/42330 (incorporating the fix from https://github.com/flutter/engine/pull/42556).

The description from the [previous PR](https://github.com/flutter/engine/pull/41463) updated with the new name of the DL property:

---------------------------------
This optimization avoids recording unnecessary render operations that will not affect the output and also eliminates the need for "draw detection" mechanisms like `DlOpSpy` and `CanvasSpy` by remembering if any non-transparent operations were included. The `DlOpSpy` unit tests were updated to check if the results from that object match the new `DisplayList::modifies_transparent_black()` method.

Fixes https://github.com/flutter/flutter/issues/125338

In addition, this change will unblock some other Issues:

- https://github.com/flutter/flutter/issues/125318
- https://github.com/flutter/flutter/issues/125403
2023-06-11 21:14:24 +00:00
ColdPaleLight
4f49c89943 [Impeller] Improved numerical stability in cubic path boundary calculations (flutter/engine#42720)
fix https://github.com/flutter/flutter/issues/128532

In this commit, we refined the method for calculating cubic path boundaries in CubicPathBoundingPopulateValues function. By adopting an alternative quadratic formula from Numerical Recipes in C (The code is ported from skia's `SkFindUnitQuadRoots`),  we mitigated numerical errors, hence boosting precision and reliability in handling cubic paths.
2023-06-11 04:02:05 +00:00
Jonah Williams
2142fff539 [Impeller] Fix vulkan gradient nan issue. (flutter/engine#42715)
Fixes https://github.com/flutter/flutter/issues/128603

We were hitting a nan issue. GLSL has different relaxed precision semantics than vulkan does, and didn't hit it for some reason.
2023-06-10 17:14:29 +00:00
gaaclarke
36730c35a9 [Impeller] Added helper messaging around validation usage (flutter/engine#42708)
Adds some helper messages around using validation layers.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-06-09 23:07:51 +00:00
Brandon DeRosier
9d1159855f [Impeller] Add CPU implementations for all color filters (flutter/engine#42692)
Part of https://github.com/flutter/flutter/issues/127232.

Adds a CPU implementation for ColorMatrix and the color space
conversions. Also changes the blend signature for consistency.

These will be necessary to make the mask blur fast path continue working
in the presence of color filters. In general, we can use these to
eliminate a needlessly expensive image-based color filter for the
non-image color sources.
2023-06-09 11:13:05 -07:00
Jonah Williams
71009220e0 [Impeller] add explicit VMA flush to device memory writes. (flutter/engine#42685)
According to my read of the documentation for VMA/Vulkan allocation docs, setting VK_MEMORY_PROPERTY_HOST_COHERENT_BIT means we shouldn't need to flush the memory. nevertheless, this fixes the corruption of host buffers observed in https://github.com/flutter/flutter/issues/124040

Fixes https://github.com/flutter/flutter/issues/124040

> VK_MEMORY_PROPERTY_HOST_COHERENT_BIT bit specifies that the host cache management commands [vkFlushMappedMemoryRanges](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkFlushMappedMemoryRanges.html) and [vkInvalidateMappedMemoryRanges](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkInvalidateMappedMemoryRanges.html) are not needed to flush host writes to the device or make device writes visible to the host, respectively.

🤷‍♂️
2023-06-09 17:23:09 +00:00
Jonah Williams
fb0c47c6ec [Impeller] disable buffer to texture blit for Vulkan. (flutter/engine#42686)
This fixes some f'd up ness in the images. Will need to debug this separately on Android. For now, we can just turn it off in the caps.
2023-06-09 15:53:56 +00:00
Brandon DeRosier
320a689d5e [Impeller] Add tests for foreground blends with mask blurs (flutter/engine#42687)
Part of https://github.com/flutter/flutter/issues/127232.

Both of these tests should be rendering as a clipped and blurred green circle. Making mask blurs interact correctly with color filters is not going to be trivial... These bugs extend beyond the filter graph itself. Want to get some goldens in to compare against.

ForegroundPorterDuffBlend:
![Screenshot 2023-06-08 at 4 58 54 PM](https://github.com/flutter/engine/assets/919017/e5592b35-1054-48f3-91e4-c97136a2ecfd)

ForegroundAdvancedBlend:
![Screenshot 2023-06-08 at 4 58 38 PM](https://github.com/flutter/engine/assets/919017/8de5d12a-6413-4436-aa35-f3a4ef09615f)
2023-06-09 01:15:07 +00:00
Brandon DeRosier
3dd6e55e45 [Impeller] Reorder blend filter checks to avoid unnecessary destination snapshot (flutter/engine#42678)
Side quest of https://github.com/flutter/flutter/issues/127232.

Tiny reordering to avoid unnecessary input resolution. :) Happened to notice we were hitting this case while going through some frame captures of reported fidelity issues.

Before:
![Screenshot 2023-06-08 at 1 45 48 PM](https://github.com/flutter/engine/assets/919017/aae28b7d-985d-4f16-9801-c689f8dc6f18)

After:
![Screenshot 2023-06-08 at 1 48 49 PM](https://github.com/flutter/engine/assets/919017/b667a4cd-bcf7-4e3a-98f7-0ed182b7a227)
2023-06-08 22:00:56 +00:00
Brandon DeRosier
81a4a5e34b [Impeller] Specify blend mode on blend filter commands (flutter/engine#42676)
Side quest of https://github.com/flutter/flutter/issues/127232.

This is particularly useful for debugging pipeline blend variations of the blend filter, since we otherwise have to look at the raw pipeline blend ops and figure out and piece together what the blend mode must've been.
2023-06-08 21:58:59 +00:00
Jonah Williams
e448fff0da [Impeller] sort all vertex inputs by location. (flutter/engine#42664)
Fixes https://github.com/flutter/flutter/issues/128283

Why doesn't this happen elsewhere? might depend on how spirv compiles shaders or the order they run in. Long term fix is https://github.com/flutter/engine/pull/42628 which computes all offset data in the compiler

![flutter_04](https://github.com/flutter/engine/assets/8975114/645c5db6-4f2f-42f7-af8f-6230bba72b2b)
2023-06-08 17:23:52 +00:00
ColdPaleLight
437cbb1154 [Impeller] Corrected the 'texture_coords' computation in 'Geometry::GetPositionUVBuffer' (flutter/engine#42619)
fix https://github.com/flutter/flutter/issues/128328

We need to transform the 'position' first and then divide 'texture_coverage', otherwise the result will be incorrect.

without patch
![66WTKLw7fY](https://github.com/flutter/engine/assets/31977171/6d31138e-0595-4d9c-883e-70a50a5e228d)
with patch
![VAHrQB0HLk](https://github.com/flutter/engine/assets/31977171/0d75e2f8-126e-4ba0-8867-187a311249f4)
2023-06-07 21:44:54 +00:00
Jonah Williams
50626db959 [Impeller] Add buffer to texture blit for Vulkan. (flutter/engine#41706)
Work towards https://github.com/flutter/flutter/issues/123468

In order to support the usage of BufferView, I generalized the tracked buffer type from DeviceBuffer to Buffer. Should be mostly safe!

I confirmed that this runs correctly under moltenvk but I'm uncertain if there are additional ways to validate.
2023-06-07 19:32:48 +00:00
Brandon DeRosier
72a1fea6e2 [Impeller] Reland 2: Add Impeller Metal support in the embedder API (#42411) (flutter/engine#42597)
This reverts commit
8d6f091751
+ fixes bugs.

Reworked the surface wrapping to use a valid descriptor when wrapping
the drawable.
2023-06-06 23:02:02 -07:00
Zachary Anderson
8d6f091751 Revert "[Impeller] Reland: Add Impeller Metal support in the embedder API (#42411)" (flutter/engine#42593)
Reverts flutter/engine#42545

Not sure if this is needed, but getting a revert started for the
regression noted here:
https://github.com/flutter/engine/pull/42545#issuecomment-1579034704.
2023-06-06 10:57:57 -07:00
ColdPaleLight
ef42a7d173 [Impeller] Fix the rendering issue when the tile mode of gradient is set to 'decal' (flutter/engine#42591)
fix issue https://github.com/flutter/flutter/issues/128327
without patch 
![oOFhefzmN6](https://github.com/flutter/engine/assets/31977171/9d219ba8-b808-4de6-87ae-cc21e3b1411f)

with patch
![a5A81re5tD](https://github.com/flutter/engine/assets/31977171/7010b7b6-0d3b-481f-ac3b-36aeb1da1785)
2023-06-06 16:31:17 +00:00
ColdPaleLight
56a384d9da [Impeller] Make conical gradient work as expected (flutter/engine#42567)
fix https://github.com/flutter/flutter/issues/128012

In many instances (https://github.com/flutter/flutter/issues/128012#issuecomment-1577029031), the current implementation of conical gradient in impeller produces incorrect results. This pull request proposes to migrate the conical gradient algorithm from skia to impeller.

Please see ddf987d2ab/src/sksl/sksl_graphite_frag.sksl (L541-L666)

Test result
![FGcZZRCQZJ](https://github.com/flutter/engine/assets/31977171/4127e73d-81a9-4d3e-8430-cf511367362c)
2023-06-06 03:55:39 +00:00
Brandon DeRosier
fba5e2b514 [Impeller] Reland: Add Impeller Metal support in the embedder API (#42411) (flutter/engine#42545)
This reverts commit
45dd178414.

Original PR: https://github.com/flutter/engine/pull/42411

Part of https://github.com/flutter/flutter/issues/112230.
2023-06-05 14:51:43 -07:00
Matej Knopp
72876573ef Fix clang tidy error and crash (flutter/engine#42564)
Clang tidy checks for https://github.com/flutter/engine/pull/42399 are
failing for `formats_mtl.mm` and `context_mtl.mm`. Weirdly this happens
even though none of these files where modified in the branch.

For `context_mtl.mm` the fix is straightforward, just a missing
`std::move`.
For `formats_mtl.mm` clang-tidy actually crashes on the assignments to
`des.depthCompareFunction` and `des.depth_write_enabled`. The crash
doesn't happen if the assignment is done through a temporary variable.

I'm not sure if we should have a workaround for the crash or disable
clang-tidy on the file completely (FLUTTER_NOLINT).

## 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 Hixie said 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
[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
2023-06-05 19:37:12 +02:00
Zachary Anderson
af94169054 Check more optional accesses (flutter/engine#42528)
Related https://github.com/flutter/flutter/issues/127701
2023-06-05 08:38:32 -07:00
Brandon DeRosier
45dd178414 Revert "[Impeller] Add Impeller Metal support in the embedder API (#42411)" (flutter/engine#42532)
This reverts commit 666563a5544cf2a98a51c6b24e7bc03e265eedb0.

Expected to resolve https://github.com/flutter/flutter/issues/128145
2023-06-02 18:11:00 -07:00
Jonah Williams
567f166b13 [Impeller] Fix 1-d grid computation for compute (flutter/engine#42516)
Note that the 2d grid case is still incorrect. Consider: the grid size should be the number of compute units required, but the threadgroup size is a minimum number of compute units.

If I need to process a 50x50 image, I should be able to set a grid size of 50x50. Since the minimum threadgroup size is probably bigger (say 1024), this should turn into one dispatch of size (1, 1, 1). However with the current implementation, we will make a dispatch of (50, 50, 1), which essentially squares the amount of work - doing one thread group per unit of compute.

The correct implementation for 2d compute should take the mod of each grid dimension with the threadgroup size in that dimension. I did not fix this case as we do not have a use for 2d compute yet.
2023-06-03 00:04:04 +00:00
Jim Graham
01aeff259a Revert "Reland "add non-rendering operation culling to DisplayListBuilder" (#41463)" (flutter/engine#42525)
Reverts flutter/engine#42330

Some golden failures down the line were discovered in internal testing. See b/285539451
2023-06-02 21:59:50 +00:00
Jason Simmons
3e3bd3d547 [Impeller] Fix a bugprone-unchecked-optional-access warning in SurfaceMTL (flutter/engine#42518) 2023-06-02 11:59:42 -07:00
Jason Simmons
862953134f [Impeller] clang-tidy fixes (flutter/engine#42503) 2023-06-02 14:23:24 +00:00
Dan Field
bc1510d361 [Impeller] Compute in Vulkan (flutter/engine#42294)
Fixes https://github.com/flutter/flutter/issues/110622

- Updates capabilities checks for support
- Fixes a bug where SSBOs were being treated as UBOs in render (and does the same work in compute).
- Fixes CommandEncoderVK::Submit so that it takes a completion callback and CommandBufferVK uses it to avoid sending a `kComplete` status to callers when it should really be `kPending`.
2023-06-01 23:40:51 +00:00
Jonah Williams
b06489fa4b [Impeller] Emplace directly into host buffer (avoid VBB) for text data (flutter/engine#42484)
From local testing, this shaves off about 0.3-4 ms of pure allocation overhead from https://github.com/flutter/flutter/issues/127760

### Before

![image](https://github.com/flutter/engine/assets/8975114/55701559-fba8-4f11-b606-f819d197626e)

### After

![image](https://github.com/flutter/engine/assets/8975114/b6843c13-d6c7-4364-86b1-c78e216307b3)
2023-06-01 22:34:58 +00:00
Brandon DeRosier
666563a554 [Impeller] Add Impeller Metal support in the embedder API (flutter/engine#42411)
Part of https://github.com/flutter/flutter/issues/112230.

Now seemed like the right time to sneak this in:
* We have large desktop refactors on the horizon (multi-window).
* We're starting to land optimizations that complicate the surface behavior such as wide gamut and dirty regions.
* We have plans to migrate the iOS embedder to use the embedder API (https://github.com/flutter/flutter/issues/112232).

![Screenshot 2023-05-30 at 6 59 48 PM](https://github.com/flutter/engine/assets/919017/16616be8-f94e-42ba-8a97-4ce4aa29e662)
2023-06-01 20:10:58 +00:00
Brandon DeRosier
205d491371 Fix lint in rectangle packer (flutter/engine#42489) 2023-06-01 11:54:09 -07:00
Jim Graham
a98c1eb274 Reland "add non-rendering operation culling to DisplayListBuilder" (#41463) (flutter/engine#42330)
The original PR caused some golden test failures down the line, likely due to bad analysis of when the combined BlendMode and color would result in a NOP situation.

This PR adds tests that go through every BlandMode and pair it with a variety of colors and Color/ImageFilters to verify that the operations are only omitted when they actually produce no change in the output. It also checks the validity of the "modifies_transparent_black" property of DisplayLists which can be used in place of the current CanvasSpy/DlOpSpy classes.

The description from the [previous PR](https://github.com/flutter/engine/pull/41463) updated with the new name of the DL property:

---------------------------------
This optimization avoids recording unnecessary render operations that will not affect the output and also eliminates the need for "draw detection" mechanisms like `DlOpSpy` and `CanvasSpy` by remembering if any non-transparent operations were included. The `DlOpSpy` unit tests were updated to check if the results from that object match the new `DisplayList::modifies_transparent_black()` method.

Fixes https://github.com/flutter/flutter/issues/125338

In addition, this change will unblock some other Issues:

- https://github.com/flutter/flutter/issues/125318
- https://github.com/flutter/flutter/issues/125403
2023-06-01 17:44:04 +00:00
Kevin Lubick
16737de589 Replace use of Skia's private GrRectanizer with a copy of the equivalent code (flutter/engine#42430)
Skia would like clients to not use their private types. This ports the
same functionality into Flutter's codebase with tests.

The implementation was copied from
[Skia](fa87b7c5ba/src/gpu/RectanizerSkyline.cpp)
and then modified to match Flutter's style and have a unit test.

## 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 Hixie said 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
[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
2023-05-31 14:10:33 -04:00
Jonah Williams
c77372b552 [Impeller] offload all text computation into vertex shader (flutter/engine#42417)
TextContents::Render occassionally shows up in the highest CPU functions. We can actually unload most of this computation into the vertex shader.
2023-05-31 00:30:04 +00:00
Zachary Anderson
9022cac6f8 Enables bugprone-unchecked-optional-access for some files (flutter/engine#42428) 2023-05-30 16:52:58 -07:00
gaaclarke
922c7250bd [Impeller] Fixed TypographerTest.MaybeHasOverlapping (flutter/engine#42429)
fixes https://github.com/flutter/flutter/issues/127714

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-05-30 23:33:00 +00:00
gaaclarke
25154333d5 [Impeller] Fixed GlyphAtlasWithLotsOfdUniqueGlyphSize (flutter/engine#42423)
fixes https://github.com/flutter/flutter/issues/127715

## 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 Hixie said 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
[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
2023-05-30 13:13:36 -07:00
Jonah Williams
ca82b02c1f [Impeller] delete position_uv, tiled_texture vertex shaders. (flutter/engine#42416)
tiled_texture.vert is identical to texture.vert, and position_uv is unused entirely.
2023-05-30 17:49:04 +00:00