diff options
author | Simon Ser <contact@emersion.fr> | 2022-12-03 09:36:18 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-12-03 09:36:18 +0100 |
commit | dd5be430b485b975a2ef86e17015712b926c00ec (patch) | |
tree | 60309de324d7aca66608f33b4fefe9e5fb0a6705 /render/vulkan | |
parent | 27e057319a7a0c0adc68f02d5f3b707a88cab3ad (diff) |
render/vulkan: remove pre_cb in vulkan_end()
pre_cb was an alias for stage_cb->vk. Let's just use a single
variable instead.
Additionally, early return when vulkan_record_stage_cb() fails.
We were crashing in vkCmdPipelineBarrier() if that happened.
Diffstat (limited to 'render/vulkan')
-rw-r--r-- | render/vulkan/renderer.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/render/vulkan/renderer.c b/render/vulkan/renderer.c index 1a351c19..9dc51a8b 100644 --- a/render/vulkan/renderer.c +++ b/render/vulkan/renderer.c @@ -823,7 +823,13 @@ static void vulkan_end(struct wlr_renderer *wlr_renderer) { assert(render_cb != NULL); renderer->current_command_buffer = NULL; - VkCommandBuffer pre_cb = vulkan_record_stage_cb(renderer); + if (vulkan_record_stage_cb(renderer) == VK_NULL_HANDLE) { + return; + } + + struct wlr_vk_command_buffer *stage_cb = renderer->stage.cb; + assert(stage_cb != NULL); + renderer->stage.cb = NULL; renderer->render_width = 0u; renderer->render_height = 0u; @@ -929,7 +935,7 @@ static void vulkan_end(struct wlr_renderer *wlr_renderer) { ++idx; - vkCmdPipelineBarrier(pre_cb, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, + vkCmdPipelineBarrier(stage_cb->vk, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, 0, 0, NULL, 0, NULL, barrier_count, acquire_barriers); @@ -943,9 +949,6 @@ static void vulkan_end(struct wlr_renderer *wlr_renderer) { unsigned submit_count = 0u; VkSubmitInfo submit_infos[2] = {0}; - struct wlr_vk_command_buffer *stage_cb = renderer->stage.cb; - renderer->stage.cb = NULL; - // No semaphores needed here. // We don't need a semaphore from the stage/transfer submission // to the render submissions since they are on the same queue @@ -970,7 +973,7 @@ static void vulkan_end(struct wlr_renderer *wlr_renderer) { stage_sub->sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; stage_sub->pNext = &stage_timeline_submit_info; stage_sub->commandBufferCount = 1u; - stage_sub->pCommandBuffers = &pre_cb; + stage_sub->pCommandBuffers = &stage_cb->vk; stage_sub->signalSemaphoreCount = 1; stage_sub->pSignalSemaphores = &renderer->timeline_semaphore; ++submit_count; |