| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
OpenXR.Core10.DisplayTiming
Synopsis
- beginFrame :: forall io. MonadIO io => Session -> ("frameBeginInfo" ::: Maybe FrameBeginInfo) -> io Result
- useFrame :: forall a io r. (Extendss FrameEndInfo a, PokeChain a, MonadIO io) => Session -> Maybe FrameBeginInfo -> FrameEndInfo a -> (Result -> io r) -> io (Result, r)
- locateViews :: forall io. MonadIO io => Session -> ViewLocateInfo -> io (Result, ViewState, "views" ::: Vector View)
- endFrame :: forall a io. (Extendss FrameEndInfo a, PokeChain a, MonadIO io) => Session -> FrameEndInfo a -> io Result
- waitFrame :: forall a io. (Extendss FrameState a, PokeChain a, PeekChain a, MonadIO io) => Session -> ("frameWaitInfo" ::: Maybe FrameWaitInfo) -> io (Result, FrameState a)
- waitFrameSafe :: forall a io. (Extendss FrameState a, PokeChain a, PeekChain a, MonadIO io) => Session -> ("frameWaitInfo" ::: Maybe FrameWaitInfo) -> io (Result, FrameState a)
- data View = View {}
- data ViewLocateInfo = ViewLocateInfo {}
- data ViewState = ViewState {}
- data FrameBeginInfo = FrameBeginInfo {
- data FrameEndInfo (es :: [Type]) = FrameEndInfo {
- next :: Chain es
- displayTime :: Time
- environmentBlendMode :: EnvironmentBlendMode
- layerCount :: Word32
- layers :: Vector (SomeChild (CompositionLayerBaseHeader '[]))
- data FrameWaitInfo = FrameWaitInfo {
- data FrameState (es :: [Type]) = FrameState {}
Documentation
Arguments
| :: forall io. MonadIO io | |
| => Session |
|
| -> ("frameBeginInfo" ::: Maybe FrameBeginInfo) |
|
| -> io Result |
xrBeginFrame - Marks a frame
Parameter Descriptions
Description
beginFrame is called prior to the start of frame rendering. The
application should still call beginFrame but omit rendering work for
the frame if FrameState::shouldRender is
FALSE.
The runtime must return the error code
ERROR_CALL_ORDER_INVALID if there was no
corresponding successful call to waitFrame.
The runtime must return the success code
FRAME_DISCARDED if a prior beginFrame has
been called without an intervening call to endFrame.
The runtime must return
ERROR_SESSION_NOT_RUNNING if the session
is not running.
Valid Usage (Implicit)
-
sessionmust be a validSessionhandle
- If
frameBeginInfois notNULL,frameBeginInfomust be a pointer to a validFrameBeginInfostructure
Return Codes
See Also
useFrame :: forall a io r. (Extendss FrameEndInfo a, PokeChain a, MonadIO io) => Session -> Maybe FrameBeginInfo -> FrameEndInfo a -> (Result -> io r) -> io (Result, r) Source #
This function will call the supplied action between calls to
beginFrame and endFrame
Note that endFrame is *not* called if an exception is thrown by the
inner action.
locateViews :: forall io. MonadIO io => Session -> ViewLocateInfo -> io (Result, ViewState, "views" ::: Vector View) Source #
xrLocateViews - Gets view and projection info
Parameter Descriptions
sessionis a handle to the providedSession.
viewLocateInfois a pointer to a validViewLocateInfostructure.viewStateis the output structure with the viewer state information.viewCapacityInputis an input parameter which specifies the capacity of theviewsarray. The required capacity must be same as defined by the correspondingViewConfigurationType.viewCountOutputis an output parameter which identifies the valid count ofviews.viewsis an array ofView.- See
Buffer Size Parameters
chapter for a detailed description of retrieving the required
viewssize.
Description
The locateViews function returns the view and projection info for a
particular display time. This time is typically the target display time
for a given frame. Repeatedly calling locateViews with the same time
may not necessarily return the same result. Instead the prediction
gets increasingly accurate as the function is called closer to the given
time for which a prediction is made. This allows an application to get
the predicted views as late as possible in its pipeline to get the least
amount of latency and prediction error.
locateViews returns an array of View elements, one for each view of
the specified view configuration type, along with an ViewState
containing additional state data shared across all views. The eye each
view corresponds to is statically defined in
https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#view_configuration_type
in case the application wants to apply eye-specific rendering traits.
The ViewState and View member data may change on subsequent calls to
locateViews, and so applications must not assume it to be constant.
Valid Usage (Implicit)
-
sessionmust be a validSessionhandle
-
viewLocateInfomust be a pointer to a validViewLocateInfostructure -
viewStatemust be a pointer to anViewStatestructure -
viewCountOutputmust be a pointer to auint32_tvalue - If
viewCapacityInputis not0,viewsmust be a pointer to an array ofviewCapacityInputViewstructures
Return Codes
See Also
Arguments
| :: forall a io. (Extendss FrameEndInfo a, PokeChain a, MonadIO io) | |
| => Session |
|
| -> FrameEndInfo a |
|
| -> io Result |
xrEndFrame - Marks a frame
Parameter Descriptions
Description
endFrame may return immediately to the application.
FrameEndInfo::displayTime should be computed using values returned
by waitFrame. The runtime should be robust against variations in the
timing of calls to waitFrame, since a pipelined system may call
waitFrame on a separate thread from beginFrame and endFrame
without any synchronization guarantees.
Note
An accurate predicted display time is very important to avoid black pull-in by reprojection and to reduce motion judder in case the runtime does not implement a translational reprojection. Reprojection should never display images before the display refresh period they were predicted for, even if they are completed early, because this will cause motion judder just the same. In other words, the better the predicted display time, the less latency experienced by the user.
Every call to endFrame must be preceded by a successful call to
beginFrame. Failure to do so must result in
ERROR_CALL_ORDER_INVALID being returned by
endFrame. FrameEndInfo may reference swapchains into which the
application has rendered for this frame. From each
Swapchain only one image index is implicitly
referenced per frame, the one corresponding to the last call to
releaseSwapchainImage. However, a specific
swapchain (and by extension a specific swapchain image index) may be
referenced in FrameEndInfo multiple times. This can be used for
example to render a side by side image into a single swapchain image and
referencing it twice with differing image rectangles in different
layers.
If no layers are provided then the display must be cleared.
ERROR_LAYER_INVALID must be returned if
an unknown, unsupported layer type, or NULL pointer is passed as one
of the FrameEndInfo::layers.
ERROR_LAYER_INVALID must be returned if a
layer references a swapchain that has no released swapchain image.
ERROR_LAYER_LIMIT_EXCEEDED must be
returned if FrameEndInfo::layerCount exceeds
SystemGraphicsProperties::maxLayerCount or if the
runtime is unable to composite the specified layers due to resource
constraints.
ERROR_SWAPCHAIN_RECT_INVALID must be
returned if FrameEndInfo::layers contains a composition layer which
references pixels outside of the associated swapchain image or if
negatively sized.
ERROR_ENVIRONMENT_BLEND_MODE_UNSUPPORTED
must be returned if FrameEndInfo::environmentBlendMode is not
supported.
ERROR_SESSION_NOT_RUNNING must be
returned if the session
is not running.
Note
Applications should discard frames for which endFrame returns a
recoverable error over attempting to resubmit the frame with different
frame parameters to provide a more consistent experience across
different runtime implementations.
Return Codes
- Failure
ERROR_INSTANCE_LOSTERROR_SESSION_LOSTERROR_RUNTIME_FAILUREERROR_HANDLE_INVALIDERROR_CALL_ORDER_INVALIDERROR_LAYER_INVALIDERROR_SWAPCHAIN_RECT_INVALIDERROR_ENVIRONMENT_BLEND_MODE_UNSUPPORTEDERROR_SESSION_NOT_RUNNINGERROR_LAYER_LIMIT_EXCEEDEDERROR_VALIDATION_FAILUREERROR_TIME_INVALIDERROR_POSE_INVALID
See Also
Arguments
| :: forall a io. (Extendss FrameState a, PokeChain a, PeekChain a, MonadIO io) | |
| => Session |
|
| -> ("frameWaitInfo" ::: Maybe FrameWaitInfo) |
|
| -> io (Result, FrameState a) |
xrWaitFrame - Frame timing function
Parameter Descriptions
Description
waitFrame throttles the application frame loop in order to synchronize
application frame submissions with the display. waitFrame returns a
predicted display time for the next time that the runtime predicts a
composited frame will be displayed. The runtime may affect this
computation by changing the return values and throttling of waitFrame
in response to feedback from frame submission and completion times in
endFrame. An application must eventually match each waitFrame call
with one call to beginFrame. A subsequent waitFrame call must
block until the previous frame has been begun with beginFrame and
must unblock independently of the corresponding call to endFrame.
When less than one frame interval has passed since the previous return
from waitFrame, the runtime should block until the beginning of the
next frame interval. If more than one frame interval has passed since
the last return from waitFrame, the runtime may return immediately
or block until the beginning of the next frame interval.
In the case that an application has pipelined frame submissions, the application should compute the appropriate target display time using both the predicted display time and predicted display interval. The application should use the computed target display time when requesting space and view locations for rendering.
The FrameState::predictedDisplayTime returned by waitFrame must
be monotonically increasing.
The runtime may dynamically adjust the start time of the frame interval relative to the display hardware’s refresh cycle to minimize graphics processor contention between the application and the compositor.
waitFrame must be callable from any thread, including a different
thread than beginFrame/endFrame are being called from.
Calling waitFrame must be externally synchronized by the
application, concurrent calls may result in undefined behavior.
The runtime must return
ERROR_SESSION_NOT_RUNNING if the session
is not running.
Note
The engine simulation should advance based on the display time. Every
stage in the engine pipeline should use the exact same display time for
one particular application-generated frame. An accurate and consistent
display time across all stages and threads in the engine pipeline is
important to avoid object motion judder. If the application has multiple
pipeline stages, the application should pass its computed display time
through its pipeline, as waitFrame must be called only once per frame.
Valid Usage (Implicit)
-
sessionmust be a validSessionhandle
- If
frameWaitInfois notNULL,frameWaitInfomust be a pointer to a validFrameWaitInfostructure -
frameStatemust be a pointer to anFrameStatestructure
Thread Safety
- Access to the
sessionparameter by any otherwaitFramecall must be externally synchronized
Return Codes
See Also
Arguments
| :: forall a io. (Extendss FrameState a, PokeChain a, PeekChain a, MonadIO io) | |
| => Session |
|
| -> ("frameWaitInfo" ::: Maybe FrameWaitInfo) |
|
| -> io (Result, FrameState a) |
A variant of waitFrame which makes a *safe* FFI call
XrView - Struct containing view projection state
Member Descriptions
Description
The View structure contains view pose and projection state necessary
to render a single projection view in the view configuration.
Valid Usage (Implicit)
See Also
Fovf, Posef,
StructureType, ViewLocateInfo,
ViewState, locateViews
Constructors
| View | |
Instances
| Show View Source # | |
| Storable View Source # | |
Defined in OpenXR.Core10.DisplayTiming | |
| Zero View Source # | |
Defined in OpenXR.Core10.DisplayTiming | |
| ToCStruct View Source # | |
Defined in OpenXR.Core10.DisplayTiming | |
| FromCStruct View Source # | |
Defined in OpenXR.Core10.DisplayTiming | |
data ViewLocateInfo Source #
XrViewLocateInfo - Struct containing view locate information
Member Descriptions
Description
The ViewLocateInfo structure contains the display time and space used
to locate the view View structures.
The runtime must return error
ERROR_VIEW_CONFIGURATION_TYPE_UNSUPPORTED
if the given viewConfigurationType is not one of the supported type
reported by
enumerateViewConfigurations.
Valid Usage (Implicit)
See Also
Space,
StructureType,
https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrTime,
View,
ViewConfigurationType,
ViewState, locateViews
Constructors
| ViewLocateInfo | |
Fields
| |
Instances
XrViewState - Struct containing additional view state
Member Descriptions
Description
The ViewState contains additional view state from locateViews common
to all views of the active view configuration.
Valid Usage (Implicit)
See Also
Constructors
| ViewState | |
Fields
| |
Instances
| Eq ViewState Source # | |
| Show ViewState Source # | |
| Storable ViewState Source # | |
Defined in OpenXR.Core10.DisplayTiming | |
| Zero ViewState Source # | |
Defined in OpenXR.Core10.DisplayTiming | |
| ToCStruct ViewState Source # | |
Defined in OpenXR.Core10.DisplayTiming | |
| FromCStruct ViewState Source # | |
Defined in OpenXR.Core10.DisplayTiming | |
data FrameBeginInfo Source #
XrFrameBeginInfo - Begin frame information
Member Descriptions
Description
Because this structure only exists to support extension-specific
structures, beginFrame will accept a NULL argument for
frameBeginInfo for applications that are not using any relevant
extensions.
Valid Usage (Implicit)
See Also
Constructors
| FrameBeginInfo | |
Instances
data FrameEndInfo (es :: [Type]) Source #
XrFrameEndInfo - End frame information
Valid Usage (Implicit)
-
typemust beTYPE_FRAME_END_INFO
-
nextmust beNULLor a valid pointer to the next structure in a structure chain. See also:SecondaryViewConfigurationFrameEndInfoMSFT -
environmentBlendModemust be a validEnvironmentBlendModevalue - If
layerCountis not0,layersmust be a pointer to an array oflayerCountvalidCompositionLayerBaseHeader-based structures. See also:CompositionLayerCubeKHR,CompositionLayerCylinderKHR,CompositionLayerEquirect2KHR,CompositionLayerEquirectKHR,CompositionLayerProjection,CompositionLayerQuad
See Also
CompositionLayerBaseHeader,
EnvironmentBlendMode,
StructureType,
https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrTime,
endFrame
Constructors
| FrameEndInfo | |
Fields
| |
Instances
data FrameWaitInfo Source #
XrFrameWaitInfo - Wait frame information structure
Member Descriptions
Description
Because this structure only exists to support extension-specific
structures, waitFrame must accept a NULL argument for
frameWaitInfo for applications that are not using any relevant
extensions.
Valid Usage (Implicit)
See Also
Constructors
| FrameWaitInfo | |
Instances
data FrameState (es :: [Type]) Source #
XrFrameState - Frame prediction structure
Member Descriptions
Description
FrameState describes the time at which the next frame will be
displayed to the user. predictedDisplayTime must refer to the
midpoint of the interval during which the frame is displayed. The
runtime may report a different predictedDisplayPeriod from the
hardware’s refresh cycle.
For any frame where shouldRender is
FALSE, the application should avoid
heavy GPU work for that frame, for example by not rendering its layers.
This typically happens when the application is transitioning into or out
of a running session, or when some system UI is fully covering the
application at the moment. As long as the session
is running,
the application should keep running the frame loop to maintain the
frame synchronization to the runtime, even if this requires calling
endFrame with all layers omitted.
Valid Usage (Implicit)
See Also
https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrBool32,
https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrDuration,
FrameWaitInfo, StructureType,
https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrTime,
waitFrame
Constructors
| FrameState | |
Fields
| |