mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-21 22:52:20 +00:00
render/vulkan: Use new span map handling for 3dlut
The use of stage spans for 3dluts was missed when the new cached mappings were introduced, meaning that it would try to map and unmap memory that might already have a cached mapping. Vulkan does not support mapping memory multiple times, so make sure the 3dlut code also uses the cached mapping to avoid segfaults after unmap.
This commit is contained in:
parent
53464074e9
commit
bc82835756
@ -821,14 +821,15 @@ static bool create_3d_lut_image(struct wlr_vk_renderer *renderer,
|
||||
goto fail_imageview;
|
||||
}
|
||||
|
||||
void *data;
|
||||
res = vkMapMemory(dev, span.buffer->memory, span.alloc.start, size, 0, &data);
|
||||
if (res != VK_SUCCESS) {
|
||||
wlr_vk_error("vkMapMemory", res);
|
||||
goto fail_imageview;
|
||||
if (!span.buffer->cpu_mapping) {
|
||||
res = vkMapMemory(dev, span.buffer->memory, span.alloc.start, size, 0, &span.buffer->cpu_mapping);
|
||||
if (res != VK_SUCCESS) {
|
||||
wlr_vk_error("vkMapMemory", res);
|
||||
goto fail_imageview;
|
||||
}
|
||||
}
|
||||
|
||||
float *dst = data;
|
||||
float *dst = span.buffer->cpu_mapping;
|
||||
size_t dim_len = lut_3d->dim_len;
|
||||
for (size_t b_index = 0; b_index < dim_len; b_index++) {
|
||||
for (size_t g_index = 0; g_index < dim_len; g_index++) {
|
||||
@ -844,8 +845,6 @@ static bool create_3d_lut_image(struct wlr_vk_renderer *renderer,
|
||||
}
|
||||
}
|
||||
|
||||
vkUnmapMemory(dev, span.buffer->memory);
|
||||
|
||||
VkCommandBuffer cb = vulkan_record_stage_cb(renderer);
|
||||
vulkan_change_layout(cb, *image,
|
||||
VK_IMAGE_LAYOUT_UNDEFINED, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, 0,
|
||||
|
Loading…
Reference in New Issue
Block a user