HORIZON HASKELLDocslts/ghc-9.14.x3e2d5682026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 3e2d568 · 2026-10-11

Modulevulkan-3.27GHC2021

Vulkan.Extensions.VK_KHR_external_memory_fd

Name

VK_KHR_external_memory_fd - device extension

VK_KHR_external_memory_fd

Name String

VK_KHR_external_memory_fd

Extension Type

Device extension

Registered Extension Number

75

Revision

1

Ratification Status

Ratified

Extension and Version Dependencies

VK_KHR_external_memory

or

Vulkan Version 1.1

Contact

Other Extension Metadata

Last Modified Date

2016-10-21

IP Status

No known IP claims.

Contributors
  • James Jones, NVIDIA

  • Jeff Juliano, NVIDIA

Description

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 Commands

New Structures

New Enum Constants

Issues

1) Does the application need to close the file descriptor returned by getMemoryFdKHR?

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.

Version History

  • Revision 1, 2016-10-21 (James Jones)

    • Initial revision

See Also

No cross-references are available

Document Notes

For more information, see the Vulkan Specification.

This page is a generated document. Fixes and changes should be made to the generator scripts, not directly.

  • 5 types
  • 2 values
  • Packagevulkan-3.27
  • Exports9
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceVK_KHR_external_memory_fd.hs
valuegetMemoryFdKHR
  1. :: MonadIO io
  2. => Device

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

    device must be a valid Device handle

  3. -> MemoryGetFdInfoKHR

    pGetFdInfo is a pointer to a MemoryGetFdInfoKHR structure containing parameters of the export operation.

    pGetFdInfo must be a valid pointer to a valid MemoryGetFdInfoKHR structure

  4. -> io ("fd" ::: Int32)
#

vkGetMemoryFdKHR - Get a POSIX file descriptor for a memory object

Description

Each call to getMemoryFdKHR must create a new file descriptor holding a reference to the memory object’s payload and transfer ownership of the file descriptor 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.

Return Codes

Success
Failure

See Also

VK_KHR_external_memory_fd, Device, MemoryGetFdInfoKHR

valuegetMemoryFdPropertiesKHR
  1. :: MonadIO io
  2. => Device

    device is the logical device that will be importing fd.

    device must be a valid Device handle

  3. -> ExternalMemoryHandleTypeFlagBits

    handleType is a ExternalMemoryHandleTypeFlagBits value specifying the type of the handle fd.

    handleType must not be EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT

    handleType must be a valid ExternalMemoryHandleTypeFlagBits value

  4. -> "fd" ::: Int32

    fd is the handle which will be imported.

    fd must point to a valid POSIX file descriptor memory handle

  5. -> io MemoryFdPropertiesKHR
#

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

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. 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 DeviceMemory object.

Valid Usage

Valid Usage (Implicit)

Structure Chaining

Extends the structure

See Also

VK_KHR_external_memory_fd, ExternalMemoryHandleTypeFlagBits, StructureType

Constructors

Instances6Eq, Show, Storable, FromCStruct, ToCStruct, Zero

VkMemoryFdPropertiesKHR - Properties of External Memory File Descriptors

Valid Usage (Implicit)

See Also

VK_KHR_external_memory_fd, StructureType, getMemoryFdPropertiesKHR

Constructors

Instances6Eq, Show, Storable, FromCStruct, ToCStruct, Zero
datadata MemoryGetFdInfoKHR
#

VkMemoryGetFdInfoKHR - Structure describing a POSIX FD memory export operation

Description

The properties of the file descriptor exported depend on the value of handleType. See ExternalMemoryHandleTypeFlagBits for a description of the properties of the defined external memory handle types.

The size of the exported file may be larger than the size requested by MemoryAllocateInfo::allocationSize. If handleType is EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT, then the application can query the file’s actual size with lseek.

Valid Usage (Implicit)

See Also

VK_KHR_external_memory_fd, DeviceMemory, ExternalMemoryHandleTypeFlagBits, StructureType, getMemoryFdKHR

Constructors

Instances6Eq, Show, Storable, FromCStruct, ToCStruct, Zero