Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
ahb_swapchain_vk.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_AHB_AHB_SWAPCHAIN_VK_H_
6#define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_AHB_AHB_SWAPCHAIN_VK_H_
7
13
14namespace impeller {
15
16namespace android::testing {
17FML_TEST_CLASS(AndroidAHBSwapchainTest,
18 AHBSwapchainNoFenceWaitAfterAcquireNextImageFailure);
19}
20
22
23//------------------------------------------------------------------------------
24/// @brief The implementation of a swapchain that uses hardware buffers
25/// presented to a given surface control on Android.
26///
27/// @warning This swapchain implementation is not available on all Android
28/// versions supported by Flutter. Perform the
29/// `IsAvailableOnPlatform` check and fallback to KHR swapchains if
30/// this type of swapchain cannot be created. The available building
31/// blocks for these kinds of swapchains are only available on
32/// Android API levels >= 29.
33///
34class AHBSwapchainVK final : public SwapchainVK {
35 public:
36 static bool IsAvailableOnPlatform();
37
38 // |SwapchainVK|
39 ~AHBSwapchainVK() override;
40
42
44
45 // |SwapchainVK|
46 bool IsValid() const override;
47
48 // |SwapchainVK|
49 std::unique_ptr<Surface> AcquireNextDrawable() override;
50
51 // |SwapchainVK|
52 vk::Format GetSurfaceFormat() const override;
53
54 // |SwapchainVK|
55 void UpdateSurfaceSize(const ISize& size) override;
56
57 // |SwapchainVK|
59 std::shared_ptr<CommandBuffer> cmd_buffer) const override;
60
61 private:
62 friend class SwapchainVK;
63 FML_FRIEND_TEST(android::testing::AndroidAHBSwapchainTest,
64 AHBSwapchainNoFenceWaitAfterAcquireNextImageFailure);
65
66 std::weak_ptr<Context> context_;
67 std::shared_ptr<android::SurfaceControl> surface_control_;
68 const bool enable_msaa_;
70 std::shared_ptr<AHBSwapchainImplVK> impl_;
71
72 explicit AHBSwapchainVK(
73 const std::shared_ptr<Context>& context,
74 const std::shared_ptr<android::SurfaceControl>& surface_control,
75 const CreateTransactionCB& cb,
76 const ISize& size,
77 bool enable_msaa);
78};
79
80} // namespace impeller
81
82#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_AHB_AHB_SWAPCHAIN_VK_H_
The implementation of a swapchain that uses hardware buffers presented to a given surface control on ...
static bool IsAvailableOnPlatform()
void UpdateSurfaceSize(const ISize &size) override
Mark the current swapchain configuration as dirty, forcing it to be recreated on the next frame.
AHBSwapchainVK & operator=(const AHBSwapchainVK &)=delete
bool IsValid() const override
void AddFinalCommandBuffer(std::shared_ptr< CommandBuffer > cmd_buffer) const override
vk::Format GetSurfaceFormat() const override
std::unique_ptr< Surface > AcquireNextDrawable() override
AHBSwapchainVK(const AHBSwapchainVK &)=delete
A swapchain that adapts to the underlying surface going out of date. If the caller cannot acquire the...
A wrapper for ASurfaceTransaction. https://developer.android.com/ndk/reference/group/native-activity#...
#define FML_FRIEND_TEST(test_case_name, test_name)
Definition macros.h:47
#define FML_TEST_CLASS(test_case_name, test_name)
Definition macros.h:44
std::function< android::SurfaceTransaction()> CreateTransactionCB