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`.
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.
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.
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.
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...
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
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.
This updates Flutter engine to use the upstream FUCHSIA
buffer extension collection. It removes the obsolete
vkSetBufferCollectionConstraints() and replaces it with
vkSetBufferCollectionImageConstraints().
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.
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.
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.
This breaks linting on other targets that include skia headers that do
ifdef checks on SK_VULKAN.
This reverts commit 939c3de58aa3ebeed23221b84883aa7bd7365f2e.
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