To retrieve a host virtual address pointer to a region of a mappable memory object, call:
VkResult vkMapMemory( VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void** ppData);
deviceis the logical device that owns the memory.
VkDeviceMemoryobject to be mapped.
offsetis a zero-based byte offset from the beginning of the memory object.
sizeis the size of the memory range to map, or
VK_WHOLE_SIZEto map from
offsetto the end of the allocation.
flagsis reserved for future use.
ppDatapoints to a pointer in which is returned a host-accessible pointer to the beginning of the mapped range. This pointer minus
offsetmust be aligned to at least VkPhysicalDeviceLimits::
It is an application error to call
vkMapMemory on a memory object that
is already mapped.
vkMapMemory does not check whether the device memory is currently in
use before returning the host-accessible pointer.
The application must guarantee that any previously submitted command that
writes to this range has completed before the host reads from or writes to
that range, and that any previously submitted command that reads from that
range has completed before the host writes to that region (see
here for details on fulfilling
such a guarantee).
If the device memory was allocated without the
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT set, these guarantees must be
made for an extended range: the application must round down the start of
the range to the nearest multiple of
nonCoherentAtomSize, and round the end
of the range up to the nearest multiple of
While a range of device memory is mapped for host access, the application is responsible for synchronizing both device and host access to that memory range.
It is important for the application developer to become meticulously familiar with all of the mechanisms described in the chapter on Synchronization and Cache Control as they are crucial to maintaining memory access ordering.
For more information, see the Vulkan Specification at URL
This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.
Copyright (c) 2014-2018 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.