7 #include "flutter/fml/trace_event.h"
13 KHRSwapchainVK::KHRSwapchainVK(
const std::shared_ptr<Context>& context,
14 vk::UniqueSurfaceKHR surface,
17 : size_(size), enable_msaa_(enable_msaa) {
23 if (!impl || !impl->IsValid()) {
27 impl_ = std::move(impl);
33 return impl_ ? impl_->IsValid() :
false;
47 TRACE_EVENT0(
"impeller", __FUNCTION__);
49 auto result = impl_->AcquireNextDrawable();
50 if (!result.out_of_date && size_ == impl_->GetSize()) {
51 return std::move(result.surface);
54 TRACE_EVENT0(
"impeller",
"RecreateSwapchain");
58 auto context = impl_->GetContext();
59 auto [surface, old_swapchain] = impl_->DestroySwapchain();
67 if (!new_impl || !new_impl->IsValid()) {
74 impl_ = std::move(new_impl);
83 return IsValid() ? impl_->GetSurfaceFormat() : vk::Format::eUndefined;