| Flutter Impeller |

Public Member Functions | Public Attributes | List of all members
impeller::FrameSynchronizer Struct Reference

## Public Member Functions
| FrameSynchronizer (const vk::Device &device)
| ~FrameSynchronizer ()=default
bool | WaitForFence (const vk::Device &device)

## Public Attributes
vk::UniqueFence | acquire
vk::UniqueSemaphore | render_ready
vk::UniqueSemaphore | present_ready
std::shared_ptr< CommandBuffer > | final_cmd_buffer
bool | is_valid = false

## Detailed Description

Definition at line 24 of file swapchain_impl_vk.cc.

## Constructor & Destructor Documentation

## ◆ FrameSynchronizer()

impeller::FrameSynchronizer::FrameSynchronizer | ( | const vk::Device & | device | ) |
| inline explicit

Definition at line 31 of file swapchain_impl_vk.cc.

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

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

## ◆ ~FrameSynchronizer()

impeller::FrameSynchronizer::~FrameSynchronizer | ( |  | ) |
| default

## Member Function Documentation

## ◆ WaitForFence()

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

Definition at line 50 of file swapchain_impl_vk.cc.

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 if (auto result = device.resetFences(*acquire);
61 result != vk::Result::eSuccess) {
62 VALIDATION_LOG << "Could not reset fence: " << vk::to_string(result);
63 return false;
64 }
65 return true;
66 }

References acquire, and VALIDATION_LOG.

## Member Data Documentation

## ◆ acquire

vk::UniqueFence impeller::FrameSynchronizer::acquire

Definition at line 25 of file swapchain_impl_vk.cc.

Referenced by FrameSynchronizer(), and WaitForFence().

## ◆ final_cmd_buffer

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

Definition at line 28 of file swapchain_impl_vk.cc.

## ◆ is_valid

bool impeller::FrameSynchronizer::is_valid = false

Definition at line 29 of file swapchain_impl_vk.cc.

Referenced by FrameSynchronizer().

## ◆ present_ready

vk::UniqueSemaphore impeller::FrameSynchronizer::present_ready

Definition at line 27 of file swapchain_impl_vk.cc.

Referenced by FrameSynchronizer().

## ◆ render_ready

vk::UniqueSemaphore impeller::FrameSynchronizer::render_ready

Definition at line 26 of file swapchain_impl_vk.cc.

Referenced by FrameSynchronizer().

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

- impeller/renderer/backend/vulkan/swapchain_impl_vk.cc

impeller::FrameSynchronizer::acquire
vk::UniqueFence acquire
Definition: swapchain_impl_vk.cc:25
impeller::FrameSynchronizer::is_valid
bool is_valid
Definition: swapchain_impl_vk.cc:29
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:60
impeller::FrameSynchronizer::present_ready
vk::UniqueSemaphore present_ready
Definition: swapchain_impl_vk.cc:27
impeller::FrameSynchronizer::render_ready
vk::UniqueSemaphore render_ready
Definition: swapchain_impl_vk.cc:26