Flutter Engine
The Flutter Engine
Public Member Functions | Friends | List of all members
impeller::KHRSwapchainVK Class Referencefinal

A swapchain implemented backed by VK_KHR_swapchain and VK_KHR_surface. More...

#include <khr_swapchain_vk.h>

Inheritance diagram for impeller::KHRSwapchainVK:
impeller::SwapchainVK

Public Member Functions

 ~KHRSwapchainVK ()
 
bool IsValid () const override
 
std::unique_ptr< SurfaceAcquireNextDrawable () 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...
 
- Public Member Functions inherited from impeller::SwapchainVK
virtual ~SwapchainVK ()
 
 SwapchainVK (const SwapchainVK &)=delete
 
SwapchainVKoperator= (const SwapchainVK &)=delete
 
virtual bool IsValid () const =0
 
virtual std::unique_ptr< SurfaceAcquireNextDrawable ()=0
 
virtual vk::Format GetSurfaceFormat () const =0
 
virtual void UpdateSurfaceSize (const ISize &size)=0
 Mark the current swapchain configuration as dirty, forcing it to be recreated on the next frame. More...
 

Friends

class SwapchainVK
 

Additional Inherited Members

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

Detailed Description

A swapchain implemented backed by VK_KHR_swapchain and VK_KHR_surface.

Definition at line 24 of file khr_swapchain_vk.h.

Constructor & Destructor Documentation

◆ ~KHRSwapchainVK()

impeller::KHRSwapchainVK::~KHRSwapchainVK ( )
default

Member Function Documentation

◆ AcquireNextDrawable()

std::unique_ptr< Surface > impeller::KHRSwapchainVK::AcquireNextDrawable ( )
overridevirtual

We managed to recreate the swapchain in the new configuration. Try again.

Implements impeller::SwapchainVK.

Definition at line 42 of file khr_swapchain_vk.cc.

42 {
43 if (!IsValid()) {
44 return nullptr;
45 }
46
47 TRACE_EVENT0("impeller", __FUNCTION__);
48
49 auto result = impl_->AcquireNextDrawable();
50 if (!result.out_of_date && size_ == impl_->GetSize()) {
51 return std::move(result.surface);
52 }
53
54 TRACE_EVENT0("impeller", "RecreateSwapchain");
55
56 // This swapchain implementation indicates that it is out of date. Tear it
57 // down and make a new one.
58 auto context = impl_->GetContext();
59 auto [surface, old_swapchain] = impl_->DestroySwapchain();
60
61 auto new_impl = KHRSwapchainImplVK::Create(context, //
62 std::move(surface), //
63 size_, //
64 enable_msaa_, //
65 *old_swapchain //
66 );
67 if (!new_impl || !new_impl->IsValid()) {
68 VALIDATION_LOG << "Could not update swapchain.";
69 // The old swapchain is dead because we took its surface. This is
70 // unrecoverable.
71 impl_.reset();
72 return nullptr;
73 }
74 impl_ = std::move(new_impl);
75
76 //----------------------------------------------------------------------------
77 /// We managed to recreate the swapchain in the new configuration. Try again.
78 ///
79 return AcquireNextDrawable();
80}
static std::shared_ptr< KHRSwapchainImplVK > Create(const std::shared_ptr< Context > &context, vk::UniqueSurfaceKHR surface, const ISize &size, bool enable_msaa=true, vk::SwapchainKHR old_swapchain=VK_NULL_HANDLE)
bool IsValid() const override
std::unique_ptr< Surface > AcquireNextDrawable() override
VkSurfaceKHR surface
Definition: main.cc:49
GAsyncResult * result
#define TRACE_EVENT0(category_group, name)
Definition: trace_event.h:131
#define VALIDATION_LOG
Definition: validation.h:73

◆ GetSurfaceFormat()

vk::Format impeller::KHRSwapchainVK::GetSurfaceFormat ( ) const
overridevirtual

Implements impeller::SwapchainVK.

Definition at line 82 of file khr_swapchain_vk.cc.

82 {
83 return IsValid() ? impl_->GetSurfaceFormat() : vk::Format::eUndefined;
84}

◆ IsValid()

bool impeller::KHRSwapchainVK::IsValid ( ) const
overridevirtual

Implements impeller::SwapchainVK.

Definition at line 32 of file khr_swapchain_vk.cc.

32 {
33 return impl_ ? impl_->IsValid() : false;
34}

◆ UpdateSurfaceSize()

void impeller::KHRSwapchainVK::UpdateSurfaceSize ( const ISize size)
overridevirtual

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

Implements impeller::SwapchainVK.

Definition at line 36 of file khr_swapchain_vk.cc.

36 {
37 // Update the size of the swapchain. On the next acquired drawable,
38 // the sizes may no longer match, forcing the swapchain to be recreated.
39 size_ = size;
40}
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259

Friends And Related Function Documentation

◆ SwapchainVK

friend class SwapchainVK
friend

Definition at line 41 of file khr_swapchain_vk.h.


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