render/vulkan: keep wlr_vk_shared_buffer mapped

This commit is contained in:
Simon Ser 2023-11-24 20:13:31 +01:00
parent 50b471e035
commit 79cbbfb366
3 changed files with 12 additions and 13 deletions

View file

@ -178,6 +178,9 @@ static void shared_buffer_destroy(struct wlr_vk_renderer *r,
}
wl_array_release(&buffer->allocs);
if (buffer->map) {
vkUnmapMemory(r->dev->dev, buffer->memory);
}
if (buffer->buffer) {
vkDestroyBuffer(r->dev->dev, buffer->buffer, NULL);
}
@ -302,6 +305,12 @@ struct wlr_vk_buffer_span vulkan_get_stage_span(struct wlr_vk_renderer *r,
goto error;
}
res = vkMapMemory(r->dev->dev, buf->memory, 0, VK_WHOLE_SIZE, 0, &buf->map);
if (res != VK_SUCCESS) {
wlr_vk_error("vkMapMemory", res);
goto error;
}
struct wlr_vk_allocation *a = wl_array_add(&buf->allocs, sizeof(*a));
if (a == NULL) {
wlr_log_errno(WLR_ERROR, "Allocation failed");