9#include "flutter/vulkan/procs/vulkan_proc_table.h"
23 if (!usage_command_buffer_.
IsValid() || !render_command_buffer_.
IsValid()) {
24 FML_DLOG(INFO) <<
"Command buffers were not valid.";
28 if (!CreateSemaphores()) {
29 FML_DLOG(INFO) <<
"Could not create semaphores.";
33 if (!CreateFences()) {
34 FML_DLOG(INFO) <<
"Could not create fences.";
49bool VulkanBackbuffer::CreateSemaphores() {
56 auto semaphore_collect = [
this](VkSemaphore semaphore) {
57 vk_.DestroySemaphore(device_, semaphore,
nullptr);
60 for (
size_t i = 0;
i < semaphores_.size();
i++) {
68 semaphores_[
i] = VulkanHandle<VkSemaphore>{semaphore, semaphore_collect};
74bool VulkanBackbuffer::CreateFences() {
81 auto fence_collect = [
this](VkFence fence) {
82 vk_.DestroyFence(device_, fence,
nullptr);
85 for (
size_t i = 0;
i < use_fences_.size();
i++) {
93 use_fences_[
i] = VulkanHandle<VkFence>{fence, fence_collect};
100 VkFence fences[std::tuple_size_v<
decltype(use_fences_)>];
102 for (
size_t i = 0;
i < use_fences_.size();
i++) {
103 fences[
i] = use_fences_[
i];
107 device_,
static_cast<uint32_t
>(use_fences_.size()), fences,
true,
112 VkFence fences[std::tuple_size_v<
decltype(use_fences_)>];
114 for (
size_t i = 0;
i < use_fences_.size();
i++) {
115 fences[
i] = use_fences_[
i];
119 device_,
static_cast<uint32_t
>(use_fences_.size()), fences)) ==
124 return use_fences_[0];
128 return use_fences_[1];
132 return semaphores_[0];
136 return semaphores_[1];
140 return usage_command_buffer_;
144 return render_command_buffer_;
VulkanCommandBuffer & GetUsageCommandBuffer()
const VulkanHandle< VkSemaphore > & GetUsageSemaphore() const
VulkanBackbuffer(const VulkanProcTable &vk, const VulkanHandle< VkDevice > &device, const VulkanHandle< VkCommandPool > &pool)
const VulkanHandle< VkFence > & GetUsageFence() const
const VulkanHandle< VkSemaphore > & GetRenderSemaphore() const
VulkanCommandBuffer & GetRenderCommandBuffer()
const VulkanHandle< VkFence > & GetRenderFence() const
#define FML_ALLOW_UNUSED_LOCAL(x)
#define FML_DLOG(severity)
static float max(float r, float g, float b)
@ VK_FENCE_CREATE_SIGNALED_BIT
@ VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
@ VK_STRUCTURE_TYPE_FENCE_CREATE_INFO
#define VK_CALL_LOG_ERROR(expression)