Index: chrome/browser/android/vr_shell/vr_shell.cc |
diff --git a/chrome/browser/android/vr_shell/vr_shell.cc b/chrome/browser/android/vr_shell/vr_shell.cc |
index 881af78ea80ad4fa08807c50d1e987647f6b70f0..9a3bc41fd84365fc5a47f83754c2d5da81fdd369 100644 |
--- a/chrome/browser/android/vr_shell/vr_shell.cc |
+++ b/chrome/browser/android/vr_shell/vr_shell.cc |
@@ -538,7 +538,16 @@ void VrShell::DrawFrame(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
// have working no-compositor rendering for WebVR. |
if (gvr_api_->GetAsyncReprojectionEnabled()) { |
uint32_t webvr_pose_frame = GetPixelEncodedPoseIndex(); |
- head_pose = webvr_head_pose_[webvr_pose_frame % kPoseRingBufferSize]; |
+ // If we don't get a valid frame ID back we shouldn't attempt to reproject |
+ // by an invalid matrix, so turn of reprojection instead. |
+ if (webvr_pose_frame == 0) { |
+ webvr_left_viewport_->SetReprojection(GVR_REPROJECTION_NONE); |
+ webvr_right_viewport_->SetReprojection(GVR_REPROJECTION_NONE); |
+ } else { |
+ webvr_left_viewport_->SetReprojection(GVR_REPROJECTION_FULL); |
+ webvr_right_viewport_->SetReprojection(GVR_REPROJECTION_FULL); |
+ head_pose = webvr_head_pose_[webvr_pose_frame % kPoseRingBufferSize]; |
+ } |
} |
} |