vkGetMemoryFdKHR(3)

# vkGetMemoryFdKHR(3) Manual Page

## Name

vkGetMemoryFdKHR - Get a POSIX file descriptor for a memory object

Loading... please wait.

## C Specification

To export a POSIX file descriptor representing the underlying resources of a Vulkan device memory object, call:

    VkResult vkGetMemoryFdKHR(
        VkDevice                                    device,
        const VkMemoryGetFdInfoKHR*                 pGetFdInfo,
        int*                                        pFd);

## Parameters

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

- `pGetFdInfo` is a pointer to a VkMemoryGetFdInfoKHR structure containing parameters of the export operation.

- `pFd` will return a file descriptor representing the underlying resources of the device memory object.

## Description

Each call to `vkGetMemoryFdKHR` must create a new file descriptor and transfer ownership of it to the application. To avoid leaking resources, the application must release ownership of the file descriptor using the `close` system call when it is no longer needed, or by importing a Vulkan memory object from it. Where supported by the operating system, the implementation must set the file descriptor to be closed automatically when an `execve` system call is made.

Valid Usage (Implicit)

- `device` must be a valid VkDevice handle

- `pGetFdInfo` must be a valid pointer to a valid VkMemoryGetFdInfoKHR structure

- `pFd` must be a valid pointer to an `int` 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, VkMemoryGetFdInfoKHR

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