Flutter Engine
The Flutter Engine
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
 
vk::UniqueSemaphore present_ready
 
std::shared_ptr< CommandBufferfinal_cmd_buffer
 
bool is_valid = false
 

Detailed Description

Definition at line 28 of file khr_swapchain_impl_vk.cc.

Constructor & Destructor Documentation

◆ KHRFrameSynchronizerVK()

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

Definition at line 35 of file khr_swapchain_impl_vk.cc.

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

◆ ~KHRFrameSynchronizerVK()

impeller::KHRFrameSynchronizerVK::~KHRFrameSynchronizerVK ( )
default

Member Function Documentation

◆ WaitForFence()

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

Definition at line 54 of file khr_swapchain_impl_vk.cc.

54 {
55 if (auto result = device.waitForFences(
56 *acquire, // fence
57 true, // wait all
59 );
60 result != vk::Result::eSuccess) {
61 VALIDATION_LOG << "Fence wait failed: " << vk::to_string(result);
62 return false;
63 }
64 if (auto result = device.resetFences(*acquire);
65 result != vk::Result::eSuccess) {
66 VALIDATION_LOG << "Could not reset fence: " << vk::to_string(result);
67 return false;
68 }
69 return true;
70 }
GAsyncResult * result
static float max(float r, float g, float b)
Definition: hsl.cpp:49
static SkString to_string(int n)
Definition: nanobench.cpp:119

Member Data Documentation

◆ acquire

vk::UniqueFence impeller::KHRFrameSynchronizerVK::acquire

Definition at line 29 of file khr_swapchain_impl_vk.cc.

◆ final_cmd_buffer

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

Definition at line 32 of file khr_swapchain_impl_vk.cc.

◆ is_valid

bool impeller::KHRFrameSynchronizerVK::is_valid = false

Definition at line 33 of file khr_swapchain_impl_vk.cc.

◆ present_ready

vk::UniqueSemaphore impeller::KHRFrameSynchronizerVK::present_ready

Definition at line 31 of file khr_swapchain_impl_vk.cc.

◆ render_ready

vk::UniqueSemaphore impeller::KHRFrameSynchronizerVK::render_ready

Definition at line 30 of file khr_swapchain_impl_vk.cc.


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