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

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

Issue 2804943003: [vr] Add a frame rate counter for the vr UI (Closed)
Patch Set: dcheck is on Created 3 years, 8 months 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 | « chrome/browser/android/vr_shell/vr_shell_gl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/vr_shell_gl.cc
diff --git a/chrome/browser/android/vr_shell/vr_shell_gl.cc b/chrome/browser/android/vr_shell/vr_shell_gl.cc
index 2f6ca1858794f98ba5b079eec8914441c31f2b4f..adf046b742cee88c8c420443f24a3c022f5555a9 100644
--- a/chrome/browser/android/vr_shell/vr_shell_gl.cc
+++ b/chrome/browser/android/vr_shell/vr_shell_gl.cc
@@ -13,6 +13,7 @@
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/threading/thread_task_runner_handle.h"
+#include "chrome/browser/android/vr_shell/fps_meter.h"
#include "chrome/browser/android/vr_shell/mailbox_to_surface_bridge.h"
#include "chrome/browser/android/vr_shell/ui_elements.h"
#include "chrome/browser/android/vr_shell/ui_interface.h"
@@ -147,6 +148,9 @@ VrShellGl::VrShellGl(
binding_(this),
weak_vr_shell_(weak_vr_shell),
main_thread_task_runner_(std::move(main_thread_task_runner)),
+#if DCHECK_IS_ON()
+ fps_meter_(new FPSMeter()),
+#endif
weak_ptr_factory_(this) {
GvrInit(gvr_api);
}
@@ -836,6 +840,13 @@ void VrShellGl::DrawFrame(int16_t frame_index) {
TRACE_EVENT0("gpu", "VrShellGl::SwapBuffers");
surface_->SwapBuffers();
}
+
+#if DCHECK_IS_ON()
+ // After saving the timestamp, fps will be available via GetFPS().
+ // TODO(vollick): enable rendering of this framerate in a HUD.
+ fps_meter_->AddFrame(current_time);
+ LOG(ERROR) << "fps: " << fps_meter_->GetFPS();
+#endif
}
void VrShellGl::DrawWorldElements(const gvr::Mat4f& head_pose) {
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell_gl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698