117 Commits

Author SHA1 Message Date
Jason Simmons
14cf4acc97
[Impeller] Fix various typos (#162295) 2025-01-29 21:38:59 +00:00
Jonah Williams
fda902f593 [Impeller] exploit perfect hash for SamplerDescriptor. (flutter/engine#57036)
There are only 3 or 4 sampler's active at any given time in a flutter app. rather than store them in a hashmap, just use a vector.
2024-12-12 22:00:17 +00:00
Jonah Williams
e263222f14 [Impeller] reland: switch Pipeline to use raw ptr instead of shared ptr for recorded references. (flutter/engine#57086)
Prev: https://github.com/flutter/engine/pull/57015

There is a unit test that is clearing out the pipeline storage, manually null out captured PipelineRef.
2024-12-10 21:18:46 +00:00
gaaclarke
33306239b4 Revert "[Impeller] switch Pipeline to use raw ptr instead of shared ptr for recorded references." (flutter/engine#57079)
Reverts flutter/engine#57015
fixes https://github.com/flutter/flutter/issues/160004
2024-12-09 17:30:26 -08:00
Jonah Williams
81d3d7fbca [Impeller] switch Pipeline to use raw ptr instead of shared ptr for recorded references. (flutter/engine#57015)
Fixes https://github.com/flutter/flutter/issues/159566

We don't need recorded commands to keep pipelines alive as the context does that already.
2024-12-09 20:42:03 +00:00
Jonah Williams
2e80dbea2c [Impeller] create a 300 es variant of all GLES shaders to support UBO binding. (flutter/engine#56960)
Create a GLES3 "backend" by compiling a second set of GLES shaders to 300 es. This allows the usage of UBOs and SSBOs.
2024-12-05 20:56:16 +00:00
LN Liberda
daed210840 IWYU: add some missing includes failing with libstdc++13/14 (flutter/engine#56822)
Fixes builds of engine with libstdc++13 and libstdc++14.

*List which issues are fixed by this PR. You must list at least one issue.*
closes https://github.com/flutter/flutter/issues/159513

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-11-27 20:11:17 +00:00
Jonah Williams
e8c3eefb21 [Impeller] dont use dynamic shader metadata path for precompiled shaders. (flutter/engine#56827)
Should fix https://github.com/flutter/flutter/issues/159520 ~~but I still need to check locally.~~ Seems to do the trick.

All cmd bindings were copying the shader metadata, which meant allocating/de-allocating a lot of strings per draw.
2024-11-27 17:21:09 +00:00
Jonah Williams
90320619b8 [Impeller] make sampler use string_view instead of std::string. (flutter/engine#56821)
I believe these are always const strings anyway, so remove the copy associated with using std::string.
2024-11-27 02:26:20 +00:00
Jonah Williams
b1bf47b924 [Impeller] faster descriptor type mapping. (flutter/engine#56351)
This is a dumb performance optimization. because we only use the DescriptorType enum to represent vk descriptor types, lets just make the enum values match. Then we can static cast instead of switch.

I do see this function showing up in profiles, though a very small slice.
2024-11-04 17:55:19 +00:00
gaaclarke
f81ed55e63 reland: Allow BufferViews to have non-owning references to DeviceBuffers (flutter/engine#56286)
relands https://github.com/flutter/engine/pull/56224

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-10-31 23:46:55 +00:00
auto-submit[bot]
528967bfae Reverts "Allow BufferViews to have non-owning references to DeviceBuffers (#56224)" (flutter/engine#56285)
Reverts: flutter/engine#56224
Initiated by: jonahwilliams
Reason for reverting: merge issue.
Original PR Author: gaaclarke

Reviewed By: {jonahwilliams}

This change reverts the following previous change:
issue: https://github.com/flutter/flutter/issues/157538

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-10-31 22:48:46 +00:00
gaaclarke
1d90823917 Allow BufferViews to have non-owning references to DeviceBuffers (flutter/engine#56224)
issue: https://github.com/flutter/flutter/issues/157538

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

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

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2024-10-31 15:28:10 -07:00
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
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
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
gaaclarke
fe5be148d8 Added assert for host buffer allocation. (flutter/engine#55395)
fixes https://github.com/flutter/flutter/issues/155555

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-09-24 17:33:36 +00:00
Jonah Williams
ed4555fc0b [Impeller] add triangle fan support and remove drawVertices copying. (flutter/engine#55236)
Vulkan and GLES backends support triangle fans, so only "un-fan" these geometries when necessary. Now that dispatch gives the vertices geometry as a shared_ptr, we can hold onto that directly without performing another copy.
2024-09-23 19:21:01 +00:00
Jonah Williams
d3235504c1 [Impeller] use BufferSubData to update gles device buffer. (flutter/engine#55330)
Measures as substantially faster on windows. See the bufferSubData docs:

> When replacing the entire data store, consider using glBufferSubData rather than completely recreating the data store with glBufferData. This avoids the cost of reallocating the data store.

Tracks invalidated ranges and only updates those ranges using the Flush API.

Fixes https://github.com/flutter/flutter/issues/104447
2024-09-23 18:40:08 +00:00
Jonah Williams
2e9cebebe1 [Impeller] Increase host buffer arena count to 4. (flutter/engine#54808)
It seems like on some ANdroid devices we can actually get 4 pending frames even with the 3 frame wait. I thought about this a lot but too hard. Lets bump it up one.

Also minor comment fixes in ahb swapchain.
2024-08-27 23:35:07 +00:00
Chinmay Garde
0662b4f46a [Impeller] Statically check stage interfaces for precision mismatches. (flutter/engine#54375)
Fixes https://github.com/flutter/flutter/issues/147078
2024-08-07 00:36:17 +00:00
Jonah Williams
a61c707fe0 [Impeller] check allocation failures. (flutter/engine#54320)
Fixes https://github.com/flutter/flutter/issues/151084

If allocating a host buffer fails, log a validation error but don't cause an NPE by inserting a nullptr into the host buffer set.
2024-08-02 19:49:40 +00:00
Chinmay Garde
b6fbffe976 [Impeller] Make storage sizes typed. (flutter/engine#53700)
This is similar to our handling of degrees and radians or really any of the stuff in chrono.

Storage is always in bytes. Before being displayed, it can be converted into any of unit that makes the most sense. Conversions are non-truncating and everything is constexpr safe.
2024-07-03 19:47:10 +00:00
Jonah Williams
aa7bf16b06 [Impeller] track the sizes of all outstanding MTLTexture allocations and report per frame in MB, matching Vulkan implementation. (flutter/engine#53618)
Does what it says!

Fixes https://github.com/flutter/flutter/issues/150936
2024-07-01 17:52:50 +00:00
Jonah Williams
efd37f4fd2 [Impeller] correctly map DL non-mipmap sample mode to non-mipmap sample mode. (flutter/engine#53161)
Match DL/Skia sampling defaults. This does not change the default SamplerDescriptor value, but that is irrelevant as any draws from the framework will pass through DL conversion.

The SamplerDescriptor default of nearest is generally a good idea.

Fixes https://github.com/flutter/flutter/issues/148253
2024-06-05 21:38:24 +00:00
gaaclarke
419275bce0 [Impeller] make sure buffers are 4 aligned for foreground color blending (flutter/engine#53077)
fixes https://github.com/flutter/flutter/issues/149216

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-05-30 21:02:53 +00:00
Brandon DeRosier
2ffd763cfb [Impeller] Reland: Remove Entity capture/AiksInspector. (flutter/engine#52932)
Resolves https://github.com/flutter/flutter/issues/134748.

This was a really fun experiment. I learned a lot from it, and it
genuinely helped me solve some coverage-related problems, but the
reality is it was too little too late -- by the time we had this
capture system, we had already solved most of the problems that would
have benefitted from this.

It's been a few months since I've used or extended the capabilities of
this capture system for something, and I don't have the spare
time/energy to give it the love it needs to realize the vision I had
for it. I still almost exclusively use a combination of native frame
captures and print debugging to solve problems.

RIP in peace.

This reverts commit 104eb98e62. (https://github.com/flutter/engine/pull/52680)
2024-05-21 00:59:14 +00:00
auto-submit[bot]
ea811b97ba Reverts "Manual roll of Clang from 725656bdd885 to 145176dc0c93 (#52823)" (flutter/engine#52890)
Reverts: flutter/engine#52823
Initiated by: zanderso
Reason for reverting: Engine crashes on framework CI following this roll https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_android%20flutter_gallery__transition_perf_with_semantics/12126/overview
Original PR Author: jason-simmons

Reviewed By: {zanderso}

This change reverts the following previous change:
See https://github.com/flutter/flutter/issues/143178
2024-05-16 22:01:38 +00:00
Jason Simmons
31d7cb2870 Manual roll of Clang from 725656bdd885 to 145176dc0c93 (flutter/engine#52823)
See https://github.com/flutter/flutter/issues/143178
2024-05-16 17:16:21 +00:00
Matan Lurey
8ef64aea97 Re-add MipFilter::kBase, but keep kNearest as the default. (flutter/engine#52779)
Closes https://github.com/flutter/flutter/issues/147259.

Changes:
- Make sure the default of `kNearest` is used consistently
- Partial revert of https://github.com/flutter/engine/pull/40491, re-adding `kBase`
- Added some documentation about relevant enums, and why the default is `kNearest`
- Wired up `kBase` in the Metal, Vulkan, and OpenGLES backends

Expecting an update to the `dart_ui_filter_quality_none` golden file:

> ![Screenshot 2024-05-13 at 2 47 49 PM](https://github.com/flutter/engine/assets/168174/68df4c1a-9b2b-4201-9a6c-f78361a5aa30)

For breadcrumbs around the mapping, see https://github.com/flutter/flutter/issues/148253.
2024-05-15 01:38:05 +00:00
gaaclarke
104eb98e62 Revert 7130c5c3b3f16d549bca6b81c51c751780c454d4 (flutter/engine#52680)
reverts https://github.com/flutter/engine/pull/52526
fixes https://github.com/flutter/flutter/issues/147989

That PR has broken playgrounds.  It's non essential so we can revert it an bdero can take a look whenever he gets another chance.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-05-08 18:27:32 +00:00
Jonah Williams
d790b88806 [Impeller] Support copy from buffer to texture for GLES blitpass, use blit pass to set contents in glyph atlas. (flutter/engine#52510)
part of https://github.com/flutter/flutter/issues/138798

Works around https://github.com/flutter/flutter/issues/144498 for the glyph atlas.

Adds BlitPass::AddCopy implementation for GLES, which is mostly a copy of Texture::SetContents. Updates the glyph atlas to use a blit pass and device private textures instead of set contents (which is unsafely on Metal).

This also removes DeviceBuffer::AsTexture, which isn't actually used anywhere - and creates a linear texture on iOS (and fails with an unsupported API on simulators).

Note that in general, we don't actually have support for hostVisible textures on GLES _or_ Vulkan. Instead, VMA is falling back to device private textures. We may want to, separately, remove the concept of host visible from textures - and similarly remove the concept of transient from buffers.
2024-05-08 00:02:22 +00:00
Jonah Williams
afb9eb545c [Impeller] remove unused includes. (flutter/engine#52579)
mostly removing unused fml/macros, but a few others that clangd surfaced. This compiled locally,hope it works on CI!
2024-05-06 19:51:08 +00:00
Brandon DeRosier
7130c5c3b3 [Impeller] Remove Entity capture/AiksInspector. (flutter/engine#52526)
Resolves https://github.com/flutter/flutter/issues/134748.

This was a really fun experiment. I learned a lot from it, and it genuinely helped me solve some coverage-related problems, but the reality is it was too little too late -- by the time we had this capture system, we had already solved most of the problems that would have benefitted from this.

It's been a few months since I've used or extended the capabilities of this capture system for something, and I don't have the spare time/energy to give it the love it needs to realize the vision I had for it. I still almost exclusively use a combination of native frame captures and print debugging to solve problems.

RIP in peace.
2024-05-03 01:08:22 +00:00
Jonah Williams
9dbe934a9b [Impeller] kick off registration and initial PSO compilation of runtime effect earlier. (flutter/engine#52381)
I thought about changing this API so that it blocks on compilation, but I think that isn't necesasary as the workload can happen while the UI thread is building. Plus, even blocking on shader completion does not guarantee that we won't need to compile a variant anyway.

While I was at it I moved the descriptor sets computation to the runtime effect constructor.

With this change the pipleine variant used during the frame is produced much faster than the initial 12ms compilation.

![image](https://github.com/flutter/engine/assets/8975114/42626676-0a71-4503-a3e9-4109c36fbbef)

Fixes https://github.com/flutter/flutter/issues/113719
Fixes https://github.com/flutter/flutter/issues/141222
2024-04-25 20:23:56 +00:00
Jonah Williams
dbd72955e4 [Impeller] re-enable gold CTL. (flutter/engine#52299)
Add goldctl dependency to arm64

Fixes https://github.com/flutter/flutter/issues/147180
2024-04-22 21:01:23 +00:00
Jonah Williams
41346b0801 [Impeller] Reland: remove most temporary allocation during polyline generation. (flutter/engine#52180)
Part of https://github.com/flutter/flutter/issues/143077

Only allocate into reused arenas instead of allocating a new vector of data. Fixes https://github.com/flutter/flutter/issues/133348

Also moves tessellation logic into the c/tessellator and out of the impeller tessellator. This was necessary to fix a compilation error. introduced by including host_buffer -> allocator -> fml mapping -> window.h include which has a function definition that conflicts with the c tessellator definition.

Fixes missing points in case a filled path is not explicitly closed.
2024-04-18 16:50:07 +00:00
auto-submit[bot]
e3a20e4fb6 Reverts "[Impeller] remove most temporary allocation during polyline generation. (#52131)" (flutter/engine#52177)
Reverts: flutter/engine#52131
Initiated by: jonahwilliams
Reason for reverting: breaking flutter logo rendering

![image](https://github.com/flutter/engine/assets/8975114/90a6d70f-db22-4684-80f9-1cea3dc21ac5)

Original PR Author: jonahwilliams

Reviewed By: {chinmaygarde}

This change reverts the following previous change:
Part of https://github.com/flutter/flutter/issues/143077

Only allocate into reused arenas instead of allocating a new vector of data. Fixes https://github.com/flutter/flutter/issues/133348

Also moves tessellation logic into the c/tessellator and out of the impeller tessellator. This was necessary to fix a compilation error. introduced by including host_buffer -> allocator -> fml mapping -> window.h include which has a function definition that conflicts with the c tessellator definition.
2024-04-16 22:55:47 +00:00
gaaclarke
ed0a9bd410 [Impeller] removes advanced plus blending (flutter/engine#52163)
Now that https://github.com/flutter/engine/pull/52019 has landed, we
shouldn't need it anymore.

## 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-04-16 12:33:21 -07:00
Jonah Williams
e572ff5c6f [Impeller] remove most temporary allocation during polyline generation. (flutter/engine#52131)
Part of https://github.com/flutter/flutter/issues/143077

Only allocate into reused arenas instead of allocating a new vector of data. Fixes https://github.com/flutter/flutter/issues/133348

Also moves tessellation logic into the c/tessellator and out of the impeller tessellator. This was necessary to fix a compilation error. introduced by including host_buffer -> allocator -> fml mapping -> window.h include which has a function definition that conflicts with the c tessellator definition.
2024-04-16 18:48:47 +00:00
Jonah Williams
97b286ca62 [Impeller] cleanup auto usage in host_buffer (flutter/engine#51875)
Remove some autos, make some things const refs, move some shared_ptrs.
2024-04-03 23:30:21 +00:00
gaaclarke
03996c0fe2 Reland: [Impeller] adds a plus advanced blend for f16 pixel formats (flutter/engine#51756)
Relands https://github.com/flutter/engine/pull/51589

The fix is in 74397bc171c74d2bfb24e82b47f2aa29d70c1711. I couldn't
figure out how to get a test in the engine to cover it. The test is in
the devicelab.

Here's what I attempted:
```c++
TEST_P(AiksTest, BlendModePlusAlphaColorFilterAlphaWideGamut) {
  if (GetParam() != PlaygroundBackend::kMetal) {
    GTEST_SKIP_("This backend doesn't yet support wide gamut.");
  }
  EXPECT_EQ(GetContext()->GetCapabilities()->GetDefaultColorFormat(),
            PixelFormat::kR16G16B16A16Float);

  Canvas canvas;
  canvas.Scale(GetContentScale());
  canvas.DrawPaint({.color = Color(0.1, 0.2, 0.1, 0.5)});
  canvas.SaveLayer({
      .color_filter = ColorFilter::MakeBlend(BlendMode::kPlus,
                                             Color(Vector4{1, 0, 0, 0.5})),
  });
  Paint paint;
  paint.color = Color(1, 0, 0, 0.5);
  canvas.DrawRect(Rect::MakeXYWH(100, 100, 400, 400), paint);
  paint.color = Color::White();
  canvas.Restore();
  ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
}
```

## 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-03-28 13:36:21 -07:00
auto-submit[bot]
ebe91c2a5c Reverts "[Impeller] adds a plus advanced blend for f16 pixel formats (#51589)" (flutter/engine#51741)
Reverts: flutter/engine#51589
Initiated by: jonahwilliams
Reason for reverting: draw vertices devicelab test is crashing due to SIGABRT in blend contents

![image](https://github.com/flutter/engine/assets/8975114/8bfaec63-29e9-43c2-8954-181d0ad1c413)

Original PR Author: gaaclarke

Reviewed By: {jonahwilliams}

This change reverts the following previous change:
fixes https://github.com/flutter/flutter/issues/142549

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-03-28 05:41:48 +00:00
gaaclarke
d96b1f7e73 [Impeller] adds a plus advanced blend for f16 pixel formats (flutter/engine#51589)
fixes https://github.com/flutter/flutter/issues/142549

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-03-27 23:48:24 +00:00
Chinmay Garde
6a151f5c40 [Impeller] Make masks type safe. (flutter/engine#51369)
Uses the utility added in https://github.com/flutter/engine/pull/51361

I counted the removal of 58 static casts. There was one addition made to the original utility however. Vulkan HPP was promoting all enums to its own mask type. This in itself is problematic but we got away with it because there was no one else doing this kind of promotion. Till we added our own utility. To avoid polluting the namespace with methods that may cause ambiguity, enums that are masks must explicitly be marked as maskable with `IMPELLER_ENUM_IS_MASK` in the `impeller` namespace.

No change in functionality.
2024-03-13 00:12:21 +00:00
Jonah Williams
1322186f32 [Impeller] add a per-frame trace event for heap usage on Vulkan. (flutter/engine#51246)
Part of https://github.com/flutter/flutter/issues/144617

Adds MemoryBudgetUsageMB which includes the MB of VMA allocated GPU and host memory, approximately per frame. This will be recorded in the devicelab and used to track how much memory pressure we're creating.

Split out from https://github.com/flutter/engine/pull/51187 since that was reverted (and doing big changes is a bad idea anyway).
2024-03-07 01:40:04 +00:00
auto-submit[bot]
e3e37f2bee Reverts "[Impeller] fold memory check into allocator_vk (#51187)" (flutter/engine#51243)
Reverts: flutter/engine#51187
Initiated by: jonahwilliams
Reason for reverting: unexpected benchmark regression

https://flutter-flutter-perf.skia.org/e/?queries=device_type%3DPixel_7_Pro%26sub_result%3D90th_percentile_frame_rasterizer_time_millis%26sub_result%3D99th_percentile_frame_rasterizer_time_millis%26sub_result%3Daverage_frame_rasterizer_time_millis%26sub_result%3Dworst_frame_rasterizer_time_millis%26test%3Dnew_gallery_impeller__transition_perf&selected=commit%3D396
Original PR Author: jonahwilliams

Reviewed By: {matanlurey}

This change reverts the following previous change:
Various cleanups to Vulkan allocator implementation:

1. Fixes https://github.com/flutter/flutter/issues/137454
2. Fold device transient cap check into allocator.
3. adds debug tracking for total memory usage in MB (a followup change needs to be made to driver to plumb it through)
4. Small cleanups to mock vulkan so an allocator can be created from it.
5. depth/stencil shouldn't be input attachments.

Part of https://github.com/flutter/flutter/issues/144617
2024-03-06 23:52:25 +00:00
Jonah Williams
749903e027 [Impeller] fold memory check into allocator_vk (flutter/engine#51187)
Various cleanups to Vulkan allocator implementation:

1. Fixes https://github.com/flutter/flutter/issues/137454
2. Fold device transient cap check into allocator.
3. adds debug tracking for total memory usage in MB (a followup change needs to be made to driver to plumb it through)
4. Small cleanups to mock vulkan so an allocator can be created from it.
5. depth/stencil shouldn't be input attachments.

Part of https://github.com/flutter/flutter/issues/144617
2024-03-06 20:10:55 +00:00
Jason Simmons
a72fddf954 [Impeller] Apply padding for alignment when doing HostBuffer::Emplace with a callback (flutter/engine#51221) 2024-03-06 18:58:46 +00:00
Jonah Williams
edb8430817 [Impeller] various StC fixes for GPU -> CPU readback plus BufferBindingGLES error (flutter/engine#50951)
More debugging for https://github.com/flutter/engine/pull/50856

Potentially related to https://github.com/flutter/flutter/issues/141472
2024-02-27 20:35:18 +00:00