To export a POSIX file descriptor representing the payload of a fence, call:
// Provided by VK_KHR_external_fence_fd VkResult vkGetFenceFdKHR( VkDevice device, const VkFenceGetFdInfoKHR* pGetFdInfo, int* pFd);
deviceis the logical device that created the fence being exported.
pGetFdInfois a pointer to a VkFenceGetFdInfoKHR structure containing parameters of the export operation.
pFdwill return the file descriptor representing the fence payload.
Each call to
vkGetFenceFdKHR 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 when it is no longer needed.
Ownership can be released in many ways.
For example, the application can call
VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT and the fence is signaled at
vkGetFenceFdKHR is called,
pFd may return the value
-1 instead of a valid file descriptor.
Where supported by the operating system, the implementation must set the
file descriptor to be closed automatically when an
execve system call
Exporting a file descriptor from a fence may have side effects depending on the transference of the specified handle type, as described in Importing Fence State.
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.