From 98f6d43146a0a7c7c42d33ed9deb54987508025c Mon Sep 17 00:00:00 2001 From: Lynne Date: Tue, 15 Oct 2024 07:43:04 +0200 Subject: [PATCH] vulkan: keep track of mapped memory in the buffer structure Can/could be useful to know which buffers are mapped. --- libavutil/vulkan.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c index 0c0c3b5fbc..346ed97953 100644 --- a/libavutil/vulkan.c +++ b/libavutil/vulkan.c @@ -1064,7 +1064,7 @@ int ff_vk_map_buffers(FFVulkanContext *s, FFVkBuffer **buf, uint8_t *mem[], ff_vk_ret2str(ret)); return AVERROR_EXTERNAL; } - mem[i] = dst; + mem[i] = buf[i]->mapped_mem = dst; } if (!invalidate) @@ -1126,8 +1126,10 @@ int ff_vk_unmap_buffers(FFVulkanContext *s, FFVkBuffer **buf, int nb_buffers, } } - for (int i = 0; i < nb_buffers; i++) + for (int i = 0; i < nb_buffers; i++) { vk->UnmapMemory(s->hwctx->act_dev, buf[i]->mem); + buf[i]->mapped_mem = NULL; + } return err; }