| Flutter Impeller |

Public Member Functions | Static Public Member Functions | Friends | List of all members
impeller::AHBSwapchainVK Class Referencefinal

The implementation of a swapchain that uses hardware buffers presented to a given surface control on Android. More...

`#include <ahb_swapchain_vk.h>`

Inheritance diagram for impeller::AHBSwapchainVK:

## Public Member Functions
| ~AHBSwapchainVK () override
| AHBSwapchainVK (const AHBSwapchainVK &)=delete
AHBSwapchainVK & | operator= (const AHBSwapchainVK &)=delete
bool | IsValid () const override
std::unique_ptr< Surface > | AcquireNextDrawable () override
vk::Format | GetSurfaceFormat () const override
void | UpdateSurfaceSize (const ISize &size) override
| Mark the current swapchain configuration as dirty, forcing it to be recreated on the next frame. More...
void | AddFinalCommandBuffer (std::shared_ptr< CommandBuffer > cmd_buffer) const override
Public Member Functions inherited from impeller::SwapchainVK
virtual | ~SwapchainVK ()
| SwapchainVK (const SwapchainVK &)=delete
SwapchainVK & | operator= (const SwapchainVK &)=delete

## Static Public Member Functions
static bool | IsAvailableOnPlatform ()
Static Public Member Functions inherited from impeller::SwapchainVK
static std::shared_ptr< SwapchainVK > | Create (const std::shared_ptr< Context > &context, vk::UniqueSurfaceKHR surface, const ISize &size, bool enable_msaa=true)

## Friends
class | SwapchainVK

## Additional Inherited Members
Protected Member Functions inherited from impeller::SwapchainVK
| SwapchainVK ()

## Detailed Description

The implementation of a swapchain that uses hardware buffers presented to a given surface control on Android.

Warning
  This swapchain implementation is not available on all Android versions supported by Flutter. Perform the `IsAvailableOnPlatform` check and fallback to KHR swapchains if this type of swapchain cannot be created. The available building blocks for these kinds of swapchains are only available on Android API levels >= 29.

Definition at line 29 of file ahb_swapchain_vk.h.

## Constructor & Destructor Documentation

## ◆ ~AHBSwapchainVK()

impeller::AHBSwapchainVK::~AHBSwapchainVK | ( |  | ) |
| override default

## ◆ AHBSwapchainVK()

impeller::AHBSwapchainVK::AHBSwapchainVK | ( | const AHBSwapchainVK & |  | ) |
| delete

## Member Function Documentation

## ◆ AcquireNextDrawable()

std::unique_ptr< Surface > impeller::AHBSwapchainVK::AcquireNextDrawable | ( |  | ) |
| override virtual

Implements impeller::SwapchainVK.

Definition at line 41 of file ahb_swapchain_vk.cc.

41 {
42 if (!IsValid()) {
43 return nullptr;
44 }
45
46 TRACE_EVENT0("impeller", __FUNCTION__);
47 return impl_->AcquireNextDrawable();
48 }
impeller::AHBSwapchainVK::IsValid
bool IsValid() const override
Definition: ahb_swapchain_vk.cc:36

References IsValid().

## ◆ AddFinalCommandBuffer()

void impeller::AHBSwapchainVK::AddFinalCommandBuffer | ( | std::shared_ptr< CommandBuffer > | cmd_buffer | ) | const
| override virtual

Implements impeller::SwapchainVK.

Definition at line 58 of file ahb_swapchain_vk.cc.

59 {
60 return impl_->AddFinalCommandBuffer(cmd_buffer);
61 }

## ◆ GetSurfaceFormat()

vk::Format impeller::AHBSwapchainVK::GetSurfaceFormat | ( |  | ) | const
| override virtual

Implements impeller::SwapchainVK.

Definition at line 51 of file ahb_swapchain_vk.cc.

51 {
52 return IsValid()
53 ? ToVKImageFormat(ToPixelFormat(impl_->GetDescriptor().format))
54 : vk::Format::eUndefined;
55 }
impeller::ToPixelFormat
constexpr PixelFormat ToPixelFormat(vk::Format format)
Definition: formats_vk.h:183
impeller::ToVKImageFormat
constexpr vk::Format ToVKImageFormat(PixelFormat format)
Definition: formats_vk.h:146

References IsValid(), impeller::ToPixelFormat(), and impeller::ToVKImageFormat().

## ◆ IsAvailableOnPlatform()

bool impeller::AHBSwapchainVK::IsAvailableOnPlatform | ( |  | ) |
| static

Definition at line 15 of file ahb_swapchain_vk.cc.

15 {
16 return android::SurfaceControl::IsAvailableOnPlatform() &&
17 android::HardwareBuffer::IsAvailableOnPlatform();
18 }
impeller::android::HardwareBuffer::IsAvailableOnPlatform
static bool IsAvailableOnPlatform()
Definition: hardware_buffer.cc:107
impeller::android::SurfaceControl::IsAvailableOnPlatform
static bool IsAvailableOnPlatform()
Definition: surface_control.cc:50

References impeller::android::HardwareBuffer::IsAvailableOnPlatform(), and impeller::android::SurfaceControl::IsAvailableOnPlatform().

## ◆ IsValid()

bool impeller::AHBSwapchainVK::IsValid | ( |  | ) | const
| override virtual

Implements impeller::SwapchainVK.

Definition at line 36 of file ahb_swapchain_vk.cc.

36 {
37 return impl_ ? impl_->IsValid() : false;
38 }

Referenced by AcquireNextDrawable(), and GetSurfaceFormat().

## ◆ operator=()

AHBSwapchainVK& impeller::AHBSwapchainVK::operator= | ( | const AHBSwapchainVK & |  | ) |
| delete

## ◆ UpdateSurfaceSize()

void impeller::AHBSwapchainVK::UpdateSurfaceSize | ( | const ISize & | size | ) |
| override virtual

Mark the current swapchain configuration as dirty, forcing it to be recreated on the next frame.

Implements impeller::SwapchainVK.

Definition at line 64 of file ahb_swapchain_vk.cc.

64 {
65 if (impl_ && impl_->GetSize() == size) {
66 return;
67 }
68 TRACE_EVENT0("impeller", __FUNCTION__);
69 auto impl = AHBSwapchainImplVK::Create(context_, //
70 surface_control_, //
71 cb_, //
72 size, //
73 enable_msaa_ //
74 );
75 if (!impl || !impl->IsValid()) {
76 VALIDATION_LOG << "Could not resize swapchain to size: " << size;
77 return;
78 }
79 impl_ = std::move(impl);
80 }
impeller::AHBSwapchainImplVK::Create
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.
Definition: ahb_swapchain_impl_vk.cc:66
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:91

References impeller::AHBSwapchainImplVK::Create(), and VALIDATION_LOG.

## Friends And Related Function Documentation

## ◆ SwapchainVK

friend class SwapchainVK
| friend

Definition at line 57 of file ahb_swapchain_vk.h.

The documentation for this class was generated from the following files:

- impeller/renderer/backend/vulkan/swapchain/ahb/ahb_swapchain_vk.h
- impeller/renderer/backend/vulkan/swapchain/ahb/ahb_swapchain_vk.cc