5 #ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_IMPL_VK_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_IMPL_VK_H_
12 #include "flutter/fml/macros.h"
14 #include "vulkan/vulkan_enums.hpp"
19 class SwapchainImageVK;
21 struct FrameSynchronizer;
32 :
public std::enable_shared_from_this<SwapchainImplVK> {
34 static std::shared_ptr<SwapchainImplVK>
Create(
35 const std::shared_ptr<Context>& context,
36 vk::UniqueSurfaceKHR surface,
37 vk::SwapchainKHR old_swapchain = VK_NULL_HANDLE,
38 vk::SurfaceTransformFlagBitsKHR last_transform =
39 vk::SurfaceTransformFlagBitsKHR::eIdentity);
67 std::weak_ptr<Context> context_;
68 vk::UniqueSurfaceKHR surface_;
69 vk::Queue present_queue_ = {};
70 vk::Format surface_format_ = vk::Format::eUndefined;
71 vk::UniqueSwapchainKHR swapchain_;
72 std::vector<std::shared_ptr<SwapchainImageVK>> images_;
73 std::vector<std::unique_ptr<FrameSynchronizer>> synchronizers_;
74 size_t current_frame_ = 0u;
75 bool is_valid_ =
false;
76 size_t current_transform_poll_count_ = 0u;
77 vk::SurfaceTransformFlagBitsKHR transform_if_changed_discard_swapchain_;
79 SwapchainImplVK(
const std::shared_ptr<Context>& context,
80 vk::UniqueSurfaceKHR surface,
81 vk::SwapchainKHR old_swapchain,
82 vk::SurfaceTransformFlagBitsKHR last_transform);
84 bool Present(
const std::shared_ptr<SwapchainImageVK>& image, uint32_t index);
86 void WaitIdle()
const;
88 SwapchainImplVK(
const SwapchainImplVK&) =
delete;
90 SwapchainImplVK& operator=(
const SwapchainImplVK&) =
delete;
95 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_IMPL_VK_H_