Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Unified Diff: chrome/browser/android/vr_shell/vr_shell.cc

Issue 2504843002: Prevent WebVR from reprojecting with invalid poses (Closed)
Patch Set: Addressed Klaus' feedback Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | device/vr/android/gvr/gvr_device.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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];
+ }
}
}
« no previous file with comments | « no previous file | device/vr/android/gvr/gvr_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698