| Flutter Impeller |

Public Member Functions | Public Attributes | List of all members
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
std::shared_ptr< CommandBuffer > | final_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 | ) |
| inline explicit

Definition at line 31 of file khr_swapchain_impl_vk.cc.

31 {
32 auto acquire_res = device.createFenceUnique(
33 vk::FenceCreateInfo{vk::FenceCreateFlagBits::eSignaled});
34 auto render_res = device.createSemaphoreUnique({});
35 if (acquire_res.result != vk::Result::eSuccess ||
36 render_res.result != vk::Result::eSuccess) {
37 VALIDATION_LOG << "Could not create synchronizer.";
38 return;
39 }
40 acquire = std::move(acquire_res.value);
41 render_ready = std::move(render_res.value);
42 is_valid = true;
43 }
impeller::KHRFrameSynchronizerVK::render_ready
vk::UniqueSemaphore render_ready
Definition: khr_swapchain_impl_vk.cc:25
impeller::KHRFrameSynchronizerVK::acquire
vk::UniqueFence acquire
Definition: khr_swapchain_impl_vk.cc:24
impeller::KHRFrameSynchronizerVK::is_valid
bool is_valid
Definition: khr_swapchain_impl_vk.cc:27
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:91

References acquire, is_valid, 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 47 of file khr_swapchain_impl_vk.cc.

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

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

## ◆ has_onscreen

bool impeller::KHRFrameSynchronizerVK::has_onscreen = false

Definition at line 29 of file khr_swapchain_impl_vk.cc.

## ◆ is_valid

bool impeller::KHRFrameSynchronizerVK::is_valid = false

Definition at line 27 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:

- impeller/renderer/backend/vulkan/swapchain/khr/khr_swapchain_impl_vk.cc