vkGetMemoryAndroidHardwareBufferANDROID(3)

# vkGetMemoryAndroidHardwareBufferANDROID(3) Manual Page

## Name

vkGetMemoryAndroidHardwareBufferANDROID - Get an Android hardware buffer for a memory object

## C Specification

To export an Android hardware buffer representing the underlying resources of a Vulkan device memory object, call:

    VkResult vkGetMemoryAndroidHardwareBufferANDROID(
        VkDevice                                    device,
        const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo,
        struct AHardwareBuffer**                    pBuffer);

## Parameters

- `device` is the logical device that created the device memory being exported.

- `pInfo` is a pointer to a VkMemoryGetAndroidHardwareBufferInfoANDROID structure containing parameters of the export operation.

- `pBuffer` will return an Android hardware buffer representing the underlying resources of the device memory object.

## Description

Each call to `vkGetMemoryAndroidHardwareBufferANDROID` must return an Android hardware buffer with a new reference acquired in addition to the reference held by the VkDeviceMemory. To avoid leaking resources, the application must release the reference by calling `AHardwareBuffer_release` when it is no longer needed. When called with the same handle in VkMemoryGetAndroidHardwareBufferInfoANDROID::`memory`, `vkGetMemoryAndroidHardwareBufferANDROID` must return the same Android hardware buffer object. If the device memory was created by importing an Android hardware buffer, `vkGetMemoryAndroidHardwareBufferANDROID` must return that same Android hardware buffer object.

Valid Usage (Implicit)

- `device` must be a valid `VkDevice` handle

- `pInfo` must be a valid pointer to a valid `VkMemoryGetAndroidHardwareBufferInfoANDROID` structure

- `pBuffer` must be a valid pointer to a valid pointer to an `AHardwareBuffer` value

Return Codes

On success, this command returns

  - `VK_SUCCESS`

On failure, this command returns

  - `VK_ERROR_TOO_MANY_OBJECTS`

  - `VK_ERROR_OUT_OF_HOST_MEMORY`

## See Also

VkDevice, VkMemoryGetAndroidHardwareBufferInfoANDROID

## 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 (c) 2014-2019 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.