VideoBackends:Vulkan: Fix command buffer cleanup

This commit is contained in:
Robin Kertels 2022-10-08 21:40:33 +02:00
parent 7498eb1e6c
commit 332824f7d5
No known key found for this signature in database
GPG Key ID: 3824904F14D40757

View File

@ -270,8 +270,8 @@ void CommandBufferManager::WaitForCommandBufferCompletion(u32 index)
// Clean up any resources for command buffers between the last known completed buffer and this // Clean up any resources for command buffers between the last known completed buffer and this
// now-completed command buffer. If we use >2 buffers, this may be more than one buffer. // now-completed command buffer. If we use >2 buffers, this may be more than one buffer.
const u64 now_completed_counter = resources.fence_counter; const u64 now_completed_counter = resources.fence_counter;
u32 cleanup_index = (index + 1) % NUM_COMMAND_BUFFERS; u32 cleanup_index = (m_current_cmd_buffer + 1) % NUM_COMMAND_BUFFERS;
while (cleanup_index != index) while (cleanup_index != m_current_cmd_buffer)
{ {
CmdBufferResources& cleanup_resources = m_command_buffers[cleanup_index]; CmdBufferResources& cleanup_resources = m_command_buffers[cleanup_index];
if (cleanup_resources.fence_counter > now_completed_counter) if (cleanup_resources.fence_counter > now_completed_counter)