Asynchronous timewarp - has anyone done it on Windows?
I'm currently working on adding Oculus support to a simple game I started working on years ago but never finished, and I realized that in order to use timewarp to increase the perceived frame rate, it would have to be done asynchronously. I modified my code to use 2 or 3 eye buffers (for double or triple buffering) and moved the calls to ovrHmd_BeginFrame, ovrHmd_EndFrame, etc., to a separate thread - it sits in a loop, waiting until the TimewarpPointSeconds value, then chooses the newest frame from the eye buffers and presents them to the Oculus SDK.
On Linux, this works great. I can enable options that kill the frame rate (such as not doing any visibility calculations and just drawing everything), and I can still look around fairly smoothly.
On Windows, however, doing this completely kills performance - it's worse than just doing it all in one thread. I traced the problem to the Windows SwapBuffer call - if VSync is enabled, it will cause all other OpenGL calls to hang until it returns, even ones that act on a different context. Turning VSync off "fixes" the problem because SwapBuffers returns immediately, but that can cause tearing.
Is there any other workaround for this problem other than disabling VSync?
Just for reference, my video card is an NVidia GTX 570 and the OS is Windows 7.
On Linux, this works great. I can enable options that kill the frame rate (such as not doing any visibility calculations and just drawing everything), and I can still look around fairly smoothly.
On Windows, however, doing this completely kills performance - it's worse than just doing it all in one thread. I traced the problem to the Windows SwapBuffer call - if VSync is enabled, it will cause all other OpenGL calls to hang until it returns, even ones that act on a different context. Turning VSync off "fixes" the problem because SwapBuffers returns immediately, but that can cause tearing.
Is there any other workaround for this problem other than disabling VSync?
Just for reference, my video card is an NVidia GTX 570 and the OS is Windows 7.
