# VkImportMemoryFdInfoKHR(3) Manual Page

## Name

VkImportMemoryFdInfoKHR - import memory created on the same physical device from a file descriptor

## C Specification

To import memory from a POSIX file descriptor handle, add a VkImportMemoryFdInfoKHR structure to the `pNext` chain of the VkMemoryAllocateInfo structure. The `VkImportMemoryFdInfoKHR` structure is defined as:

    typedef struct VkImportMemoryFdInfoKHR {
        VkStructureType                       sType;
        const void*                           pNext;
        VkExternalMemoryHandleTypeFlagBits    handleType;
        int                                   fd;
    } VkImportMemoryFdInfoKHR;

## Members

- `sType` is the type of this structure.

- `pNext` is `NULL` or a pointer to an extension-specific structure.

- `handleType` specifies the handle type of `fd`.

- `fd` is the external handle to import.

## Description

Importing memory from a file descriptor transfers ownership of the file descriptor from the application to the Vulkan implementation. The application must not perform any operations on the file descriptor after a successful import.

Applications can import the same underlying memory into multiple instances of Vulkan, into the same instance from which it was exported, and multiple times into a given Vulkan instance. In all cases, each import operation must create a distinct `VkDeviceMemory` object.

Valid Usage

- If `handleType` is not `0`, it must be supported for import, as reported by VkExternalImageFormatProperties or VkExternalBufferProperties.

- The memory from which `fd` was exported must have been created on the same underlying physical device as `device`.

- If `handleType` is not `0`, it must be defined as a POSIX file descriptor handle.

- If `handleType` is not `0`, `fd` must be a valid handle of the type specified by `handleType`.

- The memory represented by `fd` must have been created from a physical device and driver that is compatible with `device` and `handleType`, as described in https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#external-memory-handle-types-compatibility.

- `fd` must obey any requirements listed for `handleType` in external memory handle types compatibility.

Valid Usage (Implicit)

- `sType` must be `VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR`

- If `handleType` is not `0`, `handleType` must be a valid VkExternalMemoryHandleTypeFlagBits value

## See Also

VkExternalMemoryHandleTypeFlagBits, VkStructureType

## 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.