Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Reuse the last frame and tracking when a VR frame is discarded in Ocu…
Browse files Browse the repository at this point in the history
…lus (#2341)
  • Loading branch information
MortimerGoro authored and bluemarvin committed Nov 21, 2019
1 parent b1f6014 commit 4254845
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion app/src/oculusvr/cpp/DeviceDelegateOculusVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,9 @@ struct DeviceDelegateOculusVR::State {
uint32_t frameIndex = 0;
double predictedDisplayTime = 0;
ovrTracking2 predictedTracking = {};
ovrTracking2 discardPredictedTracking = {};
uint32_t discardedFrameIndex = 0;
int discardCount = 0;
uint32_t renderWidth = 0;
uint32_t renderHeight = 0;
int32_t standaloneFoveatedLevel = 0;
Expand Down Expand Up @@ -1463,7 +1466,17 @@ DeviceDelegateOculusVR::EndFrame(const bool aDiscard) {
}

if (aDiscard) {
return;
// Reuse the last frame when a frame is discarded.
// The last frame is timewarped by the VR compositor.
if (m.discardCount == 0) {
m.discardPredictedTracking = m.predictedTracking;
m.discardedFrameIndex = m.frameIndex;
}
m.discardCount++;
m.frameIndex = m.discardedFrameIndex;
m.predictedTracking = m.discardPredictedTracking;
} else {
m.discardCount = 0;
}

uint32_t layerCount = 0;
Expand Down

0 comments on commit 4254845

Please sign in to comment.