140 Commits

Author SHA1 Message Date
Jason Simmons
c0ea0d4a0e Remove use of variable length arrays (flutter/engine#48232)
The variable length array extension will be disabled by default in the next roll of Clang.
2023-11-28 21:28:07 +00:00
Matan Lurey
0b7f44c8c4 Yet more compliance with .clang_tidy, stragglers edition. (flutter/engine#48291)
Based off the
[failures](https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8763786250936903249/+/u/test:_test:_lint_host_debug/stdout)
in https://github.com/flutter/engine/pull/48145.

Nothing particularly interesting.
2023-11-21 13:39:18 -08:00
Matan Lurey
fcd9c27649 Make vulkan/... compatible with .clang_tidy. (flutter/engine#48240)
Missed this straggler in a previous PR. Ezpz.
2023-11-20 21:30:07 +00:00
Matan Lurey
ddce052e36 Make testing/... and vulkan/... compatible with .clang-tidy. (flutter/engine#48161) 2023-11-17 15:16:31 -08:00
Zachary Anderson
e24e3b5746 Don't use Skia BUILD.gn files (flutter/engine#47677)
The new `BUILD.gn` files in the Engine tree can't go under
`build/secondary` because Skia still has its own, and they'd be selected
first. So, this PR puts the new `BUILD.gn` files under `flutter/skia`.
2023-11-07 11:12:29 -08:00
Kevin Lubick
a6761a95ea Update to use GrDirectContexts::MakeVulkan (flutter/engine#46878)
In http://review.skia.org/764516, Skia moved the way to make a Vulkan
context. This updates Flutter to use that new way.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [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
2023-10-13 10:41:25 -04:00
Emircan Uysaler
218a4e9870 [fuchsia] Add fatal error for Vulkan failure (flutter/engine#46831)
This CL changes vkWaitForFences to cause a FATAL failure as we can't
recover from these errors.

Bug: b/297198565
2023-10-12 17:11:14 -04:00
Dan Field
1e318d57d4 [Impeller] flutter_tester --enable-impeller (flutter/engine#46389)
This patch does the following:

- Updates `flutter_tester` to set up an Impeller rendering context and surface if `--enable-impeller` is set to true, using the Vulkan backend with Swiftshader.
- Updates `run_tests.py` to run all tests except the smoke test (that one really has no rendering impact whatsoever) with and without `--enable-impeller`.
- Updates a few tests to work that were trivial:
  - A couple tests needed updated goldens for very minor rendering differences. Filed https://github.com/flutter/flutter/issues/135684 to track using Skia gold for this instead.
  - Disabled SKP screenshotting if Impeller is enabled, and updated the test checking that to verify an error is thrown if an SKP is requested.
  - The Dart GPU based test now asserts that the gpu context is available if Impeller is enabled, and does not deadlock if run in a single threaded mode.
  - We were missing some trace events around `Canvas::SaveLayer` for Impeller as compared to Skia.
  - A couple other tests had strict checks about exception messages that are slightly different between Skia and Impeller.
- I've filed bugs for other tests that may require a little more work, and skipped them for now. For FragmentProgram on Vulkan I reused an existing bug.

This is part of my attempt to address https://github.com/flutter/flutter/issues/135693, although @chinmaygarde and I had slightly different ideas about how to do this.

The goals here are:

- Run the Dart unit tests we already have with Impeller enabled.
- Enable running more of the framework tests (including gold tests) with Impeller enabled.
- Run all of these tests via public `dart:ui` API rather than mucking around in C++ internals in the engine.
2023-10-11 21:42:24 +00:00
gaaclarke
4c3f956980 Revert "Makes Skia's vkQueueSubmit threadsafe." (flutter/engine#45650)
Reverts flutter/engine#45459

I'm going to revert this. It works fine in tests, but it's not going to work for real usage of the embedder since the user has free access to the vkQueue and thus has no way to ensure that the vkQueue isn't used concurrently.

See: https://github.com/flutter/flutter/issues/133933#issuecomment-1712522964
2023-09-11 16:51:13 +00:00
gaaclarke
66cdbc5dc9 Makes Skia's vkQueueSubmit threadsafe. (flutter/engine#45459)
fixes https://github.com/flutter/flutter/issues/133933

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-09-09 00:52:53 +00:00
Brian Osman
c11672e29a Migrate VK calls of GrBackend* (flutter/engine#45325)
In https://skia-review.googlesource.com/c/skia/+/742797 Skia refactored
GrBackend* to not require #ifdefs. This changes
callsites in Flutter to use static functions instead of methods that
were conditionally compiled on those classes.

There should be no functional change.
2023-08-31 14:15:17 -04:00
Brian Osman
829b42e044 Stop using deprecated GrBackendRenderTarget constructor (flutter/engine#44694)
Sample count is part of GrVkImageInfo (and was already being set in both places).
2023-08-15 03:47:09 +00:00
David Worsham
716b6a2cd4 [fuchsia] Only use upstream vulkan headers (flutter/engine#44157)
Stop using the special fuchsia headers, as they are contributing to
undefined behavior when building with LTO.
They are also no longer needed. All relevant fuchsia extensions were
upstreamed some time ago.

In the process, engage in some cleanup which means the "vulkan_config"
is also no longer needed. Rely on GN "public_deps" to provide the vulkan
include paths to various source sets.

See b/291462180 for more details on why this fix was neccesary.
2023-08-01 13:17:14 +10:00
gaaclarke
2097506136 [Impeller] Makes validation layers flag work for android (flutter/engine#42625)
This builds and links in the validation layers for android. They then
can be turned on or off with a manifest field.

fixes https://github.com/flutter/flutter/issues/123788
depends on https://github.com/flutter/buildroot/pull/741

## 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.
- [ ] 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-09 10:22:21 -07:00
Kevin Lubick
35f9c71efd Replace SkSurface::flush methods with GrDirectContext methods (flutter/engine#42425)
In https://skia-review.googlesource.com/c/skia/+/698237, Skia moved the
SkSurface::flush* methods to GrDirectContext (and skgpu::ganesh::Flush).
This updates Flutter to use those versions, which are drop-in
replacements for the previous functionality.

## 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.
- [ ] 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 11:07:44 -04:00
Kevin Lubick
0946d27add Migrate uses of SkSurface factories (flutter/engine#41978)
In http://review.skia.org/687639, many SkSurface static methods were moved and one was deleted (SkSurface::MakeRasterN32Premul). (SkSurface::MakeNull was omitted accidentally and http://review.skia.org/696537glesource.com/c/skia/+/696537 has not rolled into Flutter yet)

This changes the calls in Flutter to match those moved functions. There should be no functional difference and everything was done pretty mechanically (e.g. find and replace)

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-05-15 16:41:10 +00:00
Kevin Lubick
e05e7a8552 Migrate SkSurface::getBackend* methods to static functions (flutter/engine#41693)
In https://skia-review.googlesource.com/c/skia/+/687642, Skia moved some
gpu-related methods on SkSurface to be static functions in a different
header. This updates those callsites in Flutter.

## 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.
- [ ] 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-03 09:03:39 -07:00
Chinmay Garde
605e76a154 [Impeller] Patch up sundry issues in the Vulkan backend. (flutter/engine#39905)
Kaushik already did most of the great work. This patch gets us to a point where
all the playgrounds tests pass and the common performance optimizations are in
place. All known non-compute Impeller features should be implemented. There are
iOS only performance optimizations that haven’t been opted into because these
are behind define guards. These need to be generalized. Without that, the
performance of this backend will lag behind that of the Metal backend but only
because it is not an apples to apples comparison.

The general rubric was to keep the code and concepts as similar to the Metal
backend as possible.

The list of updates, all to the Vulkan Impeller backend:

* MSAA is wired up.
* Depth and stencil attachments and pipeline states are wired up.
* Got rid of Vulkan specific hacks in the inline pass context that were
  preventing clips from working.
* Storage modes for both device buffer and texture allocation are respected.
  This includes optimal usage of tile memory for device transient attachments.
* Host coherent memory for textures is no longer a requirement with explicit
  mapping management and write flushes.
* Texture uploads should be optimized for the UMA case without needing a staging
  buffer. That entire pipeline has been reworked.
* Textures track their current layout and ensure they get to the right layout
  based on usage without redundant transitions.
* Cube textures are now supported.
* Mipmapping has been reworked to correct image layout errors. With the new
  texture layout transition management, blit passes should be a whole lot easier
  to read and reason about.
* Allocator allocations are named using Vulkan debug utilities and the allocator
  (VMA). Comes in handy when chasing leaks. All of which are chased down.
* Left some handy utilities in there to debug resource leaks after context
  shutdown.  These are validation errors.
* Debug groups are pushed around render pass command encoding as well as the
  entire pass contents. This mimics the behavior of the Metal backend and it
  should be easy to map traces using both backends in Xcode and RenderDoc.
* Command buffer submission allows for tracking the life cycles of all resources
  referenced in the command stream and ensuring that the objects stay alive till
  past the submission of the command buffer. All use-after-free issues due to
  this class of issue have been chased down.
* Command pools are now context global instead of being created per pass.
* Descriptor pool are now context global instead of being created per pass.
  Individual descriptor types are now reference counted and returned to the pool
  when not needed. The pool is still fixed size though (and hence relatively
  large).
* All instances of global waitIdle on the device are removed during normal
  operation. The only times a waitIdle may happen is during swapchain recreation
  and context destruction.
* Swapchain adapt to them going out of date with the underlying surface and
  seamlessly resize as necessary on the next drawable acquisition.
* Playgrounds are resizable.
* Pipeline front face and cull modes are respected.
* Clears for all attachments are respected.
* Maximum textures sizes supported on the device are respected instead of
  hardcoding the minimum Vulkan requirement.

Fixes https://github.com/flutter/flutter/issues/112388
Fixes https://github.com/flutter/flutter/issues/112648
Fixes https://github.com/flutter/flutter/issues/112647 and a few other issues...
2023-02-27 21:14:06 -08:00
Brandon DeRosier
841758cc6c Add SkSurface include to every file where it's used (flutter/engine#39304) 2023-02-01 00:50:58 +00:00
Chris Bracken
b928888b81 [macOS] Eliminate Vulkan hack for macOS < 10.14 (flutter/engine#37498)
Eliminates an undef of VK_USE_PLATFORM_METAL_EXT that works around some
unguarded `@available` checks for macOS 10.13. Our minimum macOS SDK is
now macOS 10.14 so we can safely assume Metal support since it's a
requirement for macOS 10.14.

Issue: https://github.com/flutter/flutter/issues/114445
2022-11-17 14:54:34 -08:00
gaaclarke
af036b8857 Turned on performance-unnecessary-value-param everywhere. (flutter/engine#37447)
* Turned on performance-unnecessary-value-param everywhere.

* linux host additions

* ios patch

* reverted bad fix

* revert bad fix

* another ios patch

* removed lint fix printer
2022-11-09 20:55:13 +00:00
Kaushik Iska
b85721b43d [Impeller] Implement GPU Surface Vulkan for Impeller (flutter/engine#37215) 2022-11-01 21:48:17 +00:00
Kaushik Iska
1941c2ca48 [Impeller] Wire Flutter's own VulkanMemoryAllocator implementation (flutter/engine#37018) 2022-10-27 20:57:54 +00:00
Dan Field
f7b80f7a02 Roll vulkan-deps (flutter/engine#36769) 2022-10-16 23:52:05 +00:00
gaaclarke
e41c775200 Removed instances of unnecessary values (flutter/engine#36221) 2022-09-26 21:28:04 +00:00
Dan Field
f7163f555c Roll SwiftShader, ANGLE, use SwANGLE in test harnesses (flutter/engine#33814)
Roll Swiftshader, ANGLE, and Vulkan deps.

Updates license bot for new locations of licenses and new files
in roll.

Converts unit test harnesses to use SwANGLE, which is the
supported way of using SwiftShader as a software backend for GLES.

Updates goldens due to swiftshader changes.

Fixes up include paths to avoid directly including third_party
code by that name, which is unlikely to work in other build
environments.

Includes upstream patches to ANGLE and SwiftShader to build in our
windows environments, as well as patches to Skia to support
defining the location of VulkanMemoryAllocator and a patch to ANGLE
to support opting into a newer version of VMA.
2022-06-23 16:43:39 -07:00
Chris Bracken
09285aac02 Use empty in place of size checks vs 0 (flutter/engine#33151) 2022-05-06 13:09:04 -07:00
eggfly
f3efac3388 [windows] Support win_debug_x86 compilation target in engine (flutter/engine#30417) 2022-03-15 20:10:10 -07:00
ColdPaleLight
aa63b8f801 Migrate the API of GrDirectContext about resource memory limit (flutter/engine#31977) 2022-03-14 16:50:10 -07:00
Brandon DeRosier
bae75ce21d Vulkan embedder GLFW example (flutter/engine#31213) 2022-02-03 14:21:11 -08:00
Brandon DeRosier
d683f9a0c7 Vulkan support in the Embedder API (flutter/engine#29391) 2022-02-02 00:55:21 -08:00
Brandon DeRosier
2d4f908b9d Add FML_ prefix to fml/build_config.h macros (flutter/engine#31141) 2022-01-31 11:53:51 -08:00
Brandon DeRosier
94feab302c Source the Vulkan headers from KhronosGroup/Vulkan-Headers (flutter/engine#31097)
Use Khronos Vulkan-Headers repository instead of Vulkan-Docs
2022-01-27 14:34:04 -08:00
Yilong Li
193d6b62d6 [fuchsia] Use upstream FUCHSIA_buffer_collection extension. (flutter/engine#30911)
This updates Flutter engine to use the upstream FUCHSIA
buffer extension collection. It removes the obsolete
vkSetBufferCollectionConstraints() and replaces it with
vkSetBufferCollectionImageConstraints().
2022-01-20 16:05:23 -08:00
Zachary Anderson
78d9e276e2 Fix some clang-tidy lints for Linux host_debug (flutter/engine#29734) 2021-11-18 13:08:01 -08:00
Brandon DeRosier
4136d0117f Enable Skia's Vulkan backend on all non-mobile platforms, and test SwiftShader Vulkan on all GL unittests platforms (flutter/engine#29520) 2021-11-16 15:27:25 -08:00
David Worsham
877ab26be3 fuchsia: Use buffer_collection_x extension (flutter/engine#28683) 2021-09-17 15:31:26 -07:00
David Worsham
657b63f499 fuchsia: Convert vulkanb headers to DEPS (flutter/engine#28676) 2021-09-16 22:39:06 -07:00
freiling
6ad8eb6ec7 [fuchsia] boot lockup debugging improvements (flutter/engine#27459) 2021-07-22 13:06:01 -07:00
Adlai Holler
3aaa10d762 Disable Skia reduceOpsTaskSplitting option (flutter/engine#26568)
This option will be the default in Skia soon. Per discussion in #26067, let’s be explicit about disabling it for the time being, and we can revisit the flag in the future if desirable.
2021-06-17 13:11:40 -07:00
Chris Bracken
13cf185e1c Correct setup-related typos (flutter/engine#24846)
Corrects uses of setup as a verb to 'set up', leaves noun/noun-phrase
forms of setup as 'setup'. Also settles on 'teardown' as opposed to
tear-down for consistency across the codebase.

A few other minor comment/wording corrections.
2021-03-08 17:31:10 -08:00
Yilong Li
2e1ab24820 vulkan: Fix build issue due to missing VK_RESULT_RANGE_SIZE (flutter/engine#24829) 2021-03-05 15:59:02 -08:00
David Reveman
4e916d1ff6 Fix vulkan surface leaks. (flutter/engine#24372)
This fixes 3 memory leaks:

1. Destroys local vulkan buffer collections.
2. Releases image2 resource in Scenic.
3. Deregister buffer collections from Scenic session.

Co-authored-by: David Reveman <reveman@google.com>
2021-02-12 17:15:29 -05:00
David Reveman
3d688d6424 Remove unnecessary buffer collection image constraints. (flutter/engine#24347) 2021-02-11 15:56:02 -08:00
Dragoș Tiselice
ef98b148e5 Switched engine to use buffer collection. (flutter/engine#23488)
The old way of allocating images meant that one would have to make
sure that Scenic and Flutter were using exactly the same pixel
formats. This patch removes the old image allocation and replaces
it with a sysmem API that uses buffer collections instead. This
permits a smooth negotiation of formats between the two systems.
2021-01-26 12:17:13 -05:00
xster
e618085f1c Share Android surface GrDirectContext (flutter/engine#23798) 2021-01-22 12:44:02 -08:00
Basit Ayantunde
2d809abbb3 removed variable-sized array (flutter/engine#23102)
This is undefined behavior. I've replaced it with std::vector instead

Co-authored-by: Zachary Anderson <zanderso@users.noreply.github.com>
2021-01-14 14:33:29 -08:00
Jason Simmons
b76d246acb Reformat some files that were not auto-formatted (flutter/engine#21940) 2020-10-23 18:57:03 -07:00
Chris Bracken
9482036304 Revert "Define SK_VULKAN for clang-tidy runs (#21927)" (flutter/engine#22012)
This breaks linting on other targets that include skia headers that do
ifdef checks on SK_VULKAN.

This reverts commit 939c3de58aa3ebeed23221b84883aa7bd7365f2e.
2020-10-20 15:17:05 -07:00
Chris Bracken
939c3de58a Define SK_VULKAN for clang-tidy runs (flutter/engine#21927)
When linting flutter/vulkan/vulkan_window.cc, the call to
GrDirectContext::MakeVulkan is undefined when SK_VULKAN is not defined,
triggering a lint error.

Bug: https://github.com/flutter/flutter/issues/68331
2020-10-19 16:31:07 -07:00