Please disable your adblock and script blockers to view this page

Life of a VR Frame


VrApi
HMD
SDK
OpenXR
vrapi_BeginFrame
Main Thread
vrapi_GetPredictedDisplayTime / vrapi_GetPredictedTracking2
the VR Runtime
API
FPS
Texture Swap Chain Availability
Blocks
PhaseSync
vrapi_SubmitFrame2
eglSwapBuffer
GPU
Inter-Process communication
IPC
FenceChecker
FrameRetirement
TimeWarp
Quest1
Quest2
Facebook Technologies
LLC


Frame
vrapi_SubmitFrame2We
XrFrameState::predictedDisplayTime
xrLocateViews
Perfetto

No matching tags


GPU


SDKsCareersFacebook


VrApi

No matching tags

Positivity     37.00%   
   Negativity   63.00%
The New York Times
SOURCE: https://developer.oculus.com/blog/a-vr-frames-life/
Write a review: Hacker News
Summary

The app doesn’t need to (and shouldn’t) insert manual wait or synchronization for frame pacing.For specific applications, depending on whether it is using VrApi or OpenXR, the behavior can be different, so we’ll address each separately.Here is what a typical multi-threaded VrApi application’s frame looks like:Start the Frame: The main thread will call vrapi_WaitFrame to start the main thread frame and vrapi_BeginFrame to start the render thread frame.Get the Poses: Applications usually need to know the HMD and controller’s poses in the simulation thread (Main Thread), so game logic or physics calculation can be executed correctly. We are predicting where the HMD pose will be at predicted display time and the later we call those sensor sampling APIs, the less prediction we need to do resulting in more accurate predictions.Submit Frame: After the rendering thread finishes all the draw call submissions, the application should call vrapi_SubmitFrame2 to tell the VR Runtime that the application has finished the frame’s CPU work. xrWaitSwapchainImage can block the render thread if the swapchain image hasn't been released by the compositor.Submit Frame:xrEndFrame is responsible for frame submission, but unlike vrapi_SubmitFrame2, it doesn’t need to do frame synchronization and swapchain availability checking as this function won’t block the render thread.A typical multithreading OpenXR application’s frame might look like the following diagram:Overall, whether you are developing a VrApi application or OpenXR application, there are two main sources of blocking; one from frame synchronization and one from swap chain availability checking. After the frame is finished displaying, the compositor also needs to hand over the data’s ownership back to the application so it can use the eye texture again, which is called “Frame Retirement.”The VR compositor is designed to handle late (stalled) frames by reusing the frame and reprojecting it again onto display, if the expected frame is not delivered on time (see TimeWarp). When TimeWarp is reading the new frame, the corresponding frame’s client side FenceChecker is required to be returned, confirming GPU rendering completion.At this point, the frame (eye textures) has arrived at the Compositor, and needs to be shown on the VR display.

As said here by