Don't wait for WSI fence unless it has been signalled.
This commit is contained in:
parent
d05c305210
commit
714684a4d3
|
@ -2275,16 +2275,18 @@ void vulkan_acquire_next_image(gfx_ctx_vulkan_data_t *vk)
|
||||||
vkCreateSemaphore(vk->context.device, &sem_info,
|
vkCreateSemaphore(vk->context.device, &sem_info,
|
||||||
NULL, &vk->context.swapchain_semaphores[index]);
|
NULL, &vk->context.swapchain_semaphores[index]);
|
||||||
|
|
||||||
vkWaitForFences(vk->context.device, 1, &fence, true, UINT64_MAX);
|
if (err == VK_SUCCESS)
|
||||||
|
vkWaitForFences(vk->context.device, 1, &fence, true, UINT64_MAX);
|
||||||
vkDestroyFence(vk->context.device, fence, NULL);
|
vkDestroyFence(vk->context.device, fence, NULL);
|
||||||
|
|
||||||
next_fence = &vk->context.swapchain_fences[index];
|
next_fence = &vk->context.swapchain_fences[index];
|
||||||
|
|
||||||
if (*next_fence != VK_NULL_HANDLE)
|
if (*next_fence != VK_NULL_HANDLE)
|
||||||
{
|
{
|
||||||
vkWaitForFences(vk->context.device, 1, next_fence, true, UINT64_MAX);
|
if (vk->context.swapchain_fences_signalled[index])
|
||||||
|
vkWaitForFences(vk->context.device, 1, next_fence, true, UINT64_MAX);
|
||||||
vkResetFences(vk->context.device, 1, next_fence);
|
vkResetFences(vk->context.device, 1, next_fence);
|
||||||
|
vk->context.swapchain_fences_signalled[index] = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
vkCreateFence(vk->context.device, &fence_info, NULL, next_fence);
|
vkCreateFence(vk->context.device, &fence_info, NULL, next_fence);
|
||||||
|
|
|
@ -109,6 +109,7 @@ typedef struct vulkan_context
|
||||||
|
|
||||||
VkImage swapchain_images[VULKAN_MAX_SWAPCHAIN_IMAGES];
|
VkImage swapchain_images[VULKAN_MAX_SWAPCHAIN_IMAGES];
|
||||||
VkFence swapchain_fences[VULKAN_MAX_SWAPCHAIN_IMAGES];
|
VkFence swapchain_fences[VULKAN_MAX_SWAPCHAIN_IMAGES];
|
||||||
|
bool swapchain_fences_signalled[VULKAN_MAX_SWAPCHAIN_IMAGES];
|
||||||
VkSemaphore swapchain_semaphores[VULKAN_MAX_SWAPCHAIN_IMAGES];
|
VkSemaphore swapchain_semaphores[VULKAN_MAX_SWAPCHAIN_IMAGES];
|
||||||
VkFormat swapchain_format;
|
VkFormat swapchain_format;
|
||||||
|
|
||||||
|
|
|
@ -1569,6 +1569,7 @@ static void vulkan_inject_black_frame(vk_t *vk, video_frame_info_t *video_info)
|
||||||
#endif
|
#endif
|
||||||
vkQueueSubmit(vk->context->queue, 1,
|
vkQueueSubmit(vk->context->queue, 1,
|
||||||
&submit_info, vk->context->swapchain_fences[frame_index]);
|
&submit_info, vk->context->swapchain_fences[frame_index]);
|
||||||
|
vk->context->swapchain_fences_signalled[frame_index] = true;
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
slock_unlock(vk->context->queue_lock);
|
slock_unlock(vk->context->queue_lock);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1935,6 +1936,7 @@ static bool vulkan_frame(void *data, const void *frame,
|
||||||
#endif
|
#endif
|
||||||
vkQueueSubmit(vk->context->queue, 1,
|
vkQueueSubmit(vk->context->queue, 1,
|
||||||
&submit_info, vk->context->swapchain_fences[frame_index]);
|
&submit_info, vk->context->swapchain_fences[frame_index]);
|
||||||
|
vk->context->swapchain_fences_signalled[frame_index] = true;
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
slock_unlock(vk->context->queue_lock);
|
slock_unlock(vk->context->queue_lock);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue