Anyway I can know which fence is signaled by using `vkWaitForFences`?

Is there anyway I can know which fence is signaled by using vkWaitForFences(waitAll is false)? Currently I have to iterate all fences by using vkGetFenceStatus if vkWaitForFences returns, which is not very efficiency. (sort of evolute from select to epoll).

I found vkGetFenceFdKHR , but the doc said it is a POSIX file descriptor handle, I guess it is not portable.

It’s portable, except to Windows. For Windows, I believe the corresponding call is:

Background: In Vulkan with semaphores and memory objects, there’s a Windows vs. everything else split. With fences for instance:

That split carries through to the OpenGL extensions which interop with it.

The best hint I’ve seen on the why is in NVIDIA’s presentation of the Vulkan interop extensions for OpenGL back in 2017 (see p. 56):

1 Like

Related:

Bad thing is that the doc says nothing about whether the file should support select/poll/epoll, and I checked that a lot of drivers just only create a fd, nothing else, so I guess neither vkGetFenceFdKHR nor vkGetFenceWin32HandleKHR is safe for what I want.

I’m no expert, but this might be what you’re looking for:

VkExternalFenceHandleTypeFlagBits:

Similarly for semaphores.

1 Like