render/vulkan: handle vulkan_record_stage_cb() failures

This commit is contained in:
Simon Ser 2023-05-31 21:29:04 +02:00 committed by Alexander Orzechowski
parent 3f0487d310
commit ba276e5ac2
2 changed files with 8 additions and 0 deletions

View file

@ -1774,6 +1774,9 @@ static bool vulkan_read_pixels(struct wlr_renderer *wlr_renderer,
} }
VkCommandBuffer cb = vulkan_record_stage_cb(vk_renderer); VkCommandBuffer cb = vulkan_record_stage_cb(vk_renderer);
if (cb == VK_NULL_HANDLE) {
return false;
}
vulkan_change_layout(cb, dst_image, vulkan_change_layout(cb, dst_image,
VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_UNDEFINED,

View file

@ -143,6 +143,11 @@ static bool write_pixels(struct wlr_vk_texture *texture,
// record staging cb // record staging cb
// will be executed before next frame // will be executed before next frame
VkCommandBuffer cb = vulkan_record_stage_cb(renderer); VkCommandBuffer cb = vulkan_record_stage_cb(renderer);
if (cb == VK_NULL_HANDLE) {
free(copies);
return false;
}
vulkan_change_layout(cb, texture->image, vulkan_change_layout(cb, texture->image,
old_layout, src_stage, src_access, old_layout, src_stage, src_access,
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_PIPELINE_STAGE_TRANSFER_BIT,