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
 
bool has_onscreen = false
 

Detailed Description

Definition at line 23 of file khr_swapchain_impl_vk.cc.

Constructor & Destructor Documentation

◆ KHRFrameSynchronizerVK()

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

Definition at line 32 of file khr_swapchain_impl_vk.cc.

32  {
33  auto acquire_res = device.createFenceUnique(
34  vk::FenceCreateInfo{vk::FenceCreateFlagBits::eSignaled});
35  auto render_res = device.createSemaphoreUnique({});
36  auto present_res = device.createSemaphoreUnique({});
37  if (acquire_res.result != vk::Result::eSuccess ||
38  render_res.result != vk::Result::eSuccess ||
39  present_res.result != vk::Result::eSuccess) {
40  VALIDATION_LOG << "Could not create synchronizer.";
41  return;
42  }
43  acquire = std::move(acquire_res.value);
44  render_ready = std::move(render_res.value);
45  present_ready = std::move(present_res.value);
46  is_valid = true;
47  }
#define VALIDATION_LOG
Definition: validation.h:91

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 51 of file khr_swapchain_impl_vk.cc.

51  {
52  if (auto result = device.waitForFences(
53  *acquire, // fence
54  true, // wait all
55  std::numeric_limits<uint64_t>::max() // timeout (ns)
56  );
57  result != vk::Result::eSuccess) {
58  VALIDATION_LOG << "Fence wait failed: " << vk::to_string(result);
59  return false;
60  }
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, and VALIDATION_LOG.

Member Data Documentation

◆ acquire

vk::UniqueFence impeller::KHRFrameSynchronizerVK::acquire

Definition at line 24 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 27 of file khr_swapchain_impl_vk.cc.

◆ has_onscreen

bool impeller::KHRFrameSynchronizerVK::has_onscreen = false

Definition at line 30 of file khr_swapchain_impl_vk.cc.

◆ is_valid

bool impeller::KHRFrameSynchronizerVK::is_valid = false

Definition at line 28 of file khr_swapchain_impl_vk.cc.

Referenced by KHRFrameSynchronizerVK().

◆ present_ready

vk::UniqueSemaphore impeller::KHRFrameSynchronizerVK::present_ready

Definition at line 26 of file khr_swapchain_impl_vk.cc.

Referenced by KHRFrameSynchronizerVK().

◆ render_ready

vk::UniqueSemaphore impeller::KHRFrameSynchronizerVK::render_ready

Definition at line 25 of file khr_swapchain_impl_vk.cc.

Referenced by KHRFrameSynchronizerVK().


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