# vkMapMemory2(3) Manual Page

## Name

vkMapMemory2 - Map a memory object into application address space

Loading… please wait.

## C Specification

Alternatively, to retrieve a host virtual address pointer to a region of a mappable memory object, call:

    // Provided by VK_VERSION_1_4
    VkResult vkMapMemory2(
        VkDevice                                    device,
        const VkMemoryMapInfo*                      pMemoryMapInfo,
        void**                                      ppData);

or the equivalent command

    // Provided by VK_KHR_map_memory2
    VkResult vkMapMemory2KHR(
        VkDevice                                    device,
        const VkMemoryMapInfo*                      pMemoryMapInfo,
        void**                                      ppData);

## Parameters

- `device` is the logical device that owns the memory.

- `pMemoryMapInfo` is a pointer to a VkMemoryMapInfo structure describing parameters of the map.

- `ppData` is a pointer to a `void *` variable in which is returned a host-accessible pointer to the beginning of the mapped range. This pointer minus VkMemoryMapInfo::`offset` must be aligned to at least VkPhysicalDeviceLimits::`minMemoryMapAlignment`.

## Description

This function behaves identically to vkMapMemory except that it gets its parameters via an extensible structure pointer rather than directly as function arguments.

Valid Usage (Implicit)

- VUID-vkMapMemory2-device-parameter
  `device` must be a valid VkDevice handle

- VUID-vkMapMemory2-pMemoryMapInfo-parameter
  `pMemoryMapInfo` must be a valid pointer to a valid VkMemoryMapInfo structure

- VUID-vkMapMemory2-ppData-parameter
  `ppData` must be a valid pointer to a pointer value

Return Codes

On success, this command returns

  - `VK_SUCCESS`

On failure, this command returns

  - `VK_ERROR_OUT_OF_HOST_MEMORY`

  - `VK_ERROR_OUT_OF_DEVICE_MEMORY`

  - `VK_ERROR_MEMORY_MAP_FAILED`

## See Also

VK_KHR_map_memory2, VK_VERSION_1_4, VkDevice, VkMemoryMapInfo

## Document Notes

For more information, see the Vulkan Specification

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.

## Copyright

Copyright 2014-2025 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0