| Flutter Impeller |

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
8 #include "impeller/renderer/backend/vulkan/swapchain/ahb/ahb_swapchain_impl_vk.h"
9 #include "impeller/renderer/backend/vulkan/swapchain/swapchain_vk.h"
10 #include "impeller/toolkit/android/native_window.h"
11 #include "impeller/toolkit/android/surface_control.h"
12
13 namespace impeller {
14
15 //------------------------------------------------------------------------------
16 /// @brief The implementation of a swapchain that uses hardware buffers
17 /// presented to a given surface control on Android.
18 ///
19 /// @warning This swapchain implementation is not available on all Android
20 /// versions supported by Flutter. Perform the
21 /// `IsAvailableOnPlatform` check and fallback to KHR swapchains if
22 /// this type of swapchain cannot be created. The available building
23 /// blocks for these kinds of swapchains are only available on
24 /// Android API levels >= 29.
25 ///
26 class AHBSwapchainVK final : public SwapchainVK {
27 public:
28 static bool IsAvailableOnPlatform();
29
30 // |SwapchainVK|
31 ~AHBSwapchainVK() override;
32
33 AHBSwapchainVK(const AHBSwapchainVK&) = delete;
34
35 AHBSwapchainVK& operator=(const AHBSwapchainVK&) = delete;
36
37 // |SwapchainVK|
38 bool IsValid() const override;
39
40 // |SwapchainVK|
41 std::unique_ptr<Surface> AcquireNextDrawable() override;
42
43 // |SwapchainVK|
44 vk::Format GetSurfaceFormat() const override;
45
46 // |SwapchainVK|
47 void UpdateSurfaceSize(const ISize& size) override;
48
49 private:
50 friend class SwapchainVK;
51
52 std::weak_ptr<Context> context_;
53 std::shared_ptr<android::SurfaceControl> surface_control_;
54 const bool enable_msaa_;
55 size_t swapchain_image_count_ = 3u;
56 std::shared_ptr<AHBSwapchainImplVK> impl_;
57
58 explicit AHBSwapchainVK(const std::shared_ptr<Context>& context,
59 ANativeWindow* window,
60 const vk::UniqueSurfaceKHR& surface,
61 const ISize& size,
62 bool enable_msaa);
63 };
64
65 } // namespace impeller
66
67 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_AHB_AHB_SWAPCHAIN_VK_H_
surface_control.h
impeller::AHBSwapchainVK::AHBSwapchainVK
AHBSwapchainVK(const AHBSwapchainVK &)=delete
swapchain_vk.h
impeller::AHBSwapchainVK::AcquireNextDrawable
std::unique_ptr< Surface > AcquireNextDrawable() override
Definition: ahb_swapchain_vk.cc:53
impeller::AHBSwapchainVK::operator=
AHBSwapchainVK & operator=(const AHBSwapchainVK &)=delete
impeller::TSize
Definition: size.h:19
ahb_swapchain_impl_vk.h
impeller::AHBSwapchainVK::~AHBSwapchainVK
~AHBSwapchainVK() override
impeller::AHBSwapchainVK
The implementation of a swapchain that uses hardware buffers presented to a given surface control on ...
Definition: ahb_swapchain_vk.h:26
native_window.h
impeller::AHBSwapchainVK::IsAvailableOnPlatform
static bool IsAvailableOnPlatform()
Definition: ahb_swapchain_vk.cc:15
impeller::AHBSwapchainVK::UpdateSurfaceSize
void UpdateSurfaceSize(const ISize &size) override
Mark the current swapchain configuration as dirty, forcing it to be recreated on the next frame.
Definition: ahb_swapchain_vk.cc:70
impeller::AHBSwapchainVK::IsValid
bool IsValid() const override
Definition: ahb_swapchain_vk.cc:48
impeller::SwapchainVK
A swapchain that adapts to the underlying surface going out of date. If the caller cannot acquire the...
Definition: swapchain_vk.h:28
impeller
Definition: allocation.cc:12
impeller::AHBSwapchainVK::GetSurfaceFormat
vk::Format GetSurfaceFormat() const override
Definition: ahb_swapchain_vk.cc:63