Emulating ID3D12Fence in Vulkan

Hi,

Is there a way to emulate DirectX 12’s Fences?
That is, I would like to know when a specific command has executed. Is this possible with VkEvents?

What is there to emulate? Aren’t Timeline Semaphores literally the Windows’ fences?

Oh sorry, I hadn’t seen the timeline semaphores yet.
Thank you!

Actually, I’m not sure if timeline semaphores fix my problem, since I need the signal operation to happen from the device when an individual command has finished, and not a whole submission.

I tried using VkEvents for that but it didn’t seem to work too.

When you say that you need a signal operation… who is “you” in this scenario? Is it a GPU process or a CPU process that is waiting on the signal? Is the GPU process in the same queue or a different queue? How did what you attempted to do “didn’t seem to work”?

I’m talking about a regular thread in the CPU. I think I will explain myself better with an example:

I have a thread that will record some commands into a command buffer, where one of them is a vkCmdCopyImageToBuffer, and submit them to a graphics queue.
Not much later, another thread may wish to wait for the vkCmdCopyImageToBuffer to complete. Currently, this is done by waiting on the VkFence that was passed to vkQueueSubmit.
However, due to some restrictions with the code I’m working with, the command buffer will very likely contain a lot of work, making the wait to take much longer. Therefore, I would like to have some object that allows me to know from the CPU when the vkCmdCopyImageToBuffer was completed without having to wait for the rest of the command buffer.
I have tried using vkCmdSetEvent with vkGetEventStatus from the CPU, but I think I misinterpreted the spec on that.

That’s something you can do easily enough. If you’re having problems with it, that sounds like a code bug.

Ok, I will re-check the code.
Thank you very much :slight_smile:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.