Skip to content

comp: wait for next frame in xrWaitFrame

Christoph Haag requested to merge christoph/wait-in-waitframe into master

Ok, this is the last band aid for the frame timings I will do and I only do it because the behavior of 6e396ed0 is not great and actually stutters for me which annoys me when looking through a HMD. Short testing shows me that sleeping "too long" in xrWaitFrame makes it stutter a bit, the sleep needs to be until at least .5 ms before the predicted time. Currently the situation isn't too great anyway, so I'm adding a headroom of 1.25ms and let it be.
This commit also fixes the predicted time, when the application took too long to render and we missed a frame.

fixes 6e396ed0

It was unnecessary to move the wait to xrEndFrame. It does not matter if the compositor renders the frame immediately because the frame physically can not be displayed before the next HMD refresh.

On the other hand, leaving too short of a time for the compositor to render may delay the frame past its predicted time

Merge request reports