From 6fe7212e73de2ec4867397287d8d5f8a7b8034c6 Mon Sep 17 00:00:00 2001 From: Adam Sawicki Date: Tue, 21 Dec 2021 16:50:33 +0100 Subject: [PATCH] Improved documentation of vmaMapMemory function --- include/vk_mem_alloc.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/vk_mem_alloc.h b/include/vk_mem_alloc.h index 41616b6..03ce31f 100644 --- a/include/vk_mem_alloc.h +++ b/include/vk_mem_alloc.h @@ -1885,9 +1885,12 @@ VMA_CALL_PRE void VMA_CALL_POST vmaGetAllocationMemoryProperties( Maps memory represented by given allocation to make it accessible to CPU code. When succeeded, `*ppData` contains pointer to first byte of this memory. -If the allocation is part of bigger `VkDeviceMemory` block, the pointer is -correctly offsetted to the beginning of region assigned to this particular -allocation. + +\warning +If the allocation is part of a bigger `VkDeviceMemory` block, returned pointer is +correctly offsetted to the beginning of region assigned to this particular allocation. +Unlike the result of `vkMapMemory`, it points to the allocation, not to the beginning of the whole block. +You should not add VmaAllocationInfo::offset to it! Mapping is internally reference-counted and synchronized, so despite raw Vulkan function `vkMapMemory()` cannot be used to map same block of `VkDeviceMemory`