Do you have to do CPU-sync before xrEndFrame?

I’m making OpenXR app with DX12 and currently I just submit my renders to swapchain’s texture and then immediately (without waiting for GPU to finish) I’m calling xrEndFrame. Is it wrong? Do I have to wait for GPU to finish before I can call xrEndFrame? Nothing on this topic in the spec from what I can see.

If you submit your rendering commands on the same queue that you passed to xrCreateSession(), then you do not need to do any additional serialization. Definitely don’t add a CPU wait!

The only scenario you might want to serialize work before xrEndFrame() is if you are doing some work on a different command queue. You then need to serialize that queue with the queue you passed to xrCreateSession(), which can be done efficiently via a fence rather than a CPU wait.

I also recommend that you don’t let command lists span across xrAcquireSwapchainImage() and xrReleaseSwapchainImage() calls. The runtime will possibly enqueue some commands during these calls, so make sure to submit your commands list writing into a swapchain image before you invoke xrReleaseSwapchainImage() for that swapchain. This will ensure that your rendering commands do not attempt to use the swapchain image after its layout was transitioned.

Thanks! I just got worried that my code doesn’t have any synchronization and wanted to double-check that’s fine, I have a single queue so I think I don’t have to fix anything

iirc the only time you would need a CPU sync is before destroy swapchain (or destroying a parent handle).