Flutter Engine
vulkan::VulkanBackbuffer Class Reference

#include <vulkan_backbuffer.h>

Public Member Functions

 VulkanBackbuffer (const VulkanProcTable &vk, const VulkanHandle< VkDevice > &device, const VulkanHandle< VkCommandPool > &pool)
 
 ~VulkanBackbuffer ()
 
bool IsValid () const
 
bool WaitFences ()
 
bool ResetFences ()
 
const VulkanHandle< VkFence > & GetUsageFence () const
 
const VulkanHandle< VkFence > & GetRenderFence () const
 
const VulkanHandle< VkSemaphore > & GetUsageSemaphore () const
 
const VulkanHandle< VkSemaphore > & GetRenderSemaphore () const
 
VulkanCommandBufferGetUsageCommandBuffer ()
 
VulkanCommandBufferGetRenderCommandBuffer ()
 

Detailed Description

Definition at line 19 of file vulkan_backbuffer.h.

Constructor & Destructor Documentation

◆ VulkanBackbuffer()

vulkan::VulkanBackbuffer::VulkanBackbuffer ( const VulkanProcTable vk,
const VulkanHandle< VkDevice > &  device,
const VulkanHandle< VkCommandPool > &  pool 
)

Definition at line 15 of file vulkan_backbuffer.cc.

References FML_DLOG, and vulkan::VulkanCommandBuffer::IsValid().

18  : vk(p_vk),
19  device_(device),
20  usage_command_buffer_(p_vk, device, pool),
21  render_command_buffer_(p_vk, device, pool),
22  valid_(false) {
23  if (!usage_command_buffer_.IsValid() || !render_command_buffer_.IsValid()) {
24  FML_DLOG(INFO) << "Command buffers were not valid.";
25  return;
26  }
27 
28  if (!CreateSemaphores()) {
29  FML_DLOG(INFO) << "Could not create semaphores.";
30  return;
31  }
32 
33  if (!CreateFences()) {
34  FML_DLOG(INFO) << "Could not create fences.";
35  return;
36  }
37 
38  valid_ = true;
39 }
#define FML_DLOG(severity)
Definition: logging.h:85

◆ ~VulkanBackbuffer()

vulkan::VulkanBackbuffer::~VulkanBackbuffer ( )

Definition at line 41 of file vulkan_backbuffer.cc.

References FML_ALLOW_UNUSED_LOCAL, and WaitFences().

41  {
43 }
#define FML_ALLOW_UNUSED_LOCAL(x)

Member Function Documentation

◆ GetRenderCommandBuffer()

VulkanCommandBuffer & vulkan::VulkanBackbuffer::GetRenderCommandBuffer ( )

Definition at line 143 of file vulkan_backbuffer.cc.

143  {
144  return render_command_buffer_;
145 }

◆ GetRenderFence()

const VulkanHandle< VkFence > & vulkan::VulkanBackbuffer::GetRenderFence ( ) const

Definition at line 127 of file vulkan_backbuffer.cc.

127  {
128  return use_fences_[1];
129 }

◆ GetRenderSemaphore()

const VulkanHandle< VkSemaphore > & vulkan::VulkanBackbuffer::GetRenderSemaphore ( ) const

Definition at line 135 of file vulkan_backbuffer.cc.

135  {
136  return semaphores_[1];
137 }

◆ GetUsageCommandBuffer()

VulkanCommandBuffer & vulkan::VulkanBackbuffer::GetUsageCommandBuffer ( )

Definition at line 139 of file vulkan_backbuffer.cc.

139  {
140  return usage_command_buffer_;
141 }

◆ GetUsageFence()

const VulkanHandle< VkFence > & vulkan::VulkanBackbuffer::GetUsageFence ( ) const

Definition at line 123 of file vulkan_backbuffer.cc.

123  {
124  return use_fences_[0];
125 }

◆ GetUsageSemaphore()

const VulkanHandle< VkSemaphore > & vulkan::VulkanBackbuffer::GetUsageSemaphore ( ) const

Definition at line 131 of file vulkan_backbuffer.cc.

131  {
132  return semaphores_[0];
133 }

◆ IsValid()

bool vulkan::VulkanBackbuffer::IsValid ( ) const

Definition at line 45 of file vulkan_backbuffer.cc.

References VK_CALL_LOG_ERROR.

45  {
46  return valid_;
47 }

◆ ResetFences()

bool vulkan::VulkanBackbuffer::ResetFences ( )

Definition at line 111 of file vulkan_backbuffer.cc.

References VK_CALL_LOG_ERROR.

111  {
112  VkFence fences[use_fences_.size()];
113 
114  for (size_t i = 0; i < use_fences_.size(); i++) {
115  fences[i] = use_fences_[i];
116  }
117 
118  return VK_CALL_LOG_ERROR(vk.ResetFences(
119  device_, static_cast<uint32_t>(use_fences_.size()), fences)) ==
120  VK_SUCCESS;
121 }
#define VK_CALL_LOG_ERROR(expression)

◆ WaitFences()

bool vulkan::VulkanBackbuffer::WaitFences ( )

Definition at line 99 of file vulkan_backbuffer.cc.

References VK_CALL_LOG_ERROR.

Referenced by ~VulkanBackbuffer().

99  {
100  VkFence fences[use_fences_.size()];
101 
102  for (size_t i = 0; i < use_fences_.size(); i++) {
103  fences[i] = use_fences_[i];
104  }
105 
106  return VK_CALL_LOG_ERROR(vk.WaitForFences(
107  device_, static_cast<uint32_t>(use_fences_.size()), fences, true,
108  std::numeric_limits<uint64_t>::max())) == VK_SUCCESS;
109 }
#define VK_CALL_LOG_ERROR(expression)

The documentation for this class was generated from the following files: