| Flutter Impeller |

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_SWAPCHAIN_VK_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_SWAPCHAIN_VK_H_
7
8 #include <memory>
9
10 #include "flutter/fml/build_config.h"
11 #include "impeller/geometry/size.h"
12 #include "impeller/renderer/backend/vulkan/vk.h"
13 #include "impeller/renderer/command_buffer.h"
14 #include "impeller/renderer/context.h"
15 #include "impeller/renderer/surface.h"
16
17 #if FML_OS_ANDROID
18 #include "impeller/toolkit/android/native_window.h"
19 #include "impeller/toolkit/android/surface_transaction.h"
20 #endif // FML_OS_ANDROID
21
22 namespace impeller {
23
24 #if FML_OS_ANDROID
25 using CreateTransactionCB = std::function<android::SurfaceTransaction()>;
26 #endif // FML_OS_ANDROID
27
28 //------------------------------------------------------------------------------
29 /// @brief A swapchain that adapts to the underlying surface going out of
30 /// date. If the caller cannot acquire the next drawable, it is due
31 /// to an unrecoverable error and the swapchain must be recreated
32 /// with a new surface.
33 ///
34 class SwapchainVK {
35 public:
36 static std::shared_ptr<SwapchainVK> Create(
37 const std::shared_ptr<Context>& context,
38 vk::UniqueSurfaceKHR surface,
39 const ISize& size,
40 bool enable_msaa = true);
41
42 #if FML_OS_ANDROID
43 static std::shared_ptr<SwapchainVK> Create(
44 const std::shared_ptr<Context>& context,
45 ANativeWindow* window,
46 const CreateTransactionCB& cb,
47 bool enable_msaa = true);
48 #endif // FML_OS_ANDROID
49
50 virtual ~SwapchainVK();
51
52 SwapchainVK(const SwapchainVK&) = delete;
53
54 SwapchainVK& operator=(const SwapchainVK&) = delete;
55
56 virtual bool IsValid() const = 0;
57
58 virtual std::unique_ptr<Surface> AcquireNextDrawable() = 0;
59
60 virtual vk::Format GetSurfaceFormat() const = 0;
61
62 virtual void AddFinalCommandBuffer(
63 std::shared_ptr<CommandBuffer> cmd_buffer) const = 0;
64
65 /// @brief Mark the current swapchain configuration as dirty, forcing it to be
66 /// recreated on the next frame.
67 virtual void UpdateSurfaceSize(const ISize& size) = 0;
68
69 protected:
70 SwapchainVK();
71 };
72
73 } // namespace impeller
74
75 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_SWAPCHAIN_VK_H_
impeller::SwapchainVK
A swapchain that adapts to the underlying surface going out of date. If the caller cannot acquire the...
Definition: swapchain_vk.h:34
impeller::SwapchainVK::IsValid
virtual bool IsValid() const =0
impeller::SwapchainVK::AddFinalCommandBuffer
virtual void AddFinalCommandBuffer(std::shared_ptr< CommandBuffer > cmd_buffer) const =0
impeller::SwapchainVK::operator=
SwapchainVK & operator=(const SwapchainVK &)=delete
impeller::SwapchainVK::AcquireNextDrawable
virtual std::unique_ptr< Surface > AcquireNextDrawable()=0
impeller::SwapchainVK::~SwapchainVK
virtual ~SwapchainVK()
impeller::SwapchainVK::SwapchainVK
SwapchainVK()
impeller::SwapchainVK::UpdateSurfaceSize
virtual void UpdateSurfaceSize(const ISize &size)=0
Mark the current swapchain configuration as dirty, forcing it to be recreated on the next frame.
impeller::SwapchainVK::SwapchainVK
SwapchainVK(const SwapchainVK &)=delete
impeller::SwapchainVK::GetSurfaceFormat
virtual vk::Format GetSurfaceFormat() const =0
impeller::SwapchainVK::Create
static std::shared_ptr< SwapchainVK > Create(const std::shared_ptr< Context > &context, vk::UniqueSurfaceKHR surface, const ISize &size, bool enable_msaa=true)
Definition: swapchain_vk.cc:18
command_buffer.h
impeller
Definition: allocation.cc:12
impeller::CreateTransactionCB
std::function< android::SurfaceTransaction()> CreateTransactionCB
Definition: ahb_swapchain_impl_vk.h:24
native_window.h
context.h
surface.h
size.h
impeller::TSize
Definition: size.h:25
surface_transaction.h
vk.h