5 #ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_AHB_AHB_SWAPCHAIN_IMPL_VK_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_AHB_AHB_SWAPCHAIN_IMPL_VK_H_
10 #include "flutter/fml/closure.h"
20 #include "vulkan/vulkan_handles.hpp"
51 :
public std::enable_shared_from_this<AHBSwapchainImplVK> {
71 static std::shared_ptr<AHBSwapchainImplVK>
Create(
72 const std::weak_ptr<Context>& context,
73 std::weak_ptr<android::SurfaceControl> surface_control,
116 using AutoSemaSignaler = std::shared_ptr<fml::ScopedCleanupClosure>;
118 std::weak_ptr<android::SurfaceControl> surface_control_;
120 std::shared_ptr<AHBTexturePoolVK> pool_;
121 std::shared_ptr<SwapchainTransientsVK> transients_;
125 Mutex currently_displayed_texture_mutex_;
126 std::shared_ptr<AHBTextureSourceVK> currently_displayed_texture_
127 IPLR_GUARDED_BY(currently_displayed_texture_mutex_);
129 std::vector<std::unique_ptr<AHBFrameSynchronizerVK>> frame_data_;
130 size_t frame_index_ = 0;
132 bool is_valid_ =
false;
135 const std::weak_ptr<Context>& context,
136 std::weak_ptr<android::SurfaceControl> surface_control,
141 bool Present(
const std::shared_ptr<AHBTextureSourceVK>& texture);
143 vk::UniqueSemaphore CreateRenderReadySemaphore(
144 const std::shared_ptr<fml::UniqueFD>& fd)
const;
146 bool ImportRenderReady(
147 const std::shared_ptr<fml::UniqueFD>& render_ready_fence,
148 const std::shared_ptr<AHBTextureSourceVK>& texture);
150 std::shared_ptr<ExternalSemaphoreVK> SubmitSignalForPresentReady(
151 const std::shared_ptr<AHBTextureSourceVK>& texture)
const;
153 void OnTextureUpdatedOnSurfaceControl(
154 std::shared_ptr<AHBTextureSourceVK> texture,
155 ASurfaceTransactionStats* stats);
The implementation of a swapchain at a specific size. Resizes to the surface will cause the instance ...
static std::shared_ptr< AHBSwapchainImplVK > Create(const std::weak_ptr< Context > &context, std::weak_ptr< android::SurfaceControl > surface_control, const CreateTransactionCB &cb, const ISize &size, bool enable_msaa)
Create a swapchain of a specific size whose images will be presented to the provided surface control.
AHBSwapchainImplVK(const AHBSwapchainImplVK &)=delete
AHBSwapchainImplVK & operator=(const AHBSwapchainImplVK &)=delete
std::unique_ptr< Surface > AcquireNextDrawable()
Acquire the next surface that can be used to present to the swapchain.
const android::HardwareBufferDescriptor & GetDescriptor() const
Get the descriptor used to create the hardware buffers that will be displayed on the surface control.
void AddFinalCommandBuffer(std::shared_ptr< CommandBuffer > cmd_buffer)
const ISize & GetSize() const
A wrapper for ASurfaceTransaction. https://developer.android.com/ndk/reference/group/native-activity#...
std::function< android::SurfaceTransaction()> CreateTransactionCB
static constexpr const size_t kMaxPendingPresents
~AHBFrameSynchronizerVK()
std::shared_ptr< CommandBuffer > final_cmd_buffer
AHBFrameSynchronizerVK(const vk::Device &device)
vk::UniqueSemaphore render_ready
bool WaitForFence(const vk::Device &device)
std::shared_ptr< ExternalSemaphoreVK > present_ready
A descriptor use to specify hardware buffer allocations.