30 namespace OVR {
namespace CAPI {
69 double renderIMUTime,
double timewarpIMUTime )
130 int consecutiveMatch = 0;
137 int ri = recordIndex + 1;
150 if (consecutiveMatch > 1)
154 for (
int q = 0; q < consecutiveMatch; q++)
162 if (deltaSeconds > 0.0)
213 : VsyncEnabled(vsyncEnabled), DynamicPrediction(true), SdkRender(false),
236 bool dynamicPrediction,
285 double measuredVSyncToScanout;
296 (measuredVSyncToScanout > 0.0001) && (measuredVSyncToScanout < 0.06)) )
298 screenDelay += measuredVSyncToScanout;
331 double thisFrameTime,
unsigned int frameIndex)
334 double nextFrameBase;
416 thisFrameTime, frameIndex);
453 unsigned frameDelta = frameIndex - frameTiming.
FrameIndex;
460 thisFrameTime, frameIndex);
509 timewarpStartEnd[1] = timewarpStartEnd[0];
521 double timewarpStartEnd[2] = { 0.0, 0.0 };
535 Quatf timewarpStartQuat = quatFromEye * quatFromStart;
536 Quatf timewarpEndQuat = quatFromEye * quatFromEnd;
538 Matrix4f timewarpStart(timewarpStartQuat);
539 Matrix4f timewarpEnd(timewarpEndQuat);
561 timewarpStart.
M[0][1] = -timewarpStart.
M[0][1];
562 timewarpStart.
M[0][2] = -timewarpStart.
M[0][2];
563 timewarpStart.
M[1][0] = -timewarpStart.
M[1][0];
564 timewarpStart.
M[2][0] = -timewarpStart.
M[2][0];
566 timewarpEnd .
M[0][1] = -timewarpEnd .
M[0][1];
567 timewarpEnd .
M[0][2] = -timewarpEnd .
M[0][2];
568 timewarpEnd .
M[1][0] = -timewarpEnd .
M[1][0];
569 timewarpEnd .
M[2][0] = -timewarpEnd .
M[2][0];
571 twmOut[0] = timewarpStart;
572 twmOut[1] = timewarpEnd;
600 unsigned char frameLatencyTestColor,
627 if(timeSeconds < 0.0f)
630 if (Count == Capacity)
632 for(
int i=0; i< Count-1; i++)
633 TimeBufferSeconds[i] = TimeBufferSeconds[i+1];
636 TimeBufferSeconds[Count++] = timeSeconds;
641 double SortedList[Capacity];
644 memset(used, 0,
sizeof(used));
648 for (
int i=0; i<Count; i++)
650 double smallestDelta = 1000000.0;
653 for (
int j = 0; j < Count; j++)
657 if (TimeBufferSeconds[j] < smallestDelta)
659 smallestDelta = TimeBufferSeconds[j];
667 SortedList[i] = smallestDelta;
670 return SortedList[Count/2];
struct OVR::HmdRenderInfo::ShutterInfo Shutter
void InitTimingFromInputs(const TimingInputs &inputs, HmdShutterTypeEnum shutterType, double thisFrameTime, unsigned int frameIndex)
bool NeedDistortionTimeMeasurement() const
unsigned char GetNextDrawColor()
double VSyncToScanoutDelay
FrameTimeRecordEx FrameEndTimes[FramesTracked]
double calcTimewarpWaitDelta() const
OVR_EXPORT ovrSensorState ovrHmd_GetSensorState(ovrHmd hmd, double absTime)
const Timing & GetFrameTiming() const
double RenderIMUTimeSeconds
double TimewarpIMUTimeSeconds
void SaveDrawColor(unsigned char drawColor, double endFrameTime, double renderIMUTime, double timewarpIMUTime)
double GetEyePredictionTime(ovrEyeType eye)
OVR_EXPORT double ovr_GetTimeInSeconds()
Transformf GetEyePredictionPose(ovrHmd hmd, ovrEyeType eye)
double ScreenSwitchingDelay
double RenderLatencySeconds
TimeDeltaCollector DistortionRenderTimes
void Init(HmdRenderInfo &renderInfo)
static unsigned char ReadbackIndexToColor(int readbackIndex)
double RenderIMUTimeSeconds
FrameLatencyTracker ScreenLatencyTracker
double TimewarpIMUTimeSeconds
double calcScreenDelay() const
TimeDeltaCollector FrameDeltas
void AddDistortionTimeMeasurement(double distortionTimeSeconds)
void GetLatencyTimings(float latencies[3])
double NoVSyncToScanoutDelay
void GetTimewarpPredictions(ovrEyeType eye, double timewarpStartEnd[2])
double BeginFrame(unsigned frameIndex)
void UpdateFrameLatencyTrackingAfterEndFrame(unsigned char frameLatencyTestColor, const Util::FrameTimeRecordSet &rs)
void AddTimeDelta(double timeSeconds)
double calcFrameDelta() const
double GetMedianTimeDelta() const
void ResetFrameTiming(unsigned frameIndex, bool dynamicPrediction, bool sdkRender)
__BEGIN_NAMESPACE_STD void void __END_NAMESPACE_STD void __BEGIN_NAMESPACE_STD void * memset(void *__s, int __c, size_t __n) __THROW __nonnull((1))
int char * index(const char *__s, int __c) __THROW __attribute_pure__ __nonnull((1))
double TimeWarpStartEndTimes[2][2]
void MatchRecord(const Util::FrameTimeRecordSet &r)
FrameTimeManager(bool vsyncEnabled=true)
TimeDeltaCollector FrameTimeDeltas
double TimewarpLatencySeconds
bool FindReadbackIndex(int *i, int readbackIndex) const
LocklessUpdater< Timing > LocklessTiming
void GetTimewarpMatrices(ovrHmd hmd, ovrEyeType eye, ovrPosef renderPose, ovrMatrix4f twmOut[2])