7 #include "flutter/fml/trace_event.h"
14 const std::shared_ptr<Context>& context,
15 vk::UniqueSurfaceKHR surface,
20 if (!impl || !impl->IsValid()) {
24 return std::shared_ptr<KHRSwapchainVK>(
28 KHRSwapchainVK::KHRSwapchainVK(std::shared_ptr<KHRSwapchainImplVK> impl,
31 : impl_(
std::move(impl)), size_(size), enable_msaa_(enable_msaa) {}
36 return impl_ ? impl_->IsValid() :
false;
50 TRACE_EVENT0(
"impeller", __FUNCTION__);
52 auto result = impl_->AcquireNextDrawable();
53 if (!result.out_of_date && size_ == impl_->GetSize()) {
54 return std::move(result.surface);
57 TRACE_EVENT0(
"impeller",
"RecreateSwapchain");
61 auto context = impl_->GetContext();
62 auto [surface, old_swapchain] = impl_->DestroySwapchain();
70 if (!new_impl || !new_impl->IsValid()) {
77 impl_ = std::move(new_impl);
86 return IsValid() ? impl_->GetSurfaceFormat() : vk::Format::eUndefined;