render/vulkan: vkMapMemory stage spans up front

We always need these mapped for CPU access, so map it up front instead
of duplicating lazy mapping at each site of use.
This commit is contained in:
Kenny Levinsen 2024-06-26 21:52:30 +02:00 committed by Simon Ser
parent bf0246e50c
commit bf67eb342b
3 changed files with 6 additions and 18 deletions

View file

@ -309,6 +309,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->cpu_mapping);
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");