2766 Commits

Author SHA1 Message Date
Jonah Williams
dbbfa2ff31
[Impeller] Workaround for mismatched transform in preroll vs paint for text frames. (#164931)
Fixes https://github.com/flutter/flutter/issues/164606

When we preroll the text frame, we record the scale/transform used to
compute the size and subpixel position. Use this same size + transform
for the subsequent paint so that it is not possible for it to mismatch.

This is not really a fix for the underlying issue where the subpixel
position may be mismatched.
2025-03-11 02:10:33 +00:00
Jonah Williams
4fef40c0f6
[Impeller] OpenGL MSAA for desktop/web devices. (#163939)
Add support for MSAA without the render to texture extension. This
allows our CI goldens to run with anti aliasing.

Fixes https://github.com/flutter/flutter/issues/158360 (again)
2025-03-10 23:16:28 +00:00
Jonah Williams
95e10121a8
[Impeller] Fixes to YUV imports on Android, Incomplete read of pipeline cache data, missing enabled extensions. (#164744)
- Handle textures that require a YUV import but aren't an undefined
format.
- INCOMPLETE is actually a success case for the pipeline cache. CERTAIN
drivers ALWAYS return incomplete, even when they wrote all the data.
Probably an off by one or something like that...
- Ensures Optional AndroidExtensions are enabled
- Only creates a YUV conversion if necessary
2025-03-10 22:43:36 +00:00
Jonah Williams
a7e276a20d
[Impeller] add capability check for extended range formats. (#164817)
Fixes https://github.com/flutter/flutter/issues/164794

We support devices that do not support XR formats. If we try to decode
to an XR format this will fail at runtime.
2025-03-08 02:43:08 +00:00
Tong Mu
83781ae65c
RoundSuperellipse algorithm v3: Ultrawideband heuristic formula (#164755)
This PR revises the algorithm for RoundSuperellipses, replacing the
current "max ratio" approximation with an algorithm that works for
ratios from 2.0 to infinity.

The previous "max ratio" approximation, which replaces the middle of
edges with straight lines when the ratio is above 2.3, turns out to
produce results too close to classic RRects. After reexamining the
shapes and more calculation, I discovered that the max-ratio
approximation is flawed. Even squircles with with really high ratios
(~100) have a significant part of the edges that must not be
approximated by straight lines.

The new version is much closer to native.

### Comparison
Native: (Notice the long wedgy gap at the end of curves)
<img
src="https://github.com/user-attachments/assets/61b60191-7d45-4c49-9e09-b0422243cd8c"
width="400"/>

Before PR: (Notice the short wedgy gap at the end of curves)
<img
src="https://github.com/user-attachments/assets/15ea374b-4b16-4187-aaa4-94f432fbb61e"
width="400"/>

After PR:
<img
src="https://github.com/user-attachments/assets/973ef4d1-7c26-44a9-b45e-10d109d5618b"
width="400"/>

Another example (after PR). Even though the rectangular RSE has ratios
of around 4, there are still curvature near the middle section of edges,
which can be identified with the help of antialias pixels.
<img width="838" alt="image"
src="https://github.com/user-attachments/assets/5078d098-c582-48a8-81e5-615909def675"
/>

### Details

I found that `n` has really good linearity towards larger ratios.

<img width="844" alt="image"
src="https://github.com/user-attachments/assets/73e99e45-a0f0-450b-8e2b-f6fd97082958"
/>

I also found a good candidate for the precomputed unknown (called
`k_xJ`), which has a smooth curve at the beginning and almost straight
line towards larger `n`, removing the need to cap the scope of
application of the formula.

<img width="1203" alt="image"
src="https://github.com/user-attachments/assets/67664898-2dbd-4f00-a9ba-d76030cf3742"
/>

The algorithm for paths are also updated in a similar way and
approximated the Bezier factors with heuristic formulae for bigger `n`s.
I've also verified that the path deviates from the geometry by no more
than 0.01% over the range of n [15, 100]

Theoretically removing "stretch" should simplify the algorithms.
Unfortunately I had to spend more lines to process cases of zero radii,
which were conveniently handled by stretches.


## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-03-08 02:39:09 +00:00
Jonah Williams
74a8d79e14
[Impeller] dont redundantly set stencil reference on vulkan backend. (#164763)
Cache the last stencil reference in RenderPassVK. If the requested
stencil reference is set to the same value, don't update it on the cmd
buffer.


Hypothetical performance improvement, but easy to do.
2025-03-07 22:53:26 +00:00
Jason Simmons
d14d2505f3
[Impeller] Store the TextureGLES cached framebuffer object as a reactor handle (#164761)
TextureGLES references may be owned by garbage collected objects. If a
GC drops the last reference to a TextureGLES, then the TextureGLES
destructor will run on a thread that does not have an EGL context. That
will cause failures when the destructor tries to delete the cached FBO
held by the TextureGLES.

This PR replaces the raw FBO handle with a ReactorGLES untracked handle.
The ReactorGLES will schedule deletion of the underlying FBO on a thread
that can call GLES APIs.
2025-03-07 18:50:23 +00:00
Jonah Williams
a45d325bad
[Impeller] test empty snapshot and allocation failure. (#164668)
Speculative fix for https://github.com/flutter/flutter/issues/164628

If our render target allocation failed, we need to bail out of toImage
so that we don't crash. Adds a test that simulates this by asking for a
0x0 texture.
2025-03-07 02:35:28 +00:00
gaaclarke
fef2adca24
Cleanup content context (#164229)
cleanup followup to https://github.com/flutter/flutter/pull/164058

This is just a refactor that makes content_context.h more manageable.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-03-05 21:07:25 +00:00
Jonah Williams
1cd6cb0cdc
[Impeller] fix macOS managed memory. (#164635)
Still crashes with non UMA GPU. Reason is that the if check is using
`MTLResourceStorageModeManaged` when it should be using
`MTLStorageModeManaged`

Fixes https://github.com/flutter/flutter/issues/163218
2025-03-05 20:40:20 +00:00
Jason Simmons
47a710ba99
Move flutter/third_party/txt into flutter/txt (#164248)
The flutter/txt library does not currently contain any third-party code.
2025-03-04 16:13:40 +00:00
gaaclarke
bffe0ffc50
Split up the conical gradient fragment shader (#164058)
fixes: https://github.com/flutter/flutter/issues/163580

testing: There are existing tests (AiksTest.CanRenderConicalGradient).
The compilation failure of the nexus 5 cannot be reproduced locally so
we can't assert this fixes the problem in a 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], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-02-27 23:30:53 +00:00
Jonah Williams
04cc4b1f11
[Impeller] Reland: move AHB check into Flutter main, don't disable ImageReader on 29. (#164201)
Rather than conditionally disabling AHBs, just disable Vulkan on devices
where AHB imports don't work. FIx from last time is in the last commit,
I reversed the string check accidentally and disabled vulkan everywhere
🥺

https://github.com/flutter/flutter/issues/163473
https://github.com/flutter/flutter/issues/160854
2025-02-26 20:53:57 +00:00
Jonah Williams
0b96fa88fd
[Impeller] work around for crashy Nexus 5 Driver. (#164040)
Rewrites exp to work around crashes on Nexus 5.
2025-02-26 17:54:53 +00:00
gaaclarke
8b3f5f4a2f
Added compilation failure if a max ubo size is exceeded (#164038)
issue: https://github.com/flutter/flutter/issues/163580

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-02-26 17:36:00 +00:00
Tong Mu
a3e9df35aa
[Engine] Remove dead code for RoundedSuperellipse (#164163)
Remove dead code that occurred during development and I forgot to
remove.

## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-02-26 09:59:05 +00:00
auto-submit[bot]
cca82ed93b
Reverts "[Impeller] move AHB check to Vulkan, use Vulkan surface on 29. (#164109)" (#164166)
<!-- start_original_pr_link -->
Reverts: flutter/flutter#164109
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: jonahwilliams
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: brain not work too good.
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: jonahwilliams
<!-- end_original_pr_author -->

<!-- start_reviewers -->
Reviewed By: {matanlurey}
<!-- end_reviewers -->

<!-- start_revert_body -->
This change reverts the following previous change:
Rather than conditionally disabling AHBs, just disable Vulkan on devices
where AHB imports don't work.

https://github.com/flutter/flutter/issues/163473
https://github.com/flutter/flutter/issues/160854
<!-- end_revert_body -->

Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
2025-02-26 04:32:26 +00:00
Jonah Williams
8b3f1a4c0f
[Impeller] move AHB check to Vulkan, use Vulkan surface on 29. (#164109)
Rather than conditionally disabling AHBs, just disable Vulkan on devices
where AHB imports don't work.

https://github.com/flutter/flutter/issues/163473
https://github.com/flutter/flutter/issues/160854
2025-02-26 02:50:12 +00:00
Jim Graham
f825cccda2
[DisplayList] Delete all legacy Skia-oriented method overloads in DlCanvas (#164054)
Delete remaining DlCanvas method overloads that were allowing the use of
Skia geometry objects in rendering code.

The only remaining uses of Skia classes in the DlCanvas interface are
SkImageInfo and SkTextBlob.
2025-02-26 00:44:27 +00:00
Jonah Williams
73b518d0c3
[iOS] increase backdrop cached task limit. (#164036)
Partial workaround for https://github.com/flutter/flutter/issues/161142
. Since this was an arbitrary number anyway we can increase it a bit.
2025-02-25 15:41:47 +00:00
Jonah Williams
0102da95cd
[Impeller] Disable text cache. (#163906)
I forgot to make a master branch version of the cherry pick here:
https://github.com/flutter/flutter/pull/163754
2025-02-24 16:26:01 +00:00
Tong Mu
5b7a3c8b20
[Engine] Add RoundSuperellipse to drawing OP (#160883)
This PR adds support for clipping round superellipse to the engine.

For what a rounded superellipse is, see [this design
doc](https://docs.google.com/document/d/1CJXULKJGQt22FOFsrlm2TKVjKBtif1yU4U50cMfL6Kc/edit?tab=t.0).
Video demos can be found at https://github.com/flutter/engine/pull/56726
and https://github.com/flutter/flutter/pull/161409.

Only impeller can actually render it. On Skia and Web, this shape falls
back to `RRect`.

Part of https://github.com/flutter/flutter/issues/139321 and
https://github.com/flutter/flutter/issues/13914, also related to
https://github.com/flutter/flutter/issues/91523.

## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-02-21 23:58:26 +00:00
Jim Graham
d0e2fc72bc
[DisplayList] Migrate rendering tests and benchmarks to DL geometry (#163766)
Migrating the benchmark and rendering tests to using DL geometry with DL
rendering calls.
2025-02-21 00:15:39 +00:00
Jim Graham
99ac47897e
Reland "[Impeller] add support for rational bezier conics to Path (#63282)" (#163645)
Reverts flutter/flutter#163624
Relands https://github.com/flutter/flutter/pull/163282

Add basic support for storing rational bezier conics in impeller::Path.
The support is very thin and just degrades the conics into a pair of
quadratic curves just as Impeller has always done for the conic segments
that it receives via SkPath objects, but it puts in place the framework
for eventually handling the conics more directly and allows the unit
tests to be rewritten on top of Impeller paths rather than SkPaths,
paving the way for reduced internal API dependencies.
2025-02-19 21:54:08 +00:00
Jonah Williams
408cbaf233
[Impeller] ensure that OpenGL "flipped" textures do not leak via texture readback. (#163501)
Fixes https://github.com/flutter/flutter/issues/163315
Fixes https://github.com/flutter/flutter/issues/163521
Fixes https://github.com/flutter/flutter/issues/142641

OpenGL has an inverted coordinate system (bottom left is zero) compared
to Metal/Vulkan (top left is zero). We handle this by rendering things
upside down on OpenGL. Unfortunately this can leak out of the renderer
via readback (toImage), so we need to make sure to undo the inversion.

This is not performed for the "TextureCoordinateSystem::kUploadFromHost"
state as that indicates the texture is already "right side up".
2025-02-19 20:07:07 +00:00
Matan Lurey
485c9105fc
Revert "[Impeller] add support for rational bezier conics to Path (#63282)" (#163624)
This reverts commit db0bdfd117077a69f79ce0d4c03ab387a78ef7dd to fix a
tree breakage.
2025-02-19 18:51:42 +00:00
Jim Graham
db0bdfd117
[Impeller] add support for rational bezier conics to Path (#163282)
Add basic support for storing rational bezier conics in impeller::Path.
The support is very thin and just degrades the conics into a pair of
quadratic curves just as Impeller has always done for the conic segments
that it receives via SkPath objects, but it puts in place the framework
for eventually handling the conics more directly and allows the unit
tests to be rewritten on top of Impeller paths rather than SkPaths,
paving the way for reduced internal API dependencies.
2025-02-18 21:20:50 +00:00
Chinmay Garde
a16c447abc
[Impeller] Don't create a redundant typography context. (#163513)
This was a typo that caused a typography context to be created, its
validity checked, but the context not actually used. Instead returning a
new one.

No change in functionality.
2025-02-18 19:05:10 +00:00
Jonah Williams
063d0da3c0
[Impeller] when binding to READ_FRAMEBUFFER, treat multisampled textures as single sampled. (#163345)
I noticed this causes crashes when doing readback, but only on some
deivces. I suspect that this is the more correct binding choice, and
other drivers are just more lenient.
2025-02-18 18:20:09 +00:00
Jonah Williams
3e219d1cd8
[Impeller] don't use glFramebufferBlit for onscreen restore. (#163327)
With the OpenGLES backend, we use the MSAA render to texture extension.
This means that the offscreen textures are multisample and implicitly
resolved when sampled from. This implicit resolve does not occur in the
blit command used to restore to the onscreen, which can trigger a crash
in the GLES driver.

In other backends, the onscreen is also multisample and the blit is OK.

Fixes https://github.com/flutter/flutter/issues/163304
2025-02-14 19:59:39 +00:00
gaaclarke
f949d8eaed
Tweaked TextContents math to avoid floating point errors (#162480)
This gets rid of artifacts in characters.

## before

![before_445](https://github.com/user-attachments/assets/c66d3d22-baaf-4d66-bff3-3ad5b4d5747c)

## after

![after_445](https://github.com/user-attachments/assets/0e23a593-b68a-4334-a82e-4f7dc1ecdc17)


## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-02-14 17:21:30 +00:00
Jason Simmons
0fc52bc91f
[Impeller] Call glDebugMessageControlKHR only if the KHR_debug extension is available (#163273)
Fixes https://github.com/flutter/flutter/issues/163269
2025-02-14 01:58:51 +00:00
Jason Simmons
ce659cda5e
[Impeller] Ensure that texture coordinate coverage and gradient color source sizes used by DrawVertices are nonempty (#163177)
Fixes https://github.com/flutter/flutter/issues/162969
2025-02-13 20:04:08 +00:00
gaaclarke
bffedc7f2c
Backfill subpixel unit tests (#162710)
issue: https://github.com/flutter/flutter/issues/149652

I made these unit tests while investigating a fix for
https://github.com/flutter/flutter/issues/149652. The fixes have already
landed with different tests. I figured I'd land these too since they
were helpful to me.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-02-13 18:40:46 +00:00
Jonah Williams
1cd3ab16ca
[android] correct API availibility checks for hcpp. (#163226)
This fixes the HCPP crashes in devicelab by correctly disabling HCPP for
devices that are < API level 34. Unfortunately this means we can't
benchmark on CI until we update the devices.
2025-02-13 17:39:48 +00:00
Jason Simmons
0f801f8dbd
[Impeller] In Paint::CreateContents, do not set a color source size if the size is empty (#163099)
The Canvas::DrawVertices lazy texture function will be unable to create
a snapshot based on an empty color source size.

See https://github.com/flutter/flutter/issues/162969
2025-02-12 19:41:01 +00:00
Tong Mu
ef927e85d5
[Impeller] Add RoundSuperellipse class, containment check and stroking (#162826)
This PR:
* Adds a `RoundSuperellipse` class, which mirrors the current
`RoundRect` class.
* Implements `RoundSuperellipse::Contains`, which checks if a point is
contained by the RSE.
* Adds `Path::AddSuperellipse`, which draws an RSE with Bezier
approximation.
* Adds a `RoundSuperellipseParam` class, which is the common computation
shared by geometry drawing, stroking, and containment check.


https://github.com/user-attachments/assets/883c7762-7b35-432e-9b31-d204db3bd6e1


This PR also updates the RSE algorithm according to my recent research,
which uses one fewer precomputed variable (no more `d`), shares the same
gap factor with RRect, and allows much better precision. The result
shape is almost unchanged (~0.2% slimmer).

> For reviewers: The `RoundSuperellipseParam` and
`RoundSuperellipse::Contains` parts are repurposed from the abandoned
https://github.com/flutter/flutter/pull/162349. This PR is a preparation
for https://github.com/flutter/flutter/pull/160883.

## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-02-12 17:45:56 +00:00
Jonah Williams
17ea9569da
[Impeller] mirror tile mode requires highp for Adreno. (#163066)
Fixes https://github.com/flutter/flutter/issues/162891

On Adreno GPU the mediump precision causes mirror to drop this number to
zero.
2025-02-12 04:15:07 +00:00
Chinmay Garde
8c843aa9d3
[Impeller] libImpeller: Add support for Metal and Vulkan rendering. (#161547)
* Adds context creation and WSI routines for Metal and Vulkan.
* Enables all tests for the Metal, Vulkan, and OpenGLES backends.
* Separate standalone examples for Metal, Vulkan, and OpenGLES have been
created. These will be packaged with the SDK.
  * Disallows the use of OpenGL ES on macOS.
* All new public methods are documented.
* The SDK version number has been bumped.
* Some incorrect nullability annotations were patched.
* Tests harness is overhauled to reuse the same underlying context as
the playgrounds.
* The C++ public header has been updated.

Fixes https://github.com/flutter/flutter/issues/159512
Ports https://github.com/flutter/engine/pull/56906
2025-02-12 00:47:19 +00:00
Jason Simmons
6c9a555e56
Roll vulkan-deps to 9edf248c597b (#162549) 2025-02-11 19:52:47 +00:00
gaaclarke
58bc9643b5
[Impeller] rrect_blur: scale max radius clamp by transform (#161238)
migrated PR https://github.com/flutter/engine/pull/54350

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-02-10 19:23:16 +00:00
gaaclarke
68e785e868
Fixed translated text's subpixel alignment. (#162824)
fixes https://github.com/flutter/flutter/issues/162776
fixes https://github.com/flutter/flutter/issues/149652

Previously we weren't calculating the subpixel offset correctly. We
weren't using the transform of the object being drawn to get global
coordinates, now we are.

## Video of https://github.com/flutter/flutter/issues/149652 after PR



https://github.com/user-attachments/assets/3e9063d5-f70c-46d0-a7a4-892819b247b8



## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-02-07 15:50:50 +00:00
Jonah Williams
17cb12d9bd
[Android] wire up Java Transaction to AHB swapchain. (#162750)
* When the opt in surface control setting is enabled (and the backend is
impeller vulkan) - then use the external view embedder 2.
* ALways create the SurfaceControl.Transaction in
PlatformViewController2 and manage it in Java. This was done for ease of
implementation. Rather than switching between SurfaceControl.Transaction
objects created in the native heap or created in java, we always go
through java. This also means that adding platform views shouldn't
change this flow.
* We may need to separate this after peformance profiling.

One more PR to go to wire up the new message channels and add the
integration_test.
2025-02-05 21:07:34 +00:00
gaaclarke
cebc34c92c
Increased the glyph atlas resolution 2x (#162555)
issue: https://github.com/flutter/flutter/issues/149652

This makes https://github.com/flutter/flutter/issues/149652 better. It
doesn't completely it better though, there is still a shrinking of
whitespace at larger scales. Without this patch though the test will
fail with many 3 pixel jumps between glyphs.

I think scaling in the thousands is reasonable so this is an adequate
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], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-02-03 21:29:37 +00:00
Brandon DeRosier
039d0db698
[Flutter GPU] Breaking: Use exceptions for resource creation errors. (#162104)
Resolves https://github.com/flutter/flutter/issues/143891.

This patch includes breaking changes, but this API is still in preview.
* Breaking: Rename `Texture.GetBaseMipLevelSizeInBytes` to
`Texture.getBaseMipLevelSizeInBytes`.
* Breaking: Make `Texture.overwrite` throw exception instead of
returning false.
* Non-breaking: Make `DeviceBuffer`/`Texture` creation throw exceptions
instead of returning nullables.

We can incrementally add more specific exceptions for resource creation
failure.
2025-02-01 01:46:34 +00:00
Jonah Williams
806772b528
[Impeller] Increase conical gradient precision. (#162543)
Fixes https://github.com/flutter/flutter/issues/162379

The IPConicalGradient function requires full float 32 precision, though
this depends on the exact gpu behavior. To be safe, increase the general
precision in all of these shaders.
2025-02-01 00:01:23 +00:00
Jason Simmons
4226d48c52
[Impeller] Remove some unused methods from EntityPassClipStack (#162478) 2025-01-31 18:58:08 +00:00
gaaclarke
3c5ae1eb87
Fixed the text aspect ratio (#162415)
fixes https://github.com/flutter/flutter/issues/162348

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-01-31 02:50:20 +00:00
gaaclarke
d0d4e9613e
Fixed some floating point inaccuracies in TextContents (#162351)
issue: https://github.com/flutter/flutter/issues/149652

## before
Animating from 0.444x to 0.445x

![before-pos](https://github.com/user-attachments/assets/3b561e35-68ca-49ca-aa3e-e2c224ae06c5)

## after
Animating from 0.444x to 0.445x

![after-pos](https://github.com/user-attachments/assets/3ef67ec9-29ce-481a-83ff-cb27fbe2ddca)

## diff
Diff at 0.444x

![444](https://github.com/user-attachments/assets/2a309f2d-65ad-4be2-bc35-7b9df5639c0f)


## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-01-30 20:42:39 +00:00
Jonah Williams
524325a2fd
[Android] SurfaceTransaction updates for HC++. (#162405)
Adds but does not use the ability to use imported Java
SurfaceTransactions in the AHB swapchain. When an imported
SurfaceTransaction is used, the Swapchain will not apply the transaction
and instead will rely on the PlatformViewController to do so.
2025-01-30 04:14:38 +00:00