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 bce31e603bd51ab49567774335607577eb5454c1..14a22becd74bfc2730231dd912f501a23375bc54 100644 |
--- a/chrome/browser/android/vr_shell/vr_shell_gl.cc |
+++ b/chrome/browser/android/vr_shell/vr_shell_gl.cc |
@@ -425,15 +425,6 @@ void VrShellGl::OnWebVRFrameAvailable() { |
TRACE_EVENT1("gpu", "VrShellGl::OnWebVRFrameAvailable", "frame", frame_index); |
pending_frames_.pop(); |
- // It is legal for the WebVR client to submit a new frame now, since |
- // we've consumed the image. TODO(klausw): would timing be better if |
- // we move the "rendered" notification after draw, or suppress |
- // the next vsync until that's done? |
- |
- if (submit_client_) { |
- submit_client_->OnSubmitFrameRendered(); |
- } |
- |
DrawFrame(frame_index); |
} |
@@ -1074,6 +1065,14 @@ void VrShellGl::DrawFrame(int16_t frame_index) { |
surface_->SwapBuffers(); |
} |
+ // Report rendering completion to WebVR so that it's permitted to submit |
+ // a fresh frame. We could do this earlier, as soon as the frame got pulled |
+ // off the transfer surface, but that appears to result in overstuffed |
+ // buffers. |
+ if (submit_client_) { |
+ submit_client_->OnSubmitFrameRendered(); |
+ } |
+ |
#if DCHECK_IS_ON() |
// After saving the timestamp, fps will be available via GetFPS(). |
// TODO(vollick): enable rendering of this framerate in a HUD. |