Framepacing (Understanding xrEndFrame)

Hey, i am writing a custom VR engine and try to understand xrEndFrame.
I am using Vulkan.

I have a problem in that xrEndFrame always waits on the GPU before it continues and i really don’t understand why. The spec doesn’t say anything about it.

On my renderthread i submit all my command buffers at the end and then immediately call xrEndFrame. Then the renderthread waits for the whole time the GPU processes the command buffers. This only happens if i submit a layer referencing a swapchain, i don’t even have to render into it or use it.

This blocks the entire engine continuing resulting in a very poor frame rate.

Why is this happening?

Thank you very much

The spec doesn’t seem to prohibit this behavior, but I don’t think it’s intended for it to block for any significant time. Runtimes often seem to access the swapchain and add rendering commands directly in the xrEndFrame call, so it’s possible it’s blocking on a resource that isn’t available. If it’s waiting on the swapchain itself, it could be something like xrReleaseSwapchainImage not being called before xrEndFrame (although the runtime is supposed to use the previous image in that case).

It might be worth checking if other applications (especially ones that use Vulkan) experience the same issue, and if it behaves the same way with other OpenXR runtimes.

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