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
 
bool acquire_fence_pending = false
 
vk::UniqueSemaphore render_ready = {}
 
std::shared_ptr< ExternalSemaphoreVK > present_ready
 
std::shared_ptr< CommandBuffer > final_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  if (acquire_res.result != vk::Result::eSuccess) {
34  VALIDATION_LOG << "Could not create synchronizer.";
35  return;
36  }
37  acquire = std::move(acquire_res.value);
38  is_valid = true;
39 }
#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 43 of file ahb_swapchain_impl_vk.cc.

43  {
44  return is_valid;
45 }

References is_valid.

◆ WaitForFence()

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

Definition at line 47 of file ahb_swapchain_impl_vk.cc.

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

References acquire, acquire_fence_pending, 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().

◆ acquire_fence_pending

bool impeller::AHBFrameSynchronizerVK::acquire_fence_pending = false

Definition at line 30 of file ahb_swapchain_impl_vk.h.

Referenced by WaitForFence().

◆ final_cmd_buffer

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

Definition at line 33 of file ahb_swapchain_impl_vk.h.

◆ is_valid

bool impeller::AHBFrameSynchronizerVK::is_valid = false

Definition at line 34 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 32 of file ahb_swapchain_impl_vk.h.

◆ render_ready

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

Definition at line 31 of file ahb_swapchain_impl_vk.h.


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