7 #include "flutter/fml/trace_event.h"
19 const std::shared_ptr<Context>& context,
20 vk::UniqueSurfaceKHR surface,
23 auto swapchain = std::shared_ptr<KHRSwapchainVK>(
24 new KHRSwapchainVK(context, std::move(surface), size, enable_msaa));
25 if (!swapchain->IsValid()) {
34 const std::shared_ptr<Context>& context,
35 ANativeWindow* p_window,
38 TRACE_EVENT0(
"impeller",
"CreateAndroidSwapchain");
43 android::NativeWindow window(p_window);
44 if (!window.IsValid()) {
53 auto ahb_swapchain = std::shared_ptr<AHBSwapchainVK>(
new AHBSwapchainVK(
61 if (ahb_swapchain->IsValid()) {
65 <<
"Could not create AHB swapchain. Falling back to KHR variant.";
69 vk::AndroidSurfaceCreateInfoKHR surface_info;
70 surface_info.setWindow(window.GetHandle());
71 auto [result, surface] =
74 if (result != vk::Result::eSuccess) {
76 << vk::to_string(result);
81 return Create(context, std::move(surface), window.GetSize(), enable_msaa);
static bool IsAvailableOnPlatform()
static ContextVK & Cast(Context &base)
bool GetShouldEnableSurfaceControlSwapchain() const
Whether the Android Surface control based swapchain should be enabled.
vk::Instance GetInstance() const
A swapchain implemented backed by VK_KHR_swapchain and VK_KHR_surface.
static std::shared_ptr< SwapchainVK > Create(const std::shared_ptr< Context > &context, vk::UniqueSurfaceKHR surface, const ISize &size, bool enable_msaa=true)
std::function< android::SurfaceTransaction()> CreateTransactionCB