aboutsummaryrefslogtreecommitdiff
path: root/render/vulkan
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-01-12 18:30:59 +0100
committerSimon Zeni <simon@bl4ckb0ne.ca>2022-11-15 15:50:19 +0000
commit23540b557931bddc5053f363fa38d87e3254a78d (patch)
treecb6e8e53e72e49432b53254cb1045b42763c0a7b /render/vulkan
parent4a70172e267b52c20b8bb25b74347b25407c7247 (diff)
render: allow wlr_renderer_impl.begin to fail
Make it return a bool to indicate success/failure. Adapt the various implementations to check errors.
Diffstat (limited to 'render/vulkan')
-rw-r--r--render/vulkan/renderer.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/render/vulkan/renderer.c b/render/vulkan/renderer.c
index ff208abc..e35d4707 100644
--- a/render/vulkan/renderer.c
+++ b/render/vulkan/renderer.c
@@ -691,14 +691,14 @@ static bool vulkan_bind_buffer(struct wlr_renderer *wlr_renderer,
return true;
}
-static void vulkan_begin(struct wlr_renderer *wlr_renderer,
+static bool vulkan_begin(struct wlr_renderer *wlr_renderer,
uint32_t width, uint32_t height) {
struct wlr_vk_renderer *renderer = vulkan_get_renderer(wlr_renderer);
assert(renderer->current_render_buffer);
struct wlr_vk_command_buffer *cb = acquire_command_buffer(renderer);
if (cb == NULL) {
- return;
+ return false;
}
assert(renderer->current_command_buffer == NULL);
@@ -707,7 +707,11 @@ static void vulkan_begin(struct wlr_renderer *wlr_renderer,
VkCommandBufferBeginInfo begin_info = {
.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
};
- vkBeginCommandBuffer(cb->vk, &begin_info);
+ VkResult res = vkBeginCommandBuffer(cb->vk, &begin_info);
+ if (res != VK_SUCCESS) {
+ wlr_vk_error("vkBeginCommandBuffer", res);
+ return false;
+ }
// begin render pass
VkFramebuffer fb = renderer->current_render_buffer->framebuffer;
@@ -737,6 +741,8 @@ static void vulkan_begin(struct wlr_renderer *wlr_renderer,
renderer->render_width = width;
renderer->render_height = height;
renderer->bound_pipe = VK_NULL_HANDLE;
+
+ return true;
}
static void vulkan_end(struct wlr_renderer *wlr_renderer) {