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:

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


  • sType is the type of this structure.

  • pNext is NULL or a pointer to a structure extending this structure.

  • handleType is a VkExternalMemoryHandleTypeFlagBits value specifying the handle type of fd.

  • fd is the external handle to import.


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. The imported memory object holds a reference to its payload.

Applications can import the same payload 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
Valid Usage (Implicit)
  • VUID-VkImportMemoryFdInfoKHR-sType-sType

  • VUID-VkImportMemoryFdInfoKHR-handleType-parameter
    If handleType is not 0, handleType must be a valid VkExternalMemoryHandleTypeFlagBits value

See Also

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 2014-2022 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0