Should I always use a fence in rendering #484
-
I see non consistent fence usage across some vulkan tutorials which confuse me a lot. For example, triangle.cpp wait for fence while rendering a frame, but vulkanscene.cpp didn't. I think there will be multiple command buffer runs on the GPU concurrently if not wait on fence, Why not wait fence can works correctly. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yes, using multiple fences to wait for command buffer completion is the proper way. The samples that don't use fences work because they use other means of synchronization like So to sum it up:
We may update the API samples to use better sync in the future, but that's not a small task. Those samples are mainly meant to showcase how to use a certain part of the API, so synchronization is secondary in those. |
Beta Was this translation helpful? Give feedback.
Yes, using multiple fences to wait for command buffer completion is the proper way. The samples that don't use fences work because they use other means of synchronization like
vkDeviceWaitIdle
orvkQueueWaitIdle
, which you should not use in practice.So to sum it up:
vkDeviceWaitIdle
orvkQueueWaitIdle
We may update the API samples to use better sync in the future, but that's not a small task. Those samples are mainly meant to showcase how to use a certain part of the API, so synchronization is secondary in those.