MCPcopy Create free account
hub / github.com/LibreVR/Revive / ovr_WaitToBeginFrame

Function ovr_WaitToBeginFrame

ReviveXR/REV_CAPI.cpp:882–911  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

880}
881
882OVR_PUBLIC_FUNCTION(ovrResult) ovr_WaitToBeginFrame(ovrSession session, long long frameIndex)
883{
884 REV_TRACE(ovr_WaitToBeginFrame);
885 MICROPROFILE_META_CPU("Wait Frame", (int)frameIndex);
886
887 if (!session)
888 return ovrError_InvalidSession;
889
890 SessionStatusBits status = session->SessionStatus;
891 if (!status.IsVisible)
892 return ovrSuccess_NotVisible;
893
894 {
895 // Wait until the session is running, since the render thread may still be initializing
896 std::unique_lock<std::mutex> lk(session->Running.first);
897 if (!session->Running.second.wait_for(lk, 10s, [session] { return session->Session != XR_NULL_HANDLE; }))
898 return ovrError_Timeout;
899 }
900
901 assert(session->CurrentFrame.is_lock_free());
902 XrIndexedFrameState* frameState = &session->FrameStats[frameIndex % ovrMaxProvidedFrameStats];
903 XrFrameWaitInfo waitInfo = XR_TYPE(FRAME_WAIT_INFO);
904 CHK_XR(xrWaitFrame(session->Session, &waitInfo, frameState));
905 frameState->frameIndex = frameIndex;
906 session->CurrentFrame = frameState;
907
908 if (session->Input)
909 session->Input->SyncInputState(session->Session, frameState->predictedDisplayPeriod);
910 return ovrSuccess;
911}
912
913OVR_PUBLIC_FUNCTION(ovrResult) ovr_BeginFrame(ovrSession session, long long frameIndex)
914{

Callers 2

BeginSessionMethod · 0.70
ovr_SubmitFrame2Function · 0.70

Calls 1

SyncInputStateMethod · 0.80

Tested by

no test coverage detected