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"
15 
16 namespace impeller {
17 
18 class KHRSwapchainImplVK;
19 
20 //------------------------------------------------------------------------------
21 /// @brief A swapchain implemented backed by VK_KHR_swapchain and
22 /// VK_KHR_surface.
23 ///
24 class KHRSwapchainVK final : public SwapchainVK {
25  public:
27 
28  // |SwapchainVK|
29  bool IsValid() const override;
30 
31  // |SwapchainVK|
32  std::unique_ptr<Surface> AcquireNextDrawable() override;
33 
34  // |SwapchainVK|
35  vk::Format GetSurfaceFormat() const override;
36 
37  // |SwapchainVK|
38  void UpdateSurfaceSize(const ISize& size) override;
39 
40  // |SwapchainVK|
42  std::shared_ptr<CommandBuffer> cmd_buffer) const override;
43 
44  private:
45  friend class SwapchainVK;
46 
47  std::shared_ptr<KHRSwapchainImplVK> impl_;
48  ISize size_;
49  const bool enable_msaa_;
50 
51  KHRSwapchainVK(const std::shared_ptr<Context>& context,
52  vk::UniqueSurfaceKHR surface,
53  const ISize& size,
54  bool enable_msaa);
55 
56  KHRSwapchainVK(const KHRSwapchainVK&) = delete;
57 
58  KHRSwapchainVK& operator=(const KHRSwapchainVK&) = delete;
59 
60  std::unique_ptr<Surface> AcquireNextDrawable(size_t resize_retry_count);
61 };
62 
63 } // namespace impeller
64 
65 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_KHR_KHR_SWAPCHAIN_VK_H_
A swapchain implemented backed by VK_KHR_swapchain and VK_KHR_surface.
bool IsValid() const override
void UpdateSurfaceSize(const ISize &size) override
Mark the current swapchain configuration as dirty, forcing it to be recreated on the next frame.
vk::Format GetSurfaceFormat() const override
void AddFinalCommandBuffer(std::shared_ptr< CommandBuffer > cmd_buffer) const override
std::unique_ptr< Surface > AcquireNextDrawable() override
A swapchain that adapts to the underlying surface going out of date. If the caller cannot acquire the...
Definition: swapchain_vk.h:34