| 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 55 of file ahb_swapchain_vk.cc.

55 {
56 if (!IsValid()) {
57 return nullptr;
58 }
59
60 TRACE_EVENT0("impeller", __FUNCTION__);
61 return impl_->AcquireNextDrawable();
62 }
impeller::AHBSwapchainVK::IsValid
bool IsValid() const override
Definition: ahb_swapchain_vk.cc:50

References IsValid().

## ◆ AddFinalCommandBuffer()

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

Implements impeller::SwapchainVK.

Definition at line 72 of file ahb_swapchain_vk.cc.

73 {
74 return impl_->AddFinalCommandBuffer(cmd_buffer);
75 }

## ◆ GetSurfaceFormat()

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

Implements impeller::SwapchainVK.

Definition at line 65 of file ahb_swapchain_vk.cc.

65 {
66 return IsValid()
67 ? ToVKImageFormat(ToPixelFormat(impl_->GetDescriptor().format))
68 : vk::Format::eUndefined;
69 }
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 50 of file ahb_swapchain_vk.cc.

50 {
51 return impl_ ? impl_->IsValid() : false;
52 }

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 78 of file ahb_swapchain_vk.cc.

78 {
79 if (impl_ && impl_->GetSize() == size) {
80 return;
81 }
82 TRACE_EVENT0("impeller", __FUNCTION__);
83 auto impl = AHBSwapchainImplVK::Create(context_, //
84 surface_control_, //
85 cb_, //
86 size, //
87 enable_msaa_, //
88 swapchain_image_count_ //
89 );
90 if (!impl || !impl->IsValid()) {
91 VALIDATION_LOG << "Could not resize swapchain to size: " << size;
92 return;
93 }
94 impl_ = std::move(impl);
95 }
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, size_t swapchain_image_count)
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