C Specification
To export a POSIX file descriptor representing the payload of a semaphore, call:
// Provided by VK_KHR_external_semaphore_fd
VkResult vkGetSemaphoreFdKHR(
VkDevice device,
const VkSemaphoreGetFdInfoKHR* pGetFdInfo,
int* pFd);
Parameters
-
deviceis the logical device that created the semaphore being exported. -
pGetFdInfois a pointer to a VkSemaphoreGetFdInfoKHR structure containing parameters of the export operation. -
pFdwill return the file descriptor representing the semaphore payload.
Description
Each call to vkGetSemaphoreFdKHR 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.
|
Note
|
Ownership can be released in many ways.
For example, the application can call |
Where supported by the operating system, the implementation must set the
file descriptor to be closed automatically when an execve system call
is made.
Exporting a file descriptor from a semaphore may have side effects depending on the transference of the specified handle type, as described in Importing Semaphore State.
If
VkPhysicalDeviceVulkanSC10Properties::deviceNoDynamicHostAllocations
is VK_TRUE, vkGetSemaphoreFdKHR must not return
VK_ERROR_OUT_OF_HOST_MEMORY.
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.