| Flutter Impeller |

khr_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_KHR_KHR_SWAPCHAIN_VK_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_KHR_KHR_SWAPCHAIN_VK_H_
7
8 #include <memory>
9
10 #include "impeller/geometry/size.h"
11 #include "impeller/renderer/backend/vulkan/vk.h"
12 #include "impeller/renderer/context.h"
13 #include "impeller/renderer/surface.h"
14
15 namespace impeller {
16
17 class KHRSwapchainImplVK;
18
19 //------------------------------------------------------------------------------
20 /// @brief A swapchain that adapts to the underlying surface going out of
21 /// date. If the caller cannot acquire the next drawable, it is due
22 /// to an unrecoverable error and the swapchain must be recreated
23 /// with a new surface.
24 ///
25 class KHRSwapchainVK {
26 public:
27 static std::shared_ptr<KHRSwapchainVK> Create(
28 const std::shared_ptr<Context>& context,
29 vk::UniqueSurfaceKHR surface,
30 const ISize& size,
31 bool enable_msaa = true);
32
33 ~KHRSwapchainVK();
34
35 bool IsValid() const;
36
37 std::unique_ptr<Surface> AcquireNextDrawable();
38
39 vk::Format GetSurfaceFormat() const;
40
41 /// @brief Mark the current swapchain configuration as dirty, forcing it to be
42 /// recreated on the next frame.
43 void UpdateSurfaceSize(const ISize& size);
44
45 private:
46 std::shared_ptr<KHRSwapchainImplVK> impl_;
47 ISize size_;
48 const bool enable_msaa_;
49
50 KHRSwapchainVK(std::shared_ptr<KHRSwapchainImplVK> impl,
51 const ISize& size,
52 bool enable_msaa);
53
54 KHRSwapchainVK(const KHRSwapchainVK&) = delete;
55
56 KHRSwapchainVK& operator=(const KHRSwapchainVK&) = delete;
57 };
58
59 } // namespace impeller
60
61 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_KHR_KHR_SWAPCHAIN_VK_H_
impeller::KHRSwapchainVK::Create
static std::shared_ptr< KHRSwapchainVK > Create(const std::shared_ptr< Context > &context, vk::UniqueSurfaceKHR surface, const ISize &size, bool enable_msaa=true)
Definition: khr_swapchain_vk.cc:13
impeller::KHRSwapchainVK::~KHRSwapchainVK
~KHRSwapchainVK()
impeller::KHRSwapchainVK::GetSurfaceFormat
vk::Format GetSurfaceFormat() const
Definition: khr_swapchain_vk.cc:85
vk.h
impeller::KHRSwapchainVK::AcquireNextDrawable
std::unique_ptr< Surface > AcquireNextDrawable()
Definition: khr_swapchain_vk.cc:45
surface.h
impeller::TSize< int64_t >
impeller::KHRSwapchainVK
A swapchain that adapts to the underlying surface going out of date. If the caller cannot acquire the...
Definition: khr_swapchain_vk.h:25
context.h
impeller::KHRSwapchainVK::UpdateSurfaceSize
void UpdateSurfaceSize(const ISize &size)
Mark the current swapchain configuration as dirty, forcing it to be recreated on the next frame.
Definition: khr_swapchain_vk.cc:39
impeller::KHRSwapchainVK::IsValid
bool IsValid() const
Definition: khr_swapchain_vk.cc:35
impeller
Definition: aiks_blur_unittests.cc:20
size.h