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, AHBSwapchainDtorCallsWaitIdle);
18FML_TEST_CLASS(AndroidAHBSwapchainTest,
19 AHBSwapchainNoFenceWaitAfterAcquireNextImageFailure);
20} // namespace android::testing
21
23
24//------------------------------------------------------------------------------
25/// @brief The implementation of a swapchain that uses hardware buffers
26/// presented to a given surface control on Android.
27///
28/// @warning This swapchain implementation is not available on all Android
29/// versions supported by Flutter. Perform the
30/// `IsAvailableOnPlatform` check and fallback to KHR swapchains if
31/// this type of swapchain cannot be created. The available building
32/// blocks for these kinds of swapchains are only available on
33/// Android API levels >= 29.
34///
35class AHBSwapchainVK final : public SwapchainVK {
36 public:
37 static bool IsAvailableOnPlatform();
38
39 // |SwapchainVK|
40 ~AHBSwapchainVK() override;
41
43
45
46 // |SwapchainVK|
47 bool IsValid() const override;
48
49 // |SwapchainVK|
50 std::unique_ptr<Surface> AcquireNextDrawable() override;
51
52 // |SwapchainVK|
53 vk::Format GetSurfaceFormat() const override;
54
55 // |SwapchainVK|
56 void UpdateSurfaceSize(const ISize& size) override;
57
58 // |SwapchainVK|
60 std::shared_ptr<CommandBuffer> cmd_buffer) const override;
61
62 private:
63 friend class SwapchainVK;
64 FML_FRIEND_TEST(android::testing::AndroidAHBSwapchainTest,
65 AHBSwapchainDtorCallsWaitIdle);
66 FML_FRIEND_TEST(android::testing::AndroidAHBSwapchainTest,
67 AHBSwapchainNoFenceWaitAfterAcquireNextImageFailure);
68
69 std::weak_ptr<Context> context_;
70 std::shared_ptr<android::SurfaceControl> surface_control_;
71 const bool enable_msaa_;
73 std::shared_ptr<AHBSwapchainImplVK> impl_;
74
75 explicit AHBSwapchainVK(
76 const std::shared_ptr<Context>& context,
77 const std::shared_ptr<android::SurfaceControl>& surface_control,
78 const CreateTransactionCB& cb,
79 const ISize& size,
80 bool enable_msaa);
81};
82
83} // namespace impeller
84
85#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
std::shared_ptr< ContextGLES > context