From bf0246e50c8ba39ccc6833538d4a1e796407aa41 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Wed, 26 Jun 2024 21:59:57 +0200 Subject: [PATCH] render/vulkan: Fix 3dlut stage span map offset The mapping is shared between all users of the stage span, so it should always map the whole thing and apply the allocation offset to the mapped pointer. --- render/vulkan/pass.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/render/vulkan/pass.c b/render/vulkan/pass.c index d4305488..852bb64f 100644 --- a/render/vulkan/pass.c +++ b/render/vulkan/pass.c @@ -823,14 +823,14 @@ static bool create_3d_lut_image(struct wlr_vk_renderer *renderer, } if (!span.buffer->cpu_mapping) { - res = vkMapMemory(dev, span.buffer->memory, span.alloc.start, size, 0, &span.buffer->cpu_mapping); + res = vkMapMemory(dev, span.buffer->memory, 0, VK_WHOLE_SIZE, 0, &span.buffer->cpu_mapping); if (res != VK_SUCCESS) { wlr_vk_error("vkMapMemory", res); goto fail_imageview; } } - - float *dst = span.buffer->cpu_mapping; + char *map = (char*)span.buffer->cpu_mapping + span.alloc.start; + float *dst = (float*)map; 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++) {