// Copyright (c) 2016-2017 The Khronos Group Inc.
// Copyright notice at https://www.khronos.org/registry/speccopyright.html

[[VK_KHX_external_memory_fd]]
== VK_KHX_external_memory_fd

*Name String*::
    +VK_KHX_external_memory_fd+
*Extension Type*::
    Device extension
*Registered Extension Number*::
    75
*Status*::
    Draft
*Last Modified Date*::
    2016-10-21
*Revision*::
    1
*IP Status*::
    No known IP claims.
*Dependencies*::
  - This extension is written against version 1.0 of the Vulkan API.
  - Requires +VK_KHR_external_memory+.
*Contributors*::
  - James Jones, NVIDIA
  - Jeff Juliano, NVIDIA
*Contact*::
    James Jones (jajones 'at' nvidia.com)

An application may wish to reference device memory in multiple Vulkan
logical devices or instances, in multiple processes, and/or in multiple
APIs.
This extension enables an application to export POSIX file descriptor
handles from Vulkan memory objects and to import Vulkan memory objects from
POSIX file descriptor handles exported from other Vulkan memory objects or
from similar resources in other APIs.

=== New Object Types

None.

=== New Enum Constants

  * ename:VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHX
  * ename:VK_STRUCTURE_TYPE_MEMORY_FD_PROPERTIES_KHX

=== New Enums

None.

=== New Structs

  * slink:VkImportMemoryFdInfoKHX
  * slink:VkMemoryFdPropertiesKHX

=== New Functions

  * flink:vkGetMemoryFdKHX
  * flink:vkGetMemoryFdPropertiesKHX

=== Issues

1) Does the application need to close the file descriptor returned by
flink:vkGetMemoryFdKHX?

*RESOLVED*: Yes, unless it is passed back in to a driver instance to import
the memory.
A successful get call transfers ownership of the file descriptor to the
application, and a successful import transfers it back to the driver.
Destroying the original memory object will not close the file descriptor or
remove its reference to the underlying memory resource associated with it.

2) Do drivers ever need to expose multiple file descriptors per memory
object?

*RESOLVED*: No.
This would indicate there are actually multiple memory objects, rather than
a single memory object.

3) How should the valid size and memory type for POSIX file descriptor
memory handles created outside of Vulkan be specified?

*RESOLVED*: The valid memory types are queried directly from the external
handle.
The size will be specified by future extensions that introduce such external
memory handle types.
