| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/android/vr_shell/vr_shell_gl.h" | 5 #include "chrome/browser/android/vr_shell/vr_shell_gl.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| (...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1228 main_thread_task_runner_->PostTask( | 1228 main_thread_task_runner_->PostTask( |
| 1229 FROM_HERE, base::Bind(&VrShell::ForceExitVr, weak_vr_shell_)); | 1229 FROM_HERE, base::Bind(&VrShell::ForceExitVr, weak_vr_shell_)); |
| 1230 } | 1230 } |
| 1231 | 1231 |
| 1232 void VrShellGl::UpdateScene(std::unique_ptr<base::ListValue> commands) { | 1232 void VrShellGl::UpdateScene(std::unique_ptr<base::ListValue> commands) { |
| 1233 scene_->HandleCommands(std::move(commands), TimeInMicroseconds()); | 1233 scene_->HandleCommands(std::move(commands), TimeInMicroseconds()); |
| 1234 } | 1234 } |
| 1235 | 1235 |
| 1236 void VrShellGl::SendVSync(base::TimeDelta time, | 1236 void VrShellGl::SendVSync(base::TimeDelta time, |
| 1237 const GetVSyncCallback& callback) { | 1237 const GetVSyncCallback& callback) { |
| 1238 TRACE_EVENT0("input", "VrShellGl::SendVSync"); | 1238 uint8_t frame_index = frame_index_++; |
| 1239 | 1239 |
| 1240 uint8_t frame_index = frame_index_++; | 1240 TRACE_EVENT1("input", "VrShellGl::SendVSync", "frame", frame_index); |
| 1241 | 1241 |
| 1242 gvr::ClockTimePoint target_time = gvr::GvrApi::GetTimePointNow(); | 1242 gvr::ClockTimePoint target_time = gvr::GvrApi::GetTimePointNow(); |
| 1243 target_time.monotonic_system_time_nanos += kPredictionTimeWithoutVsyncNanos; | 1243 target_time.monotonic_system_time_nanos += kPredictionTimeWithoutVsyncNanos; |
| 1244 | 1244 |
| 1245 gvr::Mat4f head_mat = | 1245 gvr::Mat4f head_mat = |
| 1246 gvr_api_->GetHeadSpaceFromStartSpaceRotation(target_time); | 1246 gvr_api_->GetHeadSpaceFromStartSpaceRotation(target_time); |
| 1247 head_mat = gvr_api_->ApplyNeckModel(head_mat, 1.0f); | 1247 head_mat = gvr_api_->ApplyNeckModel(head_mat, 1.0f); |
| 1248 | 1248 |
| 1249 webvr_head_pose_[frame_index % kPoseRingBufferSize] = head_mat; | 1249 webvr_head_pose_[frame_index % kPoseRingBufferSize] = head_mat; |
| 1250 | 1250 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1266 // appropriate recommended render resolution as the default size during | 1266 // appropriate recommended render resolution as the default size during |
| 1267 // InitializeGl. Revisit if the initialization order changes. | 1267 // InitializeGl. Revisit if the initialization order changes. |
| 1268 device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo( | 1268 device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo( |
| 1269 gvr_api_.get(), webvr_surface_size_, device_id); | 1269 gvr_api_.get(), webvr_surface_size_, device_id); |
| 1270 main_thread_task_runner_->PostTask( | 1270 main_thread_task_runner_->PostTask( |
| 1271 FROM_HERE, | 1271 FROM_HERE, |
| 1272 base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info))); | 1272 base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info))); |
| 1273 } | 1273 } |
| 1274 | 1274 |
| 1275 } // namespace vr_shell | 1275 } // namespace vr_shell |
| OLD | NEW |