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