Flutter Impeller
impeller::KHRFrameSynchronizerVK Struct Reference

Public Member Functions

 KHRFrameSynchronizerVK (const vk::Device &device)
 
 ~KHRFrameSynchronizerVK ()=default
 
bool WaitForFence (const vk::Device &device)
 

Public Attributes

vk::UniqueFence acquire
 
vk::UniqueSemaphore render_ready
 
vk::UniqueSemaphore present_ready
 
std::shared_ptr< CommandBufferfinal_cmd_buffer
 
bool is_valid = false
 

Detailed Description

Definition at line 29 of file khr_swapchain_impl_vk.cc.

Constructor & Destructor Documentation

◆ KHRFrameSynchronizerVK()

impeller::KHRFrameSynchronizerVK::KHRFrameSynchronizerVK ( const vk::Device &  device)
inlineexplicit

Definition at line 36 of file khr_swapchain_impl_vk.cc.

36  {
37  auto acquire_res = device.createFenceUnique(
38  vk::FenceCreateInfo{vk::FenceCreateFlagBits::eSignaled});
39  auto render_res = device.createSemaphoreUnique({});
40  auto present_res = device.createSemaphoreUnique({});
41  if (acquire_res.result != vk::Result::eSuccess ||
42  render_res.result != vk::Result::eSuccess ||
43  present_res.result != vk::Result::eSuccess) {
44  VALIDATION_LOG << "Could not create synchronizer.";
45  return;
46  }
47  acquire = std::move(acquire_res.value);
48  render_ready = std::move(render_res.value);
49  present_ready = std::move(present_res.value);
50  is_valid = true;
51  }

References acquire, is_valid, present_ready, render_ready, and VALIDATION_LOG.

◆ ~KHRFrameSynchronizerVK()

impeller::KHRFrameSynchronizerVK::~KHRFrameSynchronizerVK ( )
default

Member Function Documentation

◆ WaitForFence()

bool impeller::KHRFrameSynchronizerVK::WaitForFence ( const vk::Device &  device)
inline

Definition at line 55 of file khr_swapchain_impl_vk.cc.

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

References acquire, and VALIDATION_LOG.

Member Data Documentation

◆ acquire

vk::UniqueFence impeller::KHRFrameSynchronizerVK::acquire

Definition at line 30 of file khr_swapchain_impl_vk.cc.

Referenced by KHRFrameSynchronizerVK(), and WaitForFence().

◆ final_cmd_buffer

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

Definition at line 33 of file khr_swapchain_impl_vk.cc.

◆ is_valid

bool impeller::KHRFrameSynchronizerVK::is_valid = false

Definition at line 34 of file khr_swapchain_impl_vk.cc.

Referenced by KHRFrameSynchronizerVK().

◆ present_ready

vk::UniqueSemaphore impeller::KHRFrameSynchronizerVK::present_ready

Definition at line 32 of file khr_swapchain_impl_vk.cc.

Referenced by KHRFrameSynchronizerVK().

◆ render_ready

vk::UniqueSemaphore impeller::KHRFrameSynchronizerVK::render_ready

Definition at line 31 of file khr_swapchain_impl_vk.cc.

Referenced by KHRFrameSynchronizerVK().


The documentation for this struct was generated from the following file:
impeller::KHRFrameSynchronizerVK::acquire
vk::UniqueFence acquire
Definition: khr_swapchain_impl_vk.cc:30
impeller::KHRFrameSynchronizerVK::render_ready
vk::UniqueSemaphore render_ready
Definition: khr_swapchain_impl_vk.cc:31
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:73
impeller::KHRFrameSynchronizerVK::present_ready
vk::UniqueSemaphore present_ready
Definition: khr_swapchain_impl_vk.cc:32
impeller::KHRFrameSynchronizerVK::is_valid
bool is_valid
Definition: khr_swapchain_impl_vk.cc:34