diff --git a/index.bs b/index.bs index 993dceb7..3643e4ca 100644 --- a/index.bs +++ b/index.bs @@ -990,6 +990,7 @@ When an {{XRSession}} |session| receives updated [=viewer=] state for timestamp 1. Let |now| be the [=current high resolution time=]. 1. Let |frame| be |session|'s [=XRSession/animation frame=]. 1. Set |frame|'s [=XRFrame/time=] to |frameTime|. + 1. Set |frame|'s [predictedDisplayTime] to the timestamp when the [=XR Compositor=] is expected to display content drawn during this [=XR animation frame=]. 1. For each |view| in [=XRSession/list of views=], set |view|'s [=view/viewport modifiable=] flag to true. 1. If the [=view/active=] flag of any [=view=] in the [=XRSession/list of views=] has changed since the last [=XR animation frame=], [=update the viewports=]. 1. If the frame [=should be rendered=] for |session|: @@ -1033,7 +1034,7 @@ window.requestAnimationFrame(onWindowAnimationFrame); function onXRAnimationFrame(time, xrFrame) { xrSession.requestAnimationFrame(onXRAnimationFrame); - renderFrame(time, xrFrame); + renderFrame(xrFrame.predictedDisplayTime, xrFrame); } function renderFrame(time, xrFrame) { @@ -1075,6 +1076,7 @@ An {{XRFrame}} represents a snapshot of the state of all of the tracked objects
[SecureContext, Exposed=Window] interface XRFrame { [SameObject] readonly attribute XRSession session; + readonly attribute DOMHighResTimeStamp predictedDisplayTime; XRViewerPose? getViewerPose(XRReferenceSpace referenceSpace); XRPose? getPose(XRSpace space, XRSpace baseSpace); @@ -1085,6 +1087,14 @@ Each {{XRFrame}} has an active boolean which is initial The session attribute returns the {{XRSession}} that produced the {{XRFrame}}. +The predictedDisplayTime attribute returns the {{DOMHighResTimeStamp}} that represents the point in time at which a rendered frame submitted for this {{XRFrame}} is expected to show up on the devices display. + ++The [=XRFrame/predictedDisplayTime=] is intended to allow rendering an animated XR scene in the state that it should be in when the frame is displayed rather than when the {{XRSession/requestAnimationFrame()}} callback was scheduled or when it was executed. + +The [=XRFrame/predictedDisplayTime=] is not intended be used to infer how much time the application has for rendering, as the [=XR Compositor=] typically has to do extra processing after the frame is submitted. If the experience assumes that it can process up to [=XRFrame/predictedDisplayTime=], the [=XR Compositor=] will not be able to make use of the submitted frames, and the application would not make target framerate. ++ Each {{XRFrame}} represents the state of all tracked objects for a given time, and either stores or is able to query concrete information about this state at the [=XRFrame/time=].