• Klaus Weidner's avatar
    VrShellGl: add ProcessWebVrFrame, refactor VSync logic · 18091af3
    Klaus Weidner authored
    The WebVR frame lifecycle transition from "animating" to "processing" was
    confusing due to use of deferred SubmitFrame. Add a new ProcessWebVrCall at
    the end of SubmitFrame that can be deferred if needed. A frame counts as
    "animating" until that executes.
    
    Refactor VSync logic. WebVrCanAnimateFrame checks if all necessary resources
    are available. All the places that provide resources call
    WebVrTryStartAnimatingFrame which runs SendVSyncNow if CanAnimateFrame returns
    true.
    
    Resources include pending_vsync_ and get_vsync_callback_ along with the
    ShouldSkipVSync heuristics and the ui_->CanSendWebVrVSync() check. It should be
    generally equivalent, but with reduced wait time if not VSync aligned since it
    now reschedules after webvr_deferred_start_processing_ becomes false instead of
    waiting for the next OnVSync.
    
    Change-Id: I32f920d3147b0032037b03f72b18df6cf7195751
    Reviewed-on: https://chromium-review.googlesource.com/985652
    Commit-Queue: Klaus Weidner <klausw@chromium.org>
    Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
    Reviewed-by: default avatarBill Orr <billorr@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#547821}
    18091af3
vr_shell_gl.h 14.1 KB