Flutter Impeller
khr_surface_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_SURFACE_VK_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_KHR_KHR_SURFACE_VK_H_
7 
8 #include <memory>
9 
13 
14 namespace impeller {
15 
16 class KHRSurfaceVK final : public Surface {
17  public:
18  using SwapCallback = std::function<bool(void)>;
19 
20  /// @brief Wrap the swapchain image in a Surface, which provides the
21  /// additional configuration required for usage as on onscreen render
22  /// target by Impeller.
23  ///
24  /// This creates the associated MSAA and depth+stencil texture.
25  static std::unique_ptr<KHRSurfaceVK> WrapSwapchainImage(
26  const std::shared_ptr<Context>& context,
27  std::shared_ptr<KHRSwapchainImageVK>& swapchain_image,
28  SwapCallback swap_callback,
29  bool enable_msaa = true);
30 
31  // |Surface|
32  ~KHRSurfaceVK() override;
33 
34  private:
35  SwapCallback swap_callback_;
36 
37  KHRSurfaceVK(const RenderTarget& target, SwapCallback swap_callback);
38 
39  // |Surface|
40  bool Present() const override;
41 
42  KHRSurfaceVK(const KHRSurfaceVK&) = delete;
43 
44  KHRSurfaceVK& operator=(const KHRSurfaceVK&) = delete;
45 };
46 
47 } // namespace impeller
48 
49 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_KHR_KHR_SURFACE_VK_H_
impeller::KHRSurfaceVK::SwapCallback
std::function< bool(void)> SwapCallback
Definition: khr_surface_vk.h:18
khr_swapchain_image_vk.h
impeller::Surface
Definition: surface.h:18
surface.h
impeller::KHRSurfaceVK
Definition: khr_surface_vk.h:16
impeller::KHRSurfaceVK::~KHRSurfaceVK
~KHRSurfaceVK() override
impeller::RenderTarget
Definition: render_target.h:38
context_vk.h
impeller
Definition: aiks_blur_unittests.cc:20
impeller::KHRSurfaceVK::WrapSwapchainImage
static std::unique_ptr< KHRSurfaceVK > WrapSwapchainImage(const std::shared_ptr< Context > &context, std::shared_ptr< KHRSwapchainImageVK > &swapchain_image, SwapCallback swap_callback, bool enable_msaa=true)
Wrap the swapchain image in a Surface, which provides the additional configuration required for usage...
Definition: khr_surface_vk.cc:14