vulkano icon indicating copy to clipboard operation
vulkano copied to clipboard

support for VK_KHR_external_fence(memory/semaphore)_*

Open zimond opened this issue 7 years ago • 9 comments

Added in 1.0.54.0

Another question: Would VK_KHR_external_fence_fd extension allow us to bind a Fence to a POSIX fd, and connect vulkano with mio/tokio/futures?

zimond avatar Jul 20 '17 07:07 zimond

Would VK_KHR_external_fence_fd extension allow us to bind a Fence to a POSIX fd, and connect vulkano with mio/tokio/futures?

Probably yes, although I don't really know mio.

tomaka avatar Jul 20 '17 07:07 tomaka

I will test to see if it works...

Currently I create a Fence in vulkano by Fence::from_pool, then pass the raw fence to vkGetFenceFdKHR, it returns the fd as -1. Am i missing something?

zimond avatar Jul 20 '17 07:07 zimond

From the specs:

If pGetFdInfo::handleType is VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT_KHR and the fence is signaled at the time vkGetFenceFdKHR is called, pFd may return the value -1 instead of a valid file descriptor.

If not both conditions are true, it's probably a bug in the driver.

nicokoch avatar Jul 20 '17 08:07 nicokoch

Also you need an additional parameter when creating the fence, to tell the implementation that you want a file descriptor from it.

tomaka avatar Jul 20 '17 08:07 tomaka

I see, I missed an extra VkExportFenceCreateInfoKHR. Thanks for the help. I will update this issue if made any progress.

zimond avatar Jul 20 '17 08:07 zimond

Tested. With the spec not mentioning the fd supporting select/epoll, enabling this extension could not glue vulkano & mio/tokio/futures (under 382 nvidia beta driver). So I guess that's it. The file descriptor is only meant to be used as a handler to connect multiple graphics APIs.

zimond avatar Jul 21 '17 09:07 zimond

Just fyi, I'm working on external fences (for now) in my fork. Not sure if it will end up in a PR though

nicokoch avatar Aug 23 '17 08:08 nicokoch

I started working on this in my fork (https://github.com/malte-v/vulkano/tree/external-objects) and added all the necessary functions, structs and constants to vk-sys. Now we need to come up with a way to cleanly incorporate the new functionality with the existing API. Any ideas?

malte-v avatar Dec 22 '19 17:12 malte-v

For those still interested, here's an initial attempt at this:

https://github.com/vulkano-rs/vulkano/pull/1467

@malte-v, I didn't see your vk-sys updates until now, but I would definitely love to see your changes land since it has things my attempt doesn't have!

gurchetansingh avatar Jan 07 '21 20:01 gurchetansingh

This is now implemented.

Rua avatar Dec 28 '22 19:12 Rua