Flutter Impeller
impeller::AHBFrameSynchronizerVK Struct Reference

#include <ahb_swapchain_impl_vk.h>

Public Member Functions

 AHBFrameSynchronizerVK (const vk::Device &device)
 
 ~AHBFrameSynchronizerVK ()
 
bool IsValid () const
 
bool WaitForFence (const vk::Device &device)
 

Public Attributes

vk::UniqueFence acquire
 
vk::UniqueSemaphore render_ready = {}
 
std::shared_ptr< ExternalSemaphoreVKpresent_ready
 
std::shared_ptr< CommandBufferfinal_cmd_buffer
 
bool is_valid = false
 

Detailed Description

Definition at line 28 of file ahb_swapchain_impl_vk.h.

Constructor & Destructor Documentation

◆ AHBFrameSynchronizerVK()

impeller::AHBFrameSynchronizerVK::AHBFrameSynchronizerVK ( const vk::Device &  device)
explicit

Definition at line 31 of file ahb_swapchain_impl_vk.cc.

31  {
32  auto acquire_res = device.createFenceUnique(
33  vk::FenceCreateInfo{vk::FenceCreateFlagBits::eSignaled});
34  if (acquire_res.result != vk::Result::eSuccess) {
35  VALIDATION_LOG << "Could not create synchronizer.";
36  return;
37  }
38  acquire = std::move(acquire_res.value);
39  is_valid = true;
40 }
#define VALIDATION_LOG
Definition: validation.h:91

References acquire, is_valid, and VALIDATION_LOG.

◆ ~AHBFrameSynchronizerVK()

impeller::AHBFrameSynchronizerVK::~AHBFrameSynchronizerVK ( )
default

Member Function Documentation

◆ IsValid()

bool impeller::AHBFrameSynchronizerVK::IsValid ( ) const

Definition at line 44 of file ahb_swapchain_impl_vk.cc.

44  {
45  return is_valid;
46 }

References is_valid.

◆ WaitForFence()

bool impeller::AHBFrameSynchronizerVK::WaitForFence ( const vk::Device &  device)

Definition at line 48 of file ahb_swapchain_impl_vk.cc.

48  {
49  if (auto result = device.waitForFences(
50  *acquire, // fence
51  true, // wait all
52  std::numeric_limits<uint64_t>::max() // timeout (ns)
53  );
54  result != vk::Result::eSuccess) {
55  VALIDATION_LOG << "Fence wait failed: " << vk::to_string(result);
56  return false;
57  }
58  if (auto result = device.resetFences(*acquire);
59  result != vk::Result::eSuccess) {
60  VALIDATION_LOG << "Could not reset fence: " << vk::to_string(result);
61  return false;
62  }
63  return true;
64 }

References acquire, and VALIDATION_LOG.

Member Data Documentation

◆ acquire

vk::UniqueFence impeller::AHBFrameSynchronizerVK::acquire

Definition at line 29 of file ahb_swapchain_impl_vk.h.

Referenced by AHBFrameSynchronizerVK(), and WaitForFence().

◆ final_cmd_buffer

std::shared_ptr<CommandBuffer> impeller::AHBFrameSynchronizerVK::final_cmd_buffer

Definition at line 32 of file ahb_swapchain_impl_vk.h.

◆ is_valid

bool impeller::AHBFrameSynchronizerVK::is_valid = false

Definition at line 33 of file ahb_swapchain_impl_vk.h.

Referenced by AHBFrameSynchronizerVK(), and IsValid().

◆ present_ready

std::shared_ptr<ExternalSemaphoreVK> impeller::AHBFrameSynchronizerVK::present_ready

Definition at line 31 of file ahb_swapchain_impl_vk.h.

◆ render_ready

vk::UniqueSemaphore impeller::AHBFrameSynchronizerVK::render_ready = {}

Definition at line 30 of file ahb_swapchain_impl_vk.h.


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