OVR_EXPORT ovrPosef ovrHmd_GetEyePose(ovrHmd hmd, ovrEyeType eye) { HMDState* hmds = (HMDState*)hmd; if (!hmds) return ovrPosef(); hmds->checkBeginFrameTimingScope("ovrHmd_GetEyePose"); return hmds->TimeManager.GetEyePredictionPose(hmd, eye); }
OVR_EXPORT void ovrHmd_AddDistortionTimeMeasurement(ovrHmd hmddesc, double distortionTimeSeconds) { if (!hmddesc) return; HMDState* hmds = (HMDState*)hmddesc->Handle; hmds->checkBeginFrameTimingScope("ovrHmd_GetTimewarpEyeMatrices"); hmds->TimeManager.AddDistortionTimeMeasurement(distortionTimeSeconds); }
OVR_EXPORT void ovrHmd_EndFrameTiming(ovrHmd hmddesc) { HMDState* hmds = (HMDState*)hmddesc->Handle; if (!hmds) return; // Debug state checks: Must be in BeginFrameTiming, on the same thread. hmds->checkBeginFrameTimingScope("ovrHmd_EndTiming"); // MA TBD: Correct chek or not? // ThreadChecker::Scope checkScope(&hmds->RenderAPIThreadChecker, "ovrHmd_EndFrame"); hmds->TimeManager.EndFrame(); hmds->BeginFrameTimingCalled = false; }
ovrPosef ovrHmd_GetHmdPosePerEye(ovrHmd hmd, ovrEyeType eye) { HMDState* hmds = (HMDState*)hmd->Handle; if (!hmds) return ovrPosef(); // This isn't a great place, but since we removed ovrHmd_BeginEyeRender... // Only process latency tester for drawing the left eye (assumes left eye is drawn first) if (hmds->pRenderer && eye == 0) { hmds->LatencyTestActive = hmds->ProcessLatencyTest(hmds->LatencyTestDrawColor); } hmds->checkBeginFrameTimingScope("ovrHmd_GetEyePose"); return hmds->TimeManager.GetEyePredictionPose(hmd, eye); }
OVR_EXPORT void ovrHmd_GetEyeTimewarpMatrices(ovrHmd hmddesc, ovrEyeType eye, ovrPosef renderPose, ovrMatrix4f twmOut[2]) { if (!hmddesc) return; HMDState* hmds = (HMDState*)hmddesc->Handle; // Debug checks: BeginFrame was called, on the same thread. hmds->checkBeginFrameTimingScope("ovrHmd_GetTimewarpEyeMatrices"); hmds->TimeManager.GetTimewarpMatrices(hmddesc, eye, renderPose, twmOut); /* // MA: Took this out because new latency test approach just sames // the sample times in FrameTimeManager. // TODO: if no timewarp, then test latency in begin eye render if (eye == 0) { hmds->ProcessLatencyTest2(hmds->LatencyTest2DrawColor, -1.0f); } */ }
OVR_EXPORT void ovrHmd_EndFrameTiming(ovrHmd hmddesc) { HMDState* hmds = (HMDState*)hmddesc->Handle; if (!hmds) return; // Debug state checks: Must be in BeginFrameTiming, on the same thread. hmds->checkBeginFrameTimingScope("ovrHmd_EndTiming"); // MA TBD: Correct check or not? // ThreadChecker::Scope checkScope(&hmds->RenderAPIThreadChecker, "ovrHmd_EndFrame"); hmds->TimeManager.EndFrame(); hmds->BeginFrameTimingCalled = false; bool dk2LatencyTest = (hmds->EnabledHmdCaps & ovrHmdCap_DynamicPrediction) != 0; if (dk2LatencyTest) { Util::FrameTimeRecordSet recordset; hmds->TheLatencyTestStateReader.GetRecordSet(recordset); hmds->TimeManager.UpdateFrameLatencyTrackingAfterEndFrame( hmds->LatencyTest2DrawColor, recordset); } }