diff options
author | Simon Ser <contact@emersion.fr> | 2022-11-04 17:32:06 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-11-11 19:18:04 +0000 |
commit | f4f3c15c1e801760876da1fe292f24bd9f47b8ad (patch) | |
tree | 4edca21751780903471e77a9a85458edb1e8c99f /render/vulkan | |
parent | 7fdcb45e6609be4786bcb79e61d7e935b7b7fa77 (diff) |
render/vulkan: always wait for last stage to complete before rendering
When we have multiple command buffers in flight, we need to make
sure we don't start rendering before the previous texture uploads
are complete.
Diffstat (limited to 'render/vulkan')
-rw-r--r-- | render/vulkan/renderer.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/render/vulkan/renderer.c b/render/vulkan/renderer.c index dd3ec94c..72f09121 100644 --- a/render/vulkan/renderer.c +++ b/render/vulkan/renderer.c @@ -860,6 +860,8 @@ static void vulkan_end(struct wlr_renderer *wlr_renderer) { // and we have a renderpass dependency for that. uint64_t stage_timeline_point; VkTimelineSemaphoreSubmitInfoKHR stage_timeline_submit_info; + uint64_t stage_wait_timeline_point; + VkPipelineStageFlags stage_wait_stage; if (stage_cb != NULL) { stage_timeline_point = end_command_buffer(stage_cb, renderer); if (stage_timeline_point == 0) { @@ -878,6 +880,18 @@ static void vulkan_end(struct wlr_renderer *wlr_renderer) { stage_sub->commandBufferCount = 1u; stage_sub->pCommandBuffers = &pre_cb; ++submit_count; + + if (renderer->stage.last_timeline_point > 0) { + stage_wait_timeline_point = renderer->stage.last_timeline_point; + stage_wait_stage = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT; + stage_sub->waitSemaphoreCount = 1; + stage_sub->pWaitSemaphores = &renderer->timeline_semaphore; + stage_sub->pWaitDstStageMask = &stage_wait_stage; + stage_timeline_submit_info.waitSemaphoreValueCount = 1; + stage_timeline_submit_info.pWaitSemaphoreValues = &stage_wait_timeline_point; + } + + renderer->stage.last_timeline_point = stage_timeline_point; } uint64_t render_timeline_point = end_command_buffer(render_cb, renderer); |