Vulkan: Fix present semaphores reuse

Fixes validation errors.
See https://docs.vulkan.org/guide/latest/swapchain_semaphore_reuse.html
This commit is contained in:
Martino Fontana
2025-07-14 15:52:55 +02:00
parent 5cc0a5a3be
commit b80e178403
4 changed files with 35 additions and 22 deletions

View File

@ -21,7 +21,7 @@ public:
explicit CommandBufferManager(bool use_threaded_submission);
~CommandBufferManager();
bool Initialize();
bool Initialize(size_t swapchain_image_count);
// These command buffers are allocated per-frame. They are valid until the command buffer
// is submitted, after that you should call these functions again.
@ -94,7 +94,7 @@ public:
void DeferImageViewDestruction(VkImageView object);
private:
bool CreateCommandBuffers();
bool CreateCommandBuffers(size_t swapchain_image_count);
void DestroyCommandBuffers();
bool CreateSubmitThread();
@ -153,7 +153,7 @@ private:
u32 command_buffer_index;
};
Common::WorkQueueThreadSP<PendingCommandBufferSubmit> m_submit_thread;
VkSemaphore m_present_semaphore = VK_NULL_HANDLE;
std::vector<VkSemaphore> m_present_semaphores = {};
Common::Flag m_last_present_failed;
VkResult m_last_present_result = VK_SUCCESS;
bool m_use_threaded_submission = false;