HMD Management

ovrHmdDesc
Returns information about the current HMD.
unsigned int
Returns the number of attached trackers.
ovrTrackerDesc
ovr_GetTrackerDesc ( ovrSession session, unsigned int trackerDescIndex )
Returns a given attached tracker description.
ovrResult
ovr_Create ( ovrSession * pSession, ovrGraphicsLuid * pLuid )
Creates a handle to a VR session.
void
ovr_Destroy ( ovrSession session )
Destroys the session.
ovrResult
ovr_GetSessionStatus ( ovrSession session, ovrSessionStatus * sessionStatus )
Returns status information for the application.
ovrResult
ovr_IsExtensionSupported ( ovrSession session, ovrExtensions extension, ovrBool * outExtensionSupported )
Query extension support status.
ovrResult
Enable extension.

Tracking

ovrResult
Sets the tracking origin type.
ovrTrackingOrigin
Gets the tracking origin state.
ovrResult
Re-centers the sensor position and orientation.
ovrResult
Allows manually tweaking the sensor position and orientation.
void
Clears the ShouldRecenter status bit in ovrSessionStatus.
ovrTrackingState
ovr_GetTrackingState ( ovrSession session, double absTime, ovrBool latencyMarker )
Returns tracking state reading based on the specified absolute system time.
ovrResult
ovr_GetDevicePoses ( ovrSession session, ovrTrackedDeviceType * deviceTypes, int deviceCount, double absTime, ovrPoseStatef * outDevicePoses )
Returns an array of poses, where each pose matches a device type provided by the deviceTypes array parameter.
ovrTrackerPose
ovr_GetTrackerPose ( ovrSession session, unsigned int trackerPoseIndex )
Returns the ovrTrackerPose for the given attached tracker.
ovrResult
ovr_GetInputState ( ovrSession session, ovrControllerType controllerType, ovrInputState * inputState )
Returns the most recent input state for controllers, without positional tracking info.
unsigned int
Returns controller types connected to the system OR'ed together.
ovrTouchHapticsDesc
Gets information about Haptics engine for the specified Touch controller.
ovrResult
ovr_SetControllerVibration ( ovrSession session, ovrControllerType controllerType, float frequency, float amplitude )
Sets constant vibration (with specified frequency and amplitude) to a controller.
ovrResult
ovr_SubmitControllerVibration ( ovrSession session, ovrControllerType controllerType, const ovrHapticsBuffer * buffer )
Submits a Haptics buffer (used for vibration) to Touch (only) controllers.
ovrResult
Gets the Haptics engine playback state of a specific Touch controller.
ovrResult
ovr_TestBoundary ( ovrSession session, ovrTrackedDeviceType deviceBitmask, ovrBoundaryType boundaryType, ovrBoundaryTestResult * outTestResult )
Tests collision/proximity of position tracked devices (e.g.
ovrResult
ovr_TestBoundaryPoint ( ovrSession session, const ovrVector3f * point, ovrBoundaryType singleBoundaryType, ovrBoundaryTestResult * outTestResult )
Tests collision/proximity of a 3D point against the Boundary System.
ovrResult
Compatibility stub.
ovrResult
Resets the look and feel of the Boundary System to its default state.
ovrResult
ovr_GetBoundaryGeometry ( ovrSession session, ovrBoundaryType boundaryType, ovrVector3f * outFloorPoints, int * outFloorPointsCount )
Gets the geometry of the Boundary System's "play area" or "outer boundary" as 3D floor points.
ovrResult
ovr_GetBoundaryDimensions ( ovrSession session, ovrBoundaryType boundaryType, ovrVector3f * outDimensions )
Gets the dimension of the Boundary System's "play area" or "outer boundary".
ovrResult
ovr_GetBoundaryVisible ( ovrSession session, ovrBool * outIsVisible )
Returns if the boundary is currently visible.
ovrResult
Requests boundary to be visible.

Mixed reality capture support

ovrResult
ovr_GetExternalCameras ( ovrSession session, ovrExternalCamera * cameras, unsigned int * inoutCameraCount )
Returns the number of camera properties of all cameras.
ovrResult
ovr_SetExternalCameraProperties ( ovrSession session, const char * name, const ovrCameraIntrinsics *const intrinsics, const ovrCameraExtrinsics *const extrinsics )
Sets the camera intrinsics and/or extrinsics stored for the cameraName camera Names must be < 32 characters and null-terminated.

User Defined

enum
@0 {
}
Specifies the maximum number of layers supported by ovr_SubmitFrame.
enum
ovrLayerType {
}
Describes layer types that can be passed to ovr_SubmitFrame.
enum
ovrLayerFlags {
}
Identifies flags used by ovrLayerHeader and which are passed to ovr_SubmitFrame.
enum
ovrTextureLayout {
}
Describes eye texture layouts.

SDK Distortion Rendering

ovrResult
ovr_GetTextureSwapChainLength ( ovrSession session, ovrTextureSwapChain chain, int * out_Length )
TextureSwapChain creation is rendering API-specific.
ovrResult
ovr_GetTextureSwapChainCurrentIndex ( ovrSession session, ovrTextureSwapChain chain, int * out_Index )
Gets the current index in an ovrTextureSwapChain.
ovrResult
ovr_GetTextureSwapChainDesc ( ovrSession session, ovrTextureSwapChain chain, ovrTextureSwapChainDesc * out_Desc )
Gets the description of the buffers in an ovrTextureSwapChain.
ovrResult
ovr_CommitTextureSwapChain ( ovrSession session, ovrTextureSwapChain chain )
Commits any pending changes to an ovrTextureSwapChain, and advances its current index.
void
ovr_DestroyTextureSwapChain ( ovrSession session, ovrTextureSwapChain chain )
Destroys an ovrTextureSwapChain and frees all the resources associated with it.
void
ovr_DestroyMirrorTexture ( ovrSession session, ovrMirrorTexture mirrorTexture )
MirrorTexture creation is rendering API-specific.
ovrSizei
ovr_GetFovTextureSize ( ovrSession session, ovrEyeType eye, ovrFovPort fov, float pixelsPerDisplayPixel )
Calculates the recommended viewport size for rendering a given eye within the HMD with a given FOV cone.
ovrEyeRenderDesc
Computes the distortion viewport, view adjust, and other rendering parameters for the specified eye.
ovrResult
ovr_WaitToBeginFrame ( ovrSession session, long long frameIndex )
Waits until surfaces are available and it is time to begin rendering the frame.
ovrResult
ovr_BeginFrame ( ovrSession session, long long frameIndex )
Called from render thread before application begins rendering.
ovrResult
ovr_EndFrame ( ovrSession session, long long frameIndex, const ovrViewScaleDesc * viewScaleDesc, ovrLayerHeader const *const * layerPtrList, unsigned int layerCount )
Called from render thread after application has finished rendering.
ovrResult
ovr_SubmitFrame ( ovrSession session, long long frameIndex, const ovrViewScaleDesc * viewScaleDesc, ovrLayerHeader const *const * layerPtrList, unsigned int layerCount )
Submits layers for distortion and display.

Frame Timing

enum
@1 {
}
Maximum number of frames of performance stats provided back to the caller of ovr_GetPerfStats.
enum
ovrPerfHudMode {
}
Performance HUD enables the HMD user to see information critical to the real-time operation of the VR application such as latency timing, and CPU & GPU performance metrics.
enum
ovrLayerHudMode {
}
Layer HUD enables the HMD user to see information about a layer.
ovrResult
ovr_GetPerfStats ( ovrSession session, ovrPerfStats * outStats )
Retrieves performance stats for the VR app as well as the SDK compositor.
ovrResult
Resets the accumulated stats reported in each ovrPerfStatsPerCompositorFrame back to zero.
double
ovr_GetPredictedDisplayTime ( ovrSession session, long long frameIndex )
Gets the time of the specified frame midpoint.
double
Returns global, absolute high-resolution time in seconds.

Property Access

ovrBool
ovr_GetBool ( ovrSession session, const char * propertyName, ovrBool defaultVal )
Reads a boolean property.
ovrBool
ovr_SetBool ( ovrSession session, const char * propertyName, ovrBool value )
Writes or creates a boolean property.
int
ovr_GetInt ( ovrSession session, const char * propertyName, int defaultVal )
Reads an integer property.
ovrBool
ovr_SetInt ( ovrSession session, const char * propertyName, int value )
Writes or creates an integer property.
float
ovr_GetFloat ( ovrSession session, const char * propertyName, float defaultVal )
Reads a float property.
ovrBool
ovr_SetFloat ( ovrSession session, const char * propertyName, float value )
Writes or creates a float property.
unsigned int
ovr_GetFloatArray ( ovrSession session, const char * propertyName, float values, unsigned int valuesCapacity )
Reads a float array property.
ovrBool
ovr_SetFloatArray ( ovrSession session, const char * propertyName, const float values, unsigned int valuesSize )
Writes or creates a float array property.
const char *
ovr_GetString ( ovrSession session, const char * propertyName, const char * defaultVal )
Reads a string property.
ovrBool
ovr_SetString ( ovrSession session, const char * propertyName, const char * value )
Writes or creates a string property.

Macros

#define
OVR_OPENXR_SUPPORT_ENABLED
#define
OVR_OS_WIN32
#define
OVR_CDECL
LibOVR calling convention for 32-bit Windows builds.
#define
OVR_EXTERN_C
Defined as extern "C" when built from C++ code.
#define
OVR_CC_HAS_FEATURE
Provided for backward compatibility with older versions of this library.
#define
OVR_SA_UNUSED
#define
OVR_SA_PASTE
#define
OVR_SA_HELP
#define
OVR_STATIC_ASSERT
#define
OVR_STATIC_ASSERT_OFFSETOF
#define
OVR_STATIC_ASSERT_SIZEOF
#define
OVR_UNUSED_STRUCT_PAD
Defines explicitly unused space for a struct.
#define
OVR_PTR_SIZE
Specifies the size of a pointer on the given platform.
#define
OVR_ON32
#define
OVR_ON64
#define
ovrFalse
ovrBool value of false.
#define
ovrTrue
ovrBool value of true.
#define
VK_DEFINE_HANDLE
Fallback definitions for when the vulkan header isn't being included.
#define
VK_DEFINE_NON_DISPATCHABLE_HANDLE
#define
OVR_HAPTICS_BUFFER_SAMPLES_MAX
Maximum number of samples in ovrHapticsBuffer.
#define
OVR_MAX_EXTERNAL_CAMERA_COUNT
#define
OVR_EXTERNAL_CAMERA_NAME_SIZE

Enumerations

enum
ovrHmdType {
}
Enumerates all HMD types that we support.
enum
ovrHmdCaps {
}
HMD capability bits reported by device.
enum
ovrTrackingCaps {
}
Tracking capability bits reported by the device.
enum
ovrExtensions {
}
Optional extensions.
enum
ovrEyeType {
}
Specifies which eye is being used for rendering.
enum
ovrTrackingOrigin {
}
Specifies the coordinate system ovrTrackingState returns tracking poses in.
enum
ovrStatusBits {
}
Bit flags describing the current status of sensor tracking.
enum
ovrTrackerFlags {
}
Specifies sensor flags.
enum
ovrTextureType {
}
The type of texture resource.
enum
ovrTextureBindFlags {
}
The bindings required for texture swap chain.
enum
ovrTextureFormat {
ovrTextureFormat.OVR_FORMAT_UNKNOWN = 0, ovrTextureFormat.OVR_FORMAT_B5G6R5_UNORM = 1, ovrTextureFormat.OVR_FORMAT_B5G5R5A1_UNORM = 2, ovrTextureFormat.OVR_FORMAT_B4G4R4A4_UNORM = 3, ovrTextureFormat.OVR_FORMAT_R8G8B8A8_UNORM = 4, ovrTextureFormat.OVR_FORMAT_R8G8B8A8_UNORM_SRGB = 5, ovrTextureFormat.OVR_FORMAT_B8G8R8A8_UNORM = 6, ovrTextureFormat.OVR_FORMAT_B8G8R8_UNORM = 27, ovrTextureFormat.OVR_FORMAT_B8G8R8A8_UNORM_SRGB = 7, ovrTextureFormat.OVR_FORMAT_B8G8R8X8_UNORM = 8, ovrTextureFormat.OVR_FORMAT_B8G8R8X8_UNORM_SRGB = 9, ovrTextureFormat.OVR_FORMAT_R16G16B16A16_FLOAT = 10, ovrTextureFormat.OVR_FORMAT_R11G11B10_FLOAT = 25, ovrTextureFormat.OVR_FORMAT_D16_UNORM = 11, ovrTextureFormat.OVR_FORMAT_D24_UNORM_S8_UINT = 12, ovrTextureFormat.OVR_FORMAT_D32_FLOAT = 13, ovrTextureFormat.OVR_FORMAT_D32_FLOAT_S8X24_UINT = 14, ovrTextureFormat.OVR_FORMAT_BC1_UNORM = 15, ovrTextureFormat.OVR_FORMAT_BC1_UNORM_SRGB = 16, ovrTextureFormat.OVR_FORMAT_BC2_UNORM = 17, ovrTextureFormat.OVR_FORMAT_BC2_UNORM_SRGB = 18, ovrTextureFormat.OVR_FORMAT_BC3_UNORM = 19, ovrTextureFormat.OVR_FORMAT_BC3_UNORM_SRGB = 20, ovrTextureFormat.OVR_FORMAT_BC6H_UF16 = 21, ovrTextureFormat.OVR_FORMAT_BC6H_SF16 = 22, ovrTextureFormat.OVR_FORMAT_BC7_UNORM = 23, ovrTextureFormat.OVR_FORMAT_BC7_UNORM_SRGB = 24, ovrTextureFormat.OVR_FORMAT_LAST , ovrTextureFormat.OVR_FORMAT_ENUMSIZE = 0x7fffffff
}
The format of a texture.
enum
ovrTextureFlags {
}
Misc flags overriding particular behaviors of a texture swap chain.
enum
ovrMirrorOptions {
}
Bit flags used as part of ovrMirrorTextureDesc's MirrorOptions field.
enum
ovrFovStencilType {
}
Fov-stencil mesh for assisting in rendering efficiency for clients using EyeFov layers.
enum
ovrFovStencilFlags {
}
Identifies flags used by ovrFovStencilDesc and which are passed to ovr_GetFovStencil.
enum
ovrButton {
ovrButton.ovrButton_A = 0x00000001, ovrButton.ovrButton_B = 0x00000002, ovrButton.ovrButton_RThumb = 0x00000004, ovrButton.ovrButton_RShoulder = 0x00000008, ovrButton.ovrButton_X = 0x00000100, ovrButton.ovrButton_Y = 0x00000200, ovrButton.ovrButton_LThumb = 0x00000400, ovrButton.ovrButton_LShoulder = 0x00000800, ovrButton.ovrButton_Up = 0x00010000, ovrButton.ovrButton_Down = 0x00020000, ovrButton.ovrButton_Left = 0x00040000, ovrButton.ovrButton_Right = 0x00080000, ovrButton.ovrButton_Enter = 0x00100000, ovrButton.ovrButton_Back = 0x00200000, ovrButton.ovrButton_VolUp = 0x00400000, ovrButton.ovrButton_VolDown = 0x00800000, ovrButton.ovrButton_Home = 0x01000000, ovrButton.ovrButton_Private = ovrButton_VolUp | ovrButton_VolDown | ovrButton_Home, ovrButton.ovrButton_RMask = ovrButton_A | ovrButton_B | ovrButton_RThumb | ovrButton_RShoulder, ovrButton.ovrButton_LMask = ovrButton_X | ovrButton_Y | ovrButton_LThumb | ovrButton_LShoulder | ovrButton_Enter, ovrButton.ovrButton_EnumSize = 0x7fffffff
}
Describes button input types.
enum
ovrTouch {
ovrTouch.ovrTouch_A = ovrButton_A, ovrTouch.ovrTouch_B = ovrButton_B, ovrTouch.ovrTouch_RThumb = ovrButton_RThumb, ovrTouch.ovrTouch_RThumbRest = 0x00000008, ovrTouch.ovrTouch_RIndexTrigger = 0x00000010, ovrTouch.ovrTouch_RButtonMask = ovrTouch_A | ovrTouch_B | ovrTouch_RThumb | ovrTouch_RThumbRest | ovrTouch_RIndexTrigger, ovrTouch.ovrTouch_X = ovrButton_X, ovrTouch.ovrTouch_Y = ovrButton_Y, ovrTouch.ovrTouch_LThumb = ovrButton_LThumb, ovrTouch.ovrTouch_LThumbRest = 0x00000800, ovrTouch.ovrTouch_LIndexTrigger = 0x00001000, ovrTouch.ovrTouch_LButtonMask = ovrTouch_X | ovrTouch_Y | ovrTouch_LThumb | ovrTouch_LThumbRest | ovrTouch_LIndexTrigger, ovrTouch.ovrTouch_RIndexPointing = 0x00000020, ovrTouch.ovrTouch_RThumbUp = 0x00000040, ovrTouch.ovrTouch_LIndexPointing = 0x00002000, ovrTouch.ovrTouch_LThumbUp = 0x00004000, ovrTouch.ovrTouch_RPoseMask = ovrTouch_RIndexPointing | ovrTouch_RThumbUp, ovrTouch.ovrTouch_LPoseMask = ovrTouch_LIndexPointing | ovrTouch_LThumbUp, ovrTouch.ovrTouch_EnumSize = 0x7fffffff
}
Describes touch input types.
enum
ovrControllerType {
}
Specifies which controller is connected; multiple can be connected at once.
enum
ovrHapticsBufferSubmitMode {
}
Haptics buffer submit mode.
enum
ovrTrackedDeviceType {
}
Position tracked devices.
enum
ovrBoundaryType {
}
Boundary types that specified while using the boundary system.
enum
ovrHandType {
}
Provides names for the left and right hand array indexes.
enum
ovrCameraStatusFlags {
}
enum
ovrInitFlags {
}
Initialization flags.
enum
ovrLogLevel {
}
Logging levels.
enum
ovrDebugHudStereoMode {
}
Debug HUD is provided to help developers gauge and debug the fidelity of their app's stereo rendering characteristics.

Typedefs

char
ovrBool ( )
Boolean type.
struct ovrHmdStruct *
Used as an opaque pointer to an OVR session.
uint32_t
struct ovrTextureSwapChainData *
struct ovrMirrorTextureData *
void( *
Signature of the logging callback function pointer type.

Functions

ovrResult
ovr_GetFovStencil ( ovrSession session, const ovrFovStencilDesc * fovStencilDesc, ovrFovStencilMeshBuffer * meshBuffer )
Returns a viewport stencil mesh to be used for defining the area or outline the user can see through the lens on an area defined by a given ovrFovPort.
ovrResult
ovr_Initialize ( const ovrInitParams * params )
Initializes LibOVR.
void
Shuts down LibOVR.
void
Returns information about the most recent failed return value by the current thread for this library.
const char *
Returns the version string representing the LibOVRRT version.
int
ovr_TraceMessage ( int level, const char * message )
Writes a message string to the LibOVR tracing mechanism (if enabled).
ovrResult
ovr_IdentifyClient ( const char * identity )
Identify client application info.

Detailed Description

Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.

HMD Management Documentation

ovrHmdDesc ovr_GetHmdDesc ( ovrSession session )
Returns information about the current HMD.
ovr_Initialize must be called prior to calling this function, otherwise ovrHmdDesc::Type will be set to ovrHmd_None without checking for the HMD presence.
For newer headsets being used on a game built against an old SDK version, we may return the ovrHmdType as ovrHmd_CV1 for backwards compatibility.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create() or NULL.
Returns an ovrHmdDesc. If invoked with NULL session argument, ovrHmdDesc::Type set to ovrHmd_None indicates that the HMD is not connected.
unsigned int ovr_GetTrackerCount ( ovrSession session )
Returns the number of attached trackers.
The number of trackers may change at any time, so this function should be called before use as opposed to once on startup.
For newer headsets being used on a game built against an old SDK version, we may simulate three CV1 trackers to maintain backwards compatibility.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
Returns unsigned int count.
ovrTrackerDesc ovr_GetTrackerDesc ( ovrSession session, unsigned int trackerDescIndex )
Returns a given attached tracker description.
ovr_Initialize must have first been called in order for this to succeed, otherwise the returned trackerDescArray will be zero-initialized. The data returned by this function can change at runtime.
For newer headsets being used on a game built against an old SDK version, we may simulate three CV1 trackers to maintain backwards compatibility.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
trackerDescIndex
Specifies a tracker index. The valid indexes are in the range of 0 to the tracker count returned by ovr_GetTrackerCount.
Returns ovrTrackerDesc. An empty ovrTrackerDesc will be returned if trackerDescIndex is out of range.
ovrResult ovr_Create ( ovrSession * pSession, ovrGraphicsLuid * pLuid )
Creates a handle to a VR session.
Upon success the returned ovrSession must be eventually freed with ovr_Destroy when it is no longer needed. A second call to ovr_Create will result in an error return value if the previous session has not been destroyed.
Parameters
pSession
Provides a pointer to an ovrSession which will be written to upon success.
pLuid
Provides a system specific graphics adapter identifier that locates which graphics adapter has the HMD attached. This must match the adapter used by the application or no rendering output will be possible. This is important for stability on multi-adapter systems. An application that simply chooses the default adapter will not run reliably on multi-adapter systems.
Returns an ovrResult indicating success or failure. Upon failure the returned ovrSession will be NULL.
Example code
ovrSession session;
ovrGraphicsLuid luid;
ovrResult result = ovr_Create(&session, &luid);
if(OVR_FAILURE(result))
   ...
See Also:
void ovr_Destroy ( ovrSession session )
Destroys the session.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
See Also:
ovrResult ovr_GetSessionStatus ( ovrSession session, ovrSessionStatus * sessionStatus )
Returns status information for the application.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
sessionStatus
Provides an ovrSessionStatus that is filled in.
Returns an ovrResult indicating success or failure. In the case of failure, use ovr_GetLastErrorInfo to get more information. Return values include but aren't limited to:
  • ovrSuccess: Completed successfully.
  • ovrError_ServiceConnection: The service connection was lost and the application must destroy the session.
ovrResult ovr_IsExtensionSupported ( ovrSession session, ovrExtensions extension, ovrBool * outExtensionSupported )
Query extension support status.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
extension
Extension to query.
outExtensionSupported
Set to extension support status. ovrTrue if supported.
Returns an ovrResult indicating success or failure. In the case of failure use ovr_GetLastErrorInfo to get more information.
See Also:
ovrResult ovr_EnableExtension ( ovrSession session, ovrExtensions extension )
Enable extension.
Extensions must be enabled after ovr_Create is called.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
extension
Extension to enable.
Returns an ovrResult indicating success or failure. Extension is only enabled if successful. In the case of failure use ovr_GetLastErrorInfo to get more information.
See Also:

Tracking Documentation

ovrResult ovr_SetTrackingOriginType ( ovrSession session, ovrTrackingOrigin origin )
Sets the tracking origin type.
When the tracking origin is changed, all of the calls that either provide or accept ovrPosef will use the new tracking origin provided.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
origin
Specifies an ovrTrackingOrigin to be used for all ovrPosef
Returns an ovrResult indicating success or failure. In the case of failure, use ovr_GetLastErrorInfo to get more information.
ovrTrackingOrigin ovr_GetTrackingOriginType ( ovrSession session )
Gets the tracking origin state.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
Returns the ovrTrackingOrigin that was either set by default, or previous set by the application.
ovrResult ovr_RecenterTrackingOrigin ( ovrSession session )
Re-centers the sensor position and orientation.
This resets the (x,y,z) positional components and the yaw orientation component of the tracking space for the HMD and controllers using the HMD's current tracking pose. If the caller requires some tweaks on top of the HMD's current tracking pose, consider using ovr_SpecifyTrackingOrigin instead.
The roll and pitch orientation components are always determined by gravity and cannot be redefined. All future tracking will report values relative to this new reference position. If you are using ovrTrackerPoses then you will need to call ovr_GetTrackerPose after this, because the sensor position(s) will change as a result of this.
The headset cannot be facing vertically upward or downward but rather must be roughly level otherwise this function will fail with ovrError_InvalidHeadsetOrientation.
For more info, see the notes on each ovrTrackingOrigin enumeration to understand how recenter will vary slightly in its behavior based on the current ovrTrackingOrigin setting.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
Returns an ovrResult indicating success or failure. In the case of failure, use ovr_GetLastErrorInfo to get more information. Return values include but aren't limited to:
  • ovrSuccess: Completed successfully.
  • ovrError_InvalidHeadsetOrientation: The headset was facing an invalid direction when attempting recentering, such as facing vertically.
ovrResult ovr_SpecifyTrackingOrigin ( ovrSession session, ovrPosef originPose )
Allows manually tweaking the sensor position and orientation.
This function is similar to ovr_RecenterTrackingOrigin in that it modifies the (x,y,z) positional components and the yaw orientation component of the tracking space for the HMD and controllers.
While ovr_RecenterTrackingOrigin resets the tracking origin in reference to the HMD's current pose, ovr_SpecifyTrackingOrigin allows the caller to explicitly specify a transform for the tracking origin. This transform is expected to be an offset to the most recent recentered origin, so calling this function repeatedly with the same originPose will keep nudging the recentered origin in that direction.
There are several use cases for this function. For example, if the application decides to limit the yaw, or translation of the recentered pose instead of directly using the HMD pose the application can query the current tracking state via ovr_GetTrackingState, and apply some limitations to the HMD pose because feeding this pose back into this function. Similarly, this can be used to "adjust the seating position" incrementally in apps that feature seated experiences such as cockpit-based games.
This function can emulate ovr_RecenterTrackingOrigin as such: ovrTrackingState ts = ovr_GetTrackingState(session, 0.0, ovrFalse); ovr_SpecifyTrackingOrigin(session, ts.HeadPose.ThePose);
The roll and pitch orientation components are determined by gravity and cannot be redefined. If you are using ovrTrackerPoses then you will need to call ovr_GetTrackerPose after this, because the sensor position(s) will change as a result of this.
For more info, see the notes on each ovrTrackingOrigin enumeration to understand how recenter will vary slightly in its behavior based on the current ovrTrackingOrigin setting.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
originPose
Specifies a pose that will be used to transform the current tracking origin.
Returns an ovrResult indicating success or failure. In the case of failure, use ovr_GetLastErrorInfo to get more information. Return values include but aren't limited to:
  • ovrSuccess: Completed successfully.
  • ovrError_InvalidParameter: The heading direction in originPose was invalid, such as facing vertically. This can happen if the caller is directly feeding the pose of a position-tracked device such as an HMD or controller into this function.
void ovr_ClearShouldRecenterFlag ( ovrSession session )
Clears the ShouldRecenter status bit in ovrSessionStatus.
Clears the ShouldRecenter status bit in ovrSessionStatus, allowing further recenter requests to be detected. Since this is automatically done by ovr_RecenterTrackingOrigin and ovr_SpecifyTrackingOrigin, this function only needs to be called when application is doing its own re-centering logic.
ovrTrackingState ovr_GetTrackingState ( ovrSession session, double absTime, ovrBool latencyMarker )
Returns tracking state reading based on the specified absolute system time.
Pass an absTime value of 0.0 to request the most recent sensor reading. In this case both PredictedPose and SamplePose will have the same value.
This may also be used for more refined timing of front buffer rendering logic, and so on. This may be called by multiple threads.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
absTime
Specifies the absolute future time to predict the return ovrTrackingState value. Use 0 to request the most recent tracking state.
latencyMarker
Specifies that this call is the point in time where the "App-to-Mid-Photon" latency timer starts from. If a given ovrLayer provides "SensorSampleTime", that will override the value stored here.
Returns the ovrTrackingState that is predicted for the given absTime.
ovrResult ovr_GetDevicePoses ( ovrSession session, ovrTrackedDeviceType * deviceTypes, int deviceCount, double absTime, ovrPoseStatef * outDevicePoses )
Returns an array of poses, where each pose matches a device type provided by the deviceTypes array parameter.
If any pose cannot be retrieved, it will return a reason for the missing pose and the device pose will be zeroed out with a pose quaternion [x=0, y=0, z=0, w=1].
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
deviceTypes
Array of device types to query for their poses.
deviceCount
Number of queried poses. This number must match the length of the outDevicePoses and deviceTypes array.
absTime
Specifies the absolute future time to predict the return ovrTrackingState value. Use 0 to request the most recent tracking state.
outDevicePoses
Array of poses, one for each device type in deviceTypes arrays.
Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success.
ovrTrackerPose ovr_GetTrackerPose ( ovrSession session, unsigned int trackerPoseIndex )
Returns the ovrTrackerPose for the given attached tracker.
For newer headsets being used on a game built against an old SDK version, we may simulate three CV1 trackers to maintain backwards compatibility.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
trackerPoseIndex
Index of the tracker being requested.
Returns the requested ovrTrackerPose. An empty ovrTrackerPose will be returned if trackerPoseIndex is out of range.
ovrResult ovr_GetInputState ( ovrSession session, ovrControllerType controllerType, ovrInputState * inputState )
Returns the most recent input state for controllers, without positional tracking info.
Parameters
inputState
Input state that will be filled in.
controllerType
Specifies which controller the input will be returned for.
Returns ovrSuccess if the new state was successfully obtained.
unsigned int ovr_GetConnectedControllerTypes ( ovrSession session )
Returns controller types connected to the system OR'ed together.
A bitmask of ovrControllerTypes connected to the system.
ovrTouchHapticsDesc ovr_GetTouchHapticsDesc ( ovrSession session, ovrControllerType controllerType )
Gets information about Haptics engine for the specified Touch controller.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
controllerType
The controller to retrieve the information from.
Returns an ovrTouchHapticsDesc.
ovrResult ovr_SetControllerVibration ( ovrSession session, ovrControllerType controllerType, float frequency, float amplitude )
Sets constant vibration (with specified frequency and amplitude) to a controller.
Note: ovr_SetControllerVibration cannot be used interchangeably with ovr_SubmitControllerVibration.
This method should be called periodically, vibration lasts for a maximum of 2.5 seconds.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
controllerType
The controller to set the vibration to.
frequency
Vibration frequency. Supported values are: 0.0 (disabled), 0.5 and 1.0. Non valid values will be clamped.
amplitude
Vibration amplitude in the [0.0, 1.0] range.
Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to:
  • ovrSuccess: The call succeeded and a result was returned.
  • ovrSuccess_DeviceUnavailable: The call succeeded but the device referred to by controllerType is not available.
ovrResult ovr_SubmitControllerVibration ( ovrSession session, ovrControllerType controllerType, const ovrHapticsBuffer * buffer )
Submits a Haptics buffer (used for vibration) to Touch (only) controllers.
Note: ovr_SubmitControllerVibration cannot be used interchangeably with ovr_SetControllerVibration.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
controllerType
Controller where the Haptics buffer will be played.
buffer
Haptics buffer containing amplitude samples to be played.
Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to:
  • ovrSuccess: The call succeeded and a result was returned.
  • ovrSuccess_DeviceUnavailable: The call succeeded but the device referred to by controllerType is not available.
ovrResult ovr_GetControllerVibrationState ( ovrSession session, ovrControllerType controllerType, ovrHapticsPlaybackState * outState )
Gets the Haptics engine playback state of a specific Touch controller.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
controllerType
Controller where the Haptics buffer wil be played.
outState
State of the haptics engine.
Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to:
  • ovrSuccess: The call succeeded and a result was returned.
  • ovrSuccess_DeviceUnavailable: The call succeeded but the device referred to by controllerType is not available.
ovrResult ovr_TestBoundary ( ovrSession session, ovrTrackedDeviceType deviceBitmask, ovrBoundaryType boundaryType, ovrBoundaryTestResult * outTestResult )
Tests collision/proximity of position tracked devices (e.g.
HMD and/or Touch) against the Boundary System. Note: this method is similar to ovr_BoundaryTestPoint but can be more precise as it may take into account device acceleration/momentum.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
deviceBitmask
Bitmask of one or more tracked devices to test.
boundaryType
Must be either ovrBoundary_Outer or ovrBoundary_PlayArea.
outTestResult
Result of collision/proximity test, contains information such as distance and closest point.
Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to:
  • ovrSuccess: The call succeeded and a result was returned.
  • ovrSuccess_BoundaryInvalid: The call succeeded but the result is not a valid boundary due to not being set up.
  • ovrSuccess_DeviceUnavailable: The call succeeded but the device referred to by deviceBitmask is not available.
ovrResult ovr_TestBoundaryPoint ( ovrSession session, const ovrVector3f * point, ovrBoundaryType singleBoundaryType, ovrBoundaryTestResult * outTestResult )
Tests collision/proximity of a 3D point against the Boundary System.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
point
3D point to test.
singleBoundaryType
Must be either ovrBoundary_Outer or ovrBoundary_PlayArea to test against
outTestResult
Result of collision/proximity test, contains information such as distance and closest point.
Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to:
  • ovrSuccess: The call succeeded and a result was returned.
  • ovrSuccess_BoundaryInvalid: The call succeeded but the result is not a valid boundary due to not being set up.
ovrResult ovr_SetBoundaryLookAndFeel ( ovrSession session, const ovrBoundaryLookAndFeel * lookAndFeel )
Compatibility stub.
Deprecated
Previously set the look and feel of the Boundary System - this functionality has been removed.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
lookAndFeel
Look and feel parameters.
Returns ovrSuccess upon success.
ovrResult ovr_ResetBoundaryLookAndFeel ( ovrSession session )
Resets the look and feel of the Boundary System to its default state.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
Returns ovrSuccess upon success.
ovrResult ovr_GetBoundaryGeometry ( ovrSession session, ovrBoundaryType boundaryType, ovrVector3f * outFloorPoints, int * outFloorPointsCount )
Gets the geometry of the Boundary System's "play area" or "outer boundary" as 3D floor points.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
boundaryType
Must be either ovrBoundary_Outer or ovrBoundary_PlayArea.
outFloorPoints
Array of 3D points (in clockwise order) defining the boundary at floor height (can be NULL to retrieve only the number of points).
outFloorPointsCount
Number of 3D points returned in the array.
Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to:
  • ovrSuccess: The call succeeded and a result was returned.
  • ovrSuccess_BoundaryInvalid: The call succeeded but the result is not a valid boundary due to not being set up.
ovrResult ovr_GetBoundaryDimensions ( ovrSession session, ovrBoundaryType boundaryType, ovrVector3f * outDimensions )
Gets the dimension of the Boundary System's "play area" or "outer boundary".
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
boundaryType
Must be either ovrBoundary_Outer or ovrBoundary_PlayArea.
outDimensions
Dimensions of the axis aligned bounding box that encloses the area in meters (width, height and length).
Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to:
  • ovrSuccess: The call succeeded and a result was returned.
  • ovrSuccess_BoundaryInvalid: The call succeeded but the result is not a valid boundary due to not being set up.
ovrResult ovr_GetBoundaryVisible ( ovrSession session, ovrBool * outIsVisible )
Returns if the boundary is currently visible.
Note: visibility is false if the user has turned off boundaries, otherwise, it's true if the app has requested boundaries to be visible or if any tracked device is currently triggering it. This may not exactly match rendering due to fade-in and fade-out effects.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
outIsVisible
ovrTrue, if the boundary is visible.
Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to:
  • ovrSuccess: Result was successful and a result was returned.
  • ovrSuccess_BoundaryInvalid: The call succeeded but the result is not a valid boundary due to not being set up.
ovrResult ovr_RequestBoundaryVisible ( ovrSession session, ovrBool visible )
Requests boundary to be visible.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
visible
forces the outer boundary to be visible. An application can't force it to be invisible, but can cancel its request by passing false.
Returns ovrSuccess upon success.

Mixed reality capture support Documentation

ovrResult ovr_GetExternalCameras ( ovrSession session, ovrExternalCamera * cameras, unsigned int * inoutCameraCount )
Returns the number of camera properties of all cameras.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
cameras
Pointer to the array. If null and the provided array capacity is sufficient, will return ovrError_NullArrayPointer.
inoutCameraCount
Supply the array capacity, will return the actual # of cameras defined. If *inoutCameraCount is too small, will return ovrError_InsufficientArraySize.
Returns the list of external cameras the system knows about. Returns ovrError_NoExternalCameraInfo if there is not any eternal camera information.
ovrResult ovr_SetExternalCameraProperties ( ovrSession session, const char * name, const ovrCameraIntrinsics *const intrinsics, const ovrCameraExtrinsics *const extrinsics )
Sets the camera intrinsics and/or extrinsics stored for the cameraName camera Names must be < 32 characters and null-terminated.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
name
Specifies which camera to set the intrinsics or extrinsics for. The name must be at most OVR_EXTERNAL_CAMERA_NAME_SIZE - 1 characters. Otherwise, ovrError_ExternalCameraNameWrongSize is returned.
intrinsics
Contains the intrinsic parameters to set, can be null
extrinsics
Contains the extrinsic parameters to set, can be null
Returns ovrSuccess or an ovrError code

User Defined Documentation

enum OVR_CAPI.h.@0
Specifies the maximum number of layers supported by ovr_SubmitFrame.
Enumerator
ovrMaxLayerCount= 16
enum OVR_CAPI.h.ovrLayerType
Describes layer types that can be passed to ovr_SubmitFrame.
Enumerator
ovrLayerType_Disabled
Layer is disabled.
ovrLayerType_EyeFov
Described by ovrLayerEyeFov.
ovrLayerType_EyeFovDepth
Described by ovrLayerEyeFovDepth.
ovrLayerType_Quad
Described by ovrLayerQuad. Previously called ovrLayerType_QuadInWorld.
ovrLayerType_EyeMatrix
Described by ovrLayerEyeMatrix.
ovrLayerType_EyeFovMultires
Described by ovrLayerEyeFovMultires.
ovrLayerType_Cylinder
Described by ovrLayerCylinder.
ovrLayerType_Cube
Described by ovrLayerCube.
ovrLayerType_EnumSize
Force type int32_t.
enum OVR_CAPI.h.ovrLayerFlags
Identifies flags used by ovrLayerHeader and which are passed to ovr_SubmitFrame.
Enumerator
ovrLayerFlag_HighQuality
ovrLayerFlag_HighQuality enables 4x anisotropic sampling during the composition of the layer.
ovrLayerFlag_TextureOriginAtBottomLeft
ovrLayerFlag_TextureOriginAtBottomLeft: the opposite is TopLeft.
ovrLayerFlag_HeadLocked
Mark this surface as "headlocked", which means it is specified relative to the HMD and moves with it, rather than being specified relative to sensor/torso space and remaining still while the head moves.
ovrLayerFlags_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrTextureLayout
Describes eye texture layouts.
Enumerator
ovrTextureLayout_Rectilinear
Regular eyeFov layer.
ovrTextureLayout_Octilinear
Octilinear extension must be enabled.
ovrTextureLayout_EnumSize= 0x7fffffff

SDK Distortion Rendering Documentation

ovrResult ovr_GetTextureSwapChainLength ( ovrSession session, ovrTextureSwapChain chain, int * out_Length )
TextureSwapChain creation is rendering API-specific.
ovr_CreateTextureSwapChainDX and ovr_CreateTextureSwapChainGL can be found in the rendering API-specific headers, such as OVR_CAPI_D3D.h and OVR_CAPI_GL.h Gets the number of buffers in an ovrTextureSwapChain.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
chain
Specifies the ovrTextureSwapChain for which the length should be retrieved.
out_Length
Returns the number of buffers in the specified chain.
Returns an ovrResult for which OVR_SUCCESS(result) is false upon error.
ovrResult ovr_GetTextureSwapChainCurrentIndex ( ovrSession session, ovrTextureSwapChain chain, int * out_Index )
Gets the current index in an ovrTextureSwapChain.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
chain
Specifies the ovrTextureSwapChain for which the index should be retrieved.
out_Index
Returns the current (free) index in specified chain.
Returns an ovrResult for which OVR_SUCCESS(result) is false upon error.
ovrResult ovr_GetTextureSwapChainDesc ( ovrSession session, ovrTextureSwapChain chain, ovrTextureSwapChainDesc * out_Desc )
Gets the description of the buffers in an ovrTextureSwapChain.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
chain
Specifies the ovrTextureSwapChain for which the description should be retrieved.
out_Desc
Returns the description of the specified chain.
Returns an ovrResult for which OVR_SUCCESS(result) is false upon error.
ovrResult ovr_CommitTextureSwapChain ( ovrSession session, ovrTextureSwapChain chain )
Commits any pending changes to an ovrTextureSwapChain, and advances its current index.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
chain
Specifies the ovrTextureSwapChain to commit.
Note:
When Commit is called, the texture at the current index is considered ready for use by the runtime, and further writes to it should be avoided. The swap chain's current index is advanced, providing there's room in the chain. The next time the SDK dereferences this texture swap chain, it will synchronize with the app's graphics context and pick up the submitted index, opening up room in the swap chain for further commits.
Returns an ovrResult for which OVR_SUCCESS(result) is false upon error. Failures include but aren't limited to:
  • ovrError_TextureSwapChainFull: ovr_CommitTextureSwapChain was called too many times on a texture swapchain without calling submit to use the chain.
void ovr_DestroyTextureSwapChain ( ovrSession session, ovrTextureSwapChain chain )
Destroys an ovrTextureSwapChain and frees all the resources associated with it.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
chain
Specifies the ovrTextureSwapChain to destroy. If it is NULL then this function has no effect.
void ovr_DestroyMirrorTexture ( ovrSession session, ovrMirrorTexture mirrorTexture )
MirrorTexture creation is rendering API-specific.
ovr_CreateMirrorTextureWithOptionsDX and ovr_CreateMirrorTextureWithOptionsGL can be found in rendering API-specific headers, such as OVR_CAPI_D3D.h and OVR_CAPI_GL.h Destroys a mirror texture previously created by one of the mirror texture creation functions.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
mirrorTexture
Specifies the ovrTexture to destroy. If it is NULL then this function has no effect.
ovrSizei ovr_GetFovTextureSize ( ovrSession session, ovrEyeType eye, ovrFovPort fov, float pixelsPerDisplayPixel )
Calculates the recommended viewport size for rendering a given eye within the HMD with a given FOV cone.
Higher FOV will generally require larger textures to maintain quality. Apps packing multiple eye views together on the same texture should ensure there are at least 8 pixels of padding between them to prevent texture filtering and chromatic aberration causing images to leak between the two eye views.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
eye
Specifies which eye (left or right) to calculate for.
fov
Specifies the ovrFovPort to use.
pixelsPerDisplayPixel
Specifies the ratio of the number of render target pixels to display pixels at the center of distortion. 1.0 is the default value. Lower values can improve performance, higher values give improved quality.
Example code
ovrHmdDesc hmdDesc = ovr_GetHmdDesc(session);
ovrSizei eyeSizeLeft  = ovr_GetFovTextureSize(session, ovrEye_Left,
hmdDesc.DefaultEyeFov[ovrEye_Left],  1.0f);
ovrSizei eyeSizeRight = ovr_GetFovTextureSize(session, ovrEye_Right,
hmdDesc.DefaultEyeFov[ovrEye_Right], 1.0f);
Returns the texture width and height size.
ovrEyeRenderDesc ovr_GetRenderDesc ( ovrSession session, ovrEyeType eyeType, ovrFovPort fov )
Computes the distortion viewport, view adjust, and other rendering parameters for the specified eye.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
eyeType
Specifies which eye (left or right) for which to perform calculations.
fov
Specifies the ovrFovPort to use.
Returns the computed ovrEyeRenderDesc for the given eyeType and field of view.
ovrResult ovr_WaitToBeginFrame ( ovrSession session, long long frameIndex )
Waits until surfaces are available and it is time to begin rendering the frame.
Must be called before ovr_BeginFrame, but not necessarily from the same thread.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
frameIndex
Specifies the targeted application frame index.
Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to:
  • ovrSuccess: command completed successfully.
  • ovrSuccess_NotVisible: rendering of a previous frame completed successfully but was not displayed on the HMD, usually because another application currently has ownership of the HMD. Applications receiving this result should stop rendering new content and call ovr_GetSessionStatus to detect visibility.
  • ovrError_DisplayLost: The session has become invalid (such as due to a device removal) and the shared resources need to be released (ovr_DestroyTextureSwapChain), the session needs to destroyed (ovr_Destroy) and recreated (ovr_Create), and new resources need to be created (ovr_CreateTextureSwapChainXXX). The application's existing private graphics resources do not need to be recreated unless the new ovr_Create call returns a different GraphicsLuid.
ovrResult ovr_BeginFrame ( ovrSession session, long long frameIndex )
Called from render thread before application begins rendering.
Must be called after ovr_WaitToBeginFrame and before ovr_EndFrame, but not necessarily from the same threads.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
frameIndex
Specifies the targeted application frame index. It must match what was passed to ovr_WaitToBeginFrame.
Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to:
  • ovrSuccess: command completed successfully.
  • ovrError_DisplayLost: The session has become invalid (such as due to a device removal) and the shared resources need to be released (ovr_DestroyTextureSwapChain), the session needs to destroyed (ovr_Destroy) and recreated (ovr_Create), and new resources need to be created (ovr_CreateTextureSwapChainXXX). The application's existing private graphics resources do not need to be recreated unless the new ovr_Create call returns a different GraphicsLuid.
ovrResult ovr_EndFrame ( ovrSession session, long long frameIndex, const ovrViewScaleDesc * viewScaleDesc, ovrLayerHeader const *const * layerPtrList, unsigned int layerCount )
Called from render thread after application has finished rendering.
Must be called after ovr_BeginFrame, but not necessarily from the same thread. Submits layers for distortion and display, which will happen asynchronously.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
frameIndex
Specifies the targeted application frame index. It must match what was passed to ovr_BeginFrame.
viewScaleDesc
Provides additional information needed only if layerPtrList contains an ovrLayerType_Quad. If NULL, a default version is used based on the current configuration and a 1.0 world scale.
layerPtrList
Specifies a list of ovrLayer pointers, which can include NULL entries to indicate that any previously shown layer at that index is to not be displayed. Each layer header must be a part of a layer structure such as ovrLayerEyeFov or ovrLayerQuad, with Header.Type identifying its type. A NULL layerPtrList entry in the array indicates the absence of the given layer.
layerCount
Indicates the number of valid elements in layerPtrList. The maximum supported layerCount is not currently specified, but may be specified in a future version.
  • Layers are drawn in the order they are specified in the array, regardless of the layer type.
  • Layers are not remembered between successive calls to ovr_SubmitFrame. A layer must be specified in every call to ovr_SubmitFrame or it won't be displayed.
  • If a layerPtrList entry that was specified in a previous call to ovr_SubmitFrame is passed as NULL or is of type ovrLayerType_Disabled, that layer is no longer displayed.
  • A layerPtrList entry can be of any layer type and multiple entries of the same layer type are allowed. No layerPtrList entry may be duplicated (i.e. the same pointer as an earlier entry).
Example code
ovrLayerEyeFov  layer0;
ovrLayerQuad    layer1;
  ...
ovrLayerHeader* layers[2] = { &layer0.Header, &layer1.Header };
ovrResult result = ovr_EndFrame(session, frameIndex, nullptr, layers, 2);
Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to:
  • ovrSuccess: rendering completed successfully.
  • ovrError_DisplayLost: The session has become invalid (such as due to a device removal) and the shared resources need to be released (ovr_DestroyTextureSwapChain), the session needs to destroyed (ovr_Destroy) and recreated (ovr_Create), and new resources need to be created (ovr_CreateTextureSwapChainXXX). The application's existing private graphics resources do not need to be recreated unless the new ovr_Create call returns a different GraphicsLuid.
  • ovrError_TextureSwapChainInvalid: The ovrTextureSwapChain is in an incomplete or inconsistent state. Ensure ovr_CommitTextureSwapChain was called at least once first.
ovrResult ovr_SubmitFrame ( ovrSession session, long long frameIndex, const ovrViewScaleDesc * viewScaleDesc, ovrLayerHeader const *const * layerPtrList, unsigned int layerCount )
Submits layers for distortion and display.
Deprecated
Use ovr_WaitToBeginFrame, ovr_BeginFrame, and ovr_EndFrame instead.
ovr_SubmitFrame triggers distortion and processing which might happen asynchronously. The function will return when there is room in the submission queue and surfaces are available. Distortion might or might not have completed.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
frameIndex
Specifies the targeted application frame index, or 0 to refer to one frame after the last time ovr_SubmitFrame was called.
viewScaleDesc
Provides additional information needed only if layerPtrList contains an ovrLayerType_Quad. If NULL, a default version is used based on the current configuration and a 1.0 world scale.
layerPtrList
Specifies a list of ovrLayer pointers, which can include NULL entries to indicate that any previously shown layer at that index is to not be displayed. Each layer header must be a part of a layer structure such as ovrLayerEyeFov or ovrLayerQuad, with Header.Type identifying its type. A NULL layerPtrList entry in the array indicates the absence of the given layer.
layerCount
Indicates the number of valid elements in layerPtrList. The maximum supported layerCount is not currently specified, but may be specified in a future version.
  • Layers are drawn in the order they are specified in the array, regardless of the layer type.
  • Layers are not remembered between successive calls to ovr_SubmitFrame. A layer must be specified in every call to ovr_SubmitFrame or it won't be displayed.
  • If a layerPtrList entry that was specified in a previous call to ovr_SubmitFrame is passed as NULL or is of type ovrLayerType_Disabled, that layer is no longer displayed.
  • A layerPtrList entry can be of any layer type and multiple entries of the same layer type are allowed. No layerPtrList entry may be duplicated (i.e. the same pointer as an earlier entry).
Example code
ovrLayerEyeFov  layer0;
ovrLayerQuad    layer1;
  ...
ovrLayerHeader* layers[2] = { &layer0.Header, &layer1.Header };
ovrResult result = ovr_SubmitFrame(session, frameIndex, nullptr, layers, 2);
Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to:
  • ovrSuccess: rendering completed successfully.
  • ovrSuccess_NotVisible: rendering completed successfully but was not displayed on the HMD, usually because another application currently has ownership of the HMD. Applications receiving this result should stop rendering new content, call ovr_GetSessionStatus to detect visibility.
  • ovrError_DisplayLost: The session has become invalid (such as due to a device removal) and the shared resources need to be released (ovr_DestroyTextureSwapChain), the session needs to destroyed (ovr_Destroy) and recreated (ovr_Create), and new resources need to be created (ovr_CreateTextureSwapChainXXX). The application's existing private graphics resources do not need to be recreated unless the new ovr_Create call returns a different GraphicsLuid.
  • ovrError_TextureSwapChainInvalid: The ovrTextureSwapChain is in an incomplete or inconsistent state. Ensure ovr_CommitTextureSwapChain was called at least once first.

Frame Timing Documentation

enum OVR_CAPI.h.@1
Maximum number of frames of performance stats provided back to the caller of ovr_GetPerfStats.
Enumerator
ovrMaxProvidedFrameStats= 5
enum OVR_CAPI.h.ovrPerfHudMode
Performance HUD enables the HMD user to see information critical to the real-time operation of the VR application such as latency timing, and CPU & GPU performance metrics.
Enumerator
ovrPerfHud_Off
Turns off the performance HUD.
ovrPerfHud_PerfSummary
Shows performance summary and headroom.
ovrPerfHud_LatencyTiming
Shows latency related timing info.
ovrPerfHud_AppRenderTiming
Shows render timing info for application.
ovrPerfHud_CompRenderTiming
Shows render timing info for OVR compositor.
ovrPerfHud_AswStats
Shows Async Spacewarp-specific info.
ovrPerfHud_VersionInfo
Shows SDK & HMD version Info.
ovrPerfHud_Count= 7
ovrPerfHud_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrLayerHudMode
Layer HUD enables the HMD user to see information about a layer.
Enumerator
ovrLayerHud_Off
Turns off the layer HUD.
ovrLayerHud_Info
Shows info about a specific layer.
ovrLayerHud_EnumSize= 0x7fffffff
ovrResult ovr_GetPerfStats ( ovrSession session, ovrPerfStats * outStats )
Retrieves performance stats for the VR app as well as the SDK compositor.
This function will return stats for the VR app that is currently visible in the HMD regardless of what VR app is actually calling this function.
If the VR app is trying to make sure the stats returned belong to the same application, the caller can compare the VisibleProcessId with their own process ID. Normally this will be the case if the caller is only calling ovr_GetPerfStats when ovr_GetSessionStatus has IsVisible flag set to be true.
If the VR app calling ovr_GetPerfStats is actually the one visible in the HMD, then new perf stats will only be populated after a new call to ovr_SubmitFrame. That means subsequent calls to ovr_GetPerfStats after the first one without calling ovr_SubmitFrame will receive a FrameStatsCount of zero.
If the VR app is not visible, or was initially marked as ovrInit_Invisible, then each call to ovr_GetPerfStats will immediately fetch new perf stats from the compositor without a need for the ovr_SubmitFrame call.
Even though invisible VR apps do not require ovr_SubmitFrame to be called to gather new perf stats, since stats are generated at the native refresh rate of the HMD (i.e. 90 Hz for CV1), calling it at a higher rate than that would be unnecessary.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
outStats
Contains the performance stats for the application and SDK compositor
Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success.
ovrResult ovr_ResetPerfStats ( ovrSession session )
Resets the accumulated stats reported in each ovrPerfStatsPerCompositorFrame back to zero.
Only the integer values such as HmdVsyncIndex, AppDroppedFrameCount etc. will be reset as the other fields such as AppMotionToPhotonLatency are independent timing values updated per-frame.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success.
double ovr_GetPredictedDisplayTime ( ovrSession session, long long frameIndex )
Gets the time of the specified frame midpoint.
Predicts the time at which the given frame will be displayed. The predicted time is the middle of the time period during which the corresponding eye images will be displayed.
The application should increment frameIndex for each successively targeted frame, and pass that index to any relevant OVR functions that need to apply to the frame identified by that index.
This function is thread-safe and allows for multiple application threads to target their processing to the same displayed frame.
In the even that prediction fails due to various reasons (e.g. the display being off or app has yet to present any frames), the return value will be current CPU time.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
frameIndex
Identifies the frame the caller wishes to target. A value of zero returns the next frame index.
Returns the absolute frame midpoint time for the given frameIndex.
double ovr_GetTimeInSeconds ( )
Returns global, absolute high-resolution time in seconds.
The time frame of reference for this function is not specified and should not be depended upon.
Returns seconds as a floating point value.
See Also:
ovrPoseStatef, ovrFrameTiming

Property Access Documentation

ovrBool ovr_GetBool ( ovrSession session, const char * propertyName, ovrBool defaultVal )
Reads a boolean property.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
propertyName
The name of the property, which needs to be valid for only the call.
defaultVal
specifes the value to return if the property couldn't be read.
Returns the property interpreted as a boolean value. Returns defaultVal if the property doesn't exist.
ovrBool ovr_SetBool ( ovrSession session, const char * propertyName, ovrBool value )
Writes or creates a boolean property.
If the property wasn't previously a boolean property, it is changed to a boolean property.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
propertyName
The name of the property, which needs to be valid only for the call.
value
The value to write.
Returns true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
int ovr_GetInt ( ovrSession session, const char * propertyName, int defaultVal )
Reads an integer property.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
propertyName
The name of the property, which needs to be valid only for the call.
defaultVal
Specifes the value to return if the property couldn't be read.
Returns the property interpreted as an integer value. Returns defaultVal if the property doesn't exist.
ovrBool ovr_SetInt ( ovrSession session, const char * propertyName, int value )
Writes or creates an integer property.
If the property wasn't previously a boolean property, it is changed to an integer property.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
propertyName
The name of the property, which needs to be valid only for the call.
value
The value to write.
Returns true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
float ovr_GetFloat ( ovrSession session, const char * propertyName, float defaultVal )
Reads a float property.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
propertyName
The name of the property, which needs to be valid only for the call.
defaultVal
specifes the value to return if the property couldn't be read.
Returns the property interpreted as an float value. Returns defaultVal if the property doesn't exist.
ovrBool ovr_SetFloat ( ovrSession session, const char * propertyName, float value )
Writes or creates a float property.
If the property wasn't previously a float property, it's changed to a float property.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
propertyName
The name of the property, which needs to be valid only for the call.
value
The value to write.
Returns true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
unsigned int ovr_GetFloatArray ( ovrSession session, const char * propertyName, float values, unsigned int valuesCapacity )
Reads a float array property.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
propertyName
The name of the property, which needs to be valid only for the call.
values
An array of float to write to.
valuesCapacity
Specifies the maximum number of elements to write to the values array.
Returns the number of elements read, or 0 if property doesn't exist or is empty.
ovrBool ovr_SetFloatArray ( ovrSession session, const char * propertyName, const float values, unsigned int valuesSize )
Writes or creates a float array property.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
propertyName
The name of the property, which needs to be valid only for the call.
values
An array of float to write from.
valuesSize
Specifies the number of elements to write.
Returns true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
const char* ovr_GetString ( ovrSession session, const char * propertyName, const char * defaultVal )
Reads a string property.
Strings are UTF8-encoded and null-terminated.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
propertyName
The name of the property, which needs to be valid only for the call.
defaultVal
Specifes the value to return if the property couldn't be read.
Returns the string property if it exists. Otherwise returns defaultVal, which can be specified as NULL. The return memory is guaranteed to be valid until next call to ovr_GetString or until the session is destroyed, whichever occurs first.
ovrBool ovr_SetString ( ovrSession session, const char * propertyName, const char * value )
Writes or creates a string property.
Strings are UTF8-encoded and null-terminated.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
propertyName
The name of the property, which needs to be valid only for the call.
value
The string property, which only needs to be valid for the duration of the call.
Returns true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.

Macros Documentation

#define OVR_OPENXR_SUPPORT_ENABLED
#define OVR_OS_WIN32
#define OVR_CDECL
LibOVR calling convention for 32-bit Windows builds.
#define OVR_EXTERN_C
Defined as extern "C" when built from C++ code.
#define OVR_CC_HAS_FEATURE
Provided for backward compatibility with older versions of this library.
#define OVR_SA_UNUSED
#define OVR_SA_PASTE
#define OVR_SA_HELP
#define OVR_STATIC_ASSERT
#define OVR_STATIC_ASSERT_OFFSETOF
#define OVR_STATIC_ASSERT_SIZEOF
#define OVR_UNUSED_STRUCT_PAD
Defines explicitly unused space for a struct.
When used correcly, usage of this macro should not change the size of the struct. Compile-time and runtime behavior with and without this defined should be identical.
#define OVR_PTR_SIZE
Specifies the size of a pointer on the given platform.
#define OVR_ON32
#define OVR_ON64
#define ovrFalse
ovrBool value of false.
#define ovrTrue
ovrBool value of true.
#define VK_DEFINE_HANDLE
Fallback definitions for when the vulkan header isn't being included.
#define VK_DEFINE_NON_DISPATCHABLE_HANDLE
#define OVR_HAPTICS_BUFFER_SAMPLES_MAX
Maximum number of samples in ovrHapticsBuffer.
#define OVR_MAX_EXTERNAL_CAMERA_COUNT
#define OVR_EXTERNAL_CAMERA_NAME_SIZE

Enumeration Type Documentation

enum OVR_CAPI.h.ovrHmdType
Enumerates all HMD types that we support.
Enumerator
ovrHmd_None= 0
ovrHmd_DK1= 3
ovrHmd_DKHD= 4
ovrHmd_DK2= 6
ovrHmd_CB= 8
ovrHmd_Other= 9
ovrHmd_E3_2015= 10
ovrHmd_ES06= 11
ovrHmd_ES09= 12
ovrHmd_ES11= 13
ovrHmd_CV1= 14
ovrHmd_RiftS= 16
ovrHmd_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrHmdCaps
HMD capability bits reported by device.
Enumerator
ovrHmdCap_DebugDevice
(read only) Specifies that the HMD is a virtual debug device.
ovrHmdCap_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrTrackingCaps
Tracking capability bits reported by the device.
Enumerator
ovrTrackingCap_Orientation
Supports orientation tracking (IMU).
ovrTrackingCap_MagYawCorrection
Supports yaw drift correction.
ovrTrackingCap_Position
Supports positional tracking.
ovrTrackingCap_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrExtensions
Optional extensions.
Enumerator
ovrExtension_TextureLayout_Octilinear
Enable before first layer submission.
ovrExtension_Count
ovrExtension_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrEyeType
Specifies which eye is being used for rendering.
Enumerator
ovrEye_Left
The left eye, from the viewer's perspective.
ovrEye_Right
The right eye, from the viewer's perspective.
ovrEye_Count= 2
ovrEye_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrTrackingOrigin
Specifies the coordinate system ovrTrackingState returns tracking poses in.
Enumerator
ovrTrackingOrigin_EyeLevel
Tracking system origin reported at eye (HMD) height.
ovrTrackingOrigin_FloorLevel
Tracking system origin reported at floor height.
ovrTrackingOrigin_Count= 2
ovrTrackingOrigin_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrStatusBits
Bit flags describing the current status of sensor tracking.
Enumerator
ovrStatus_OrientationTracked= 0x0001
ovrStatus_PositionTracked= 0x0002
ovrStatus_OrientationValid= 0x0004
ovrStatus_PositionValid= 0x0008
enum OVR_CAPI.h.ovrTrackerFlags
Specifies sensor flags.
Enumerator
ovrTracker_Connected
The sensor is present, else the sensor is absent or offline.
ovrTracker_PoseTracked
The sensor has a valid pose, else the pose is unavailable.
enum OVR_CAPI.h.ovrTextureType
The type of texture resource.
Enumerator
ovrTexture_2D
2D textures.
ovrTexture_2D_External
Application-provided 2D texture. Not supported on PC.
ovrTexture_Cube
Cube maps. ovrTextureSwapChainDesc::ArraySize must be 6 for this type.
ovrTexture_Count
ovrTexture_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrTextureBindFlags
The bindings required for texture swap chain.
Enumerator
ovrTextureBind_None
ovrTextureBind_DX_RenderTarget
The application can write into the chain with pixel shader.
ovrTextureBind_DX_UnorderedAccess
The application can write to the chain with compute shader.
ovrTextureBind_DX_DepthStencil
The chain buffers can be bound as depth and/or stencil buffers.
ovrTextureBind_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrTextureFormat
The format of a texture.
Enumerator
OVR_FORMAT_UNKNOWN= 0
OVR_FORMAT_B5G6R5_UNORM
Not currently supported on PC. Requires a DirectX 11.1 device.
OVR_FORMAT_B5G5R5A1_UNORM
Not currently supported on PC. Requires a DirectX 11.1 device.
OVR_FORMAT_B4G4R4A4_UNORM
Not currently supported on PC. Requires a DirectX 11.1 device.
OVR_FORMAT_R8G8B8A8_UNORM= 4
OVR_FORMAT_R8G8B8A8_UNORM_SRGB= 5
OVR_FORMAT_B8G8R8A8_UNORM= 6
OVR_FORMAT_B8G8R8_UNORM= 27
OVR_FORMAT_B8G8R8A8_UNORM_SRGB
Not supported for OpenGL applications.
OVR_FORMAT_B8G8R8X8_UNORM
Not supported for OpenGL applications.
OVR_FORMAT_B8G8R8X8_UNORM_SRGB
Not supported for OpenGL applications.
OVR_FORMAT_R16G16B16A16_FLOAT= 10
OVR_FORMAT_R11G11B10_FLOAT
Not supported for D3D12 applications. Introduced in v1.10.
OVR_FORMAT_D16_UNORM= 11
OVR_FORMAT_D24_UNORM_S8_UINT= 12
OVR_FORMAT_D32_FLOAT= 13
OVR_FORMAT_D32_FLOAT_S8X24_UINT= 14
OVR_FORMAT_BC1_UNORM= 15
OVR_FORMAT_BC1_UNORM_SRGB= 16
OVR_FORMAT_BC2_UNORM= 17
OVR_FORMAT_BC2_UNORM_SRGB= 18
OVR_FORMAT_BC3_UNORM= 19
OVR_FORMAT_BC3_UNORM_SRGB= 20
OVR_FORMAT_BC6H_UF16= 21
OVR_FORMAT_BC6H_SF16= 22
OVR_FORMAT_BC7_UNORM= 23
OVR_FORMAT_BC7_UNORM_SRGB= 24
OVR_FORMAT_LAST
OVR_FORMAT_ENUMSIZE= 0x7fffffff
enum OVR_CAPI.h.ovrTextureFlags
Misc flags overriding particular behaviors of a texture swap chain.
Enumerator
ovrTextureMisc_None
ovrTextureMisc_DX_Typeless
Vulkan and DX only: The underlying texture is created with a TYPELESS equivalent of the format specified in the texture desc.
ovrTextureMisc_AllowGenerateMips
DX only: Allow generation of the mip chain on the GPU via the GenerateMips call.
ovrTextureMisc_ProtectedContent
Texture swap chain contains protected content, and requires HDCP connection in order to display to HMD.
ovrTextureMisc_AutoGenerateMips
Automatically generate and use the mip chain in composition on each submission.
ovrTextureMisc_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrMirrorOptions
Bit flags used as part of ovrMirrorTextureDesc's MirrorOptions field.
Enumerator
ovrMirrorOption_Default
By default the mirror texture will be:
ovrMirrorOption_PostDistortion
Retrieves the barrel distorted texture contents instead of the rectilinear one This is only recommended for debugging purposes, and not for final desktop presentation.
ovrMirrorOption_LeftEyeOnly
Since ovrMirrorOption_Default renders both eyes into the mirror texture, these two flags are exclusive (i.e.
ovrMirrorOption_RightEyeOnly= 0x0004
ovrMirrorOption_IncludeGuardian
Shows the boundary system aka Guardian on the mirror texture.
ovrMirrorOption_IncludeNotifications
Shows system notifications the user receives on the mirror texture.
ovrMirrorOption_IncludeSystemGui
Shows the system menu (triggered by hitting the Home button) on the mirror texture.
ovrMirrorOption_ForceSymmetricFov
Forces mirror output to use max symmetric FOV instead of asymmetric full FOV used by HMD.
ovrMirrorOption_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrFovStencilType
Fov-stencil mesh for assisting in rendering efficiency for clients using EyeFov layers.
Enumerator
ovrFovStencil_HiddenArea
Triangle list covering parts that are hidden to users.
ovrFovStencil_VisibleArea
Triangle list covering parts that are visible to users.
ovrFovStencil_BorderLine
Line list that draws the boundary visible to users.
ovrFovStencil_VisibleRectangle
Axis-aligned rectangle fit in visible region 4x vertices: TopLeft, TopRight, BottomRight, BottomLeft.
ovrFovStencilType_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrFovStencilFlags
Identifies flags used by ovrFovStencilDesc and which are passed to ovr_GetFovStencil.
Enumerator
ovrFovStencilFlag_MeshOriginAtBottomLeft
When used, flips the Y component of the provided 2D mesh coordinates, such that Y increases upwards.
ovrFovStencilFlag_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrButton
Describes button input types.
Enumerator
ovrButton_A
A button on XBox controllers and right Touch controller. Not present on Oculus Remote.
ovrButton_B
B button on XBox controllers and right Touch controller. Not present on Oculus Remote.
ovrButton_RThumb
Right thumbstick on XBox controllers and Touch controllers. Not present on Oculus Remote.
ovrButton_RShoulder
Right shoulder button on XBox controllers. Not present on Touch controllers or Oculus Remote.
ovrButton_X
X button on XBox controllers and left Touch controller. Not present on Oculus Remote.
ovrButton_Y
Y button on XBox controllers and left Touch controller. Not present on Oculus Remote.
ovrButton_LThumb
Left thumbstick on XBox controllers and Touch controllers. Not present on Oculus Remote.
ovrButton_LShoulder
Left shoulder button on XBox controllers. Not present on Touch controllers or Oculus Remote.
ovrButton_Up
Up button on XBox controllers and Oculus Remote. Not present on Touch controllers.
ovrButton_Down
Down button on XBox controllers and Oculus Remote. Not present on Touch controllers.
ovrButton_Left
Left button on XBox controllers and Oculus Remote. Not present on Touch controllers.
ovrButton_Right
Right button on XBox controllers and Oculus Remote. Not present on Touch controllers.
ovrButton_Enter
Start on XBox 360 controller.
ovrButton_Back
Back on Xbox 360 controller and Oculus Remote.
ovrButton_VolUp
Volume button on Oculus Remote. Not present on XBox or Touch controllers.
ovrButton_VolDown
Volume button on Oculus Remote. Not present on XBox or Touch controllers.
ovrButton_Home
Home button on XBox controllers. Oculus button on Touch controllers and Oculus Remote.
ovrButton_Private= ovrButton_VolUp | ovrButton_VolDown | ovrButton_Home
ovrButton_RMask= ovrButton_A | ovrButton_B | ovrButton_RThumb | ovrButton_RShoulder
ovrButton_LMask= ovrButton_X | ovrButton_Y | ovrButton_LThumb | ovrButton_LShoulder | ovrButton_Enter
ovrButton_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrTouch
Describes touch input types.
Enumerator
ovrTouch_A= ovrButton_A
ovrTouch_B= ovrButton_B
ovrTouch_RThumb= ovrButton_RThumb
ovrTouch_RThumbRest= 0x00000008
ovrTouch_RIndexTrigger= 0x00000010
ovrTouch_RButtonMask= ovrTouch_A | ovrTouch_B | ovrTouch_RThumb | ovrTouch_RThumbRest | ovrTouch_RIndexTrigger
ovrTouch_X= ovrButton_X
ovrTouch_Y= ovrButton_Y
ovrTouch_LThumb= ovrButton_LThumb
ovrTouch_LThumbRest= 0x00000800
ovrTouch_LIndexTrigger= 0x00001000
ovrTouch_LButtonMask= ovrTouch_X | ovrTouch_Y | ovrTouch_LThumb | ovrTouch_LThumbRest | ovrTouch_LIndexTrigger
ovrTouch_RIndexPointing= 0x00000020
ovrTouch_RThumbUp= 0x00000040
ovrTouch_LIndexPointing= 0x00002000
ovrTouch_LThumbUp= 0x00004000
ovrTouch_RPoseMask= ovrTouch_RIndexPointing | ovrTouch_RThumbUp
ovrTouch_LPoseMask= ovrTouch_LIndexPointing | ovrTouch_LThumbUp
ovrTouch_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrControllerType
Specifies which controller is connected; multiple can be connected at once.
Enumerator
ovrControllerType_None= 0x0000
ovrControllerType_LTouch= 0x0001
ovrControllerType_RTouch= 0x0002
ovrControllerType_Touch= (ovrControllerType_LTouch | ovrControllerType_RTouch)
ovrControllerType_Remote= 0x0004
ovrControllerType_XBox= 0x0010
ovrControllerType_Object0= 0x0100
ovrControllerType_Object1= 0x0200
ovrControllerType_Object2= 0x0400
ovrControllerType_Object3= 0x0800
ovrControllerType_Active
Operate on or query whichever controller is active.
ovrControllerType_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrHapticsBufferSubmitMode
Haptics buffer submit mode.
Enumerator
ovrHapticsBufferSubmit_Enqueue
Enqueue buffer for later playback.
enum OVR_CAPI.h.ovrTrackedDeviceType
Position tracked devices.
Enumerator
ovrTrackedDevice_None= 0x0000
ovrTrackedDevice_HMD= 0x0001
ovrTrackedDevice_LTouch= 0x0002
ovrTrackedDevice_RTouch= 0x0004
ovrTrackedDevice_Touch= (ovrTrackedDevice_LTouch | ovrTrackedDevice_RTouch)
ovrTrackedDevice_Object0= 0x0010
ovrTrackedDevice_Object1= 0x0020
ovrTrackedDevice_Object2= 0x0040
ovrTrackedDevice_Object3= 0x0080
ovrTrackedDevice_All= 0xFFFF
enum OVR_CAPI.h.ovrBoundaryType
Boundary types that specified while using the boundary system.
Enumerator
ovrBoundary_Outer
Outer boundary - closely represents user setup walls.
ovrBoundary_PlayArea
Play area - safe rectangular area inside outer boundary which can optionally be used to restrict user interactions and motion.
enum OVR_CAPI.h.ovrHandType
Provides names for the left and right hand array indexes.
Enumerator
ovrHand_Left= 0
ovrHand_Right= 1
ovrHand_Count= 2
ovrHand_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrCameraStatusFlags
Enumerator
ovrCameraStatus_None
Initial state of camera.
ovrCameraStatus_Connected
Bit set when the camera is connected to the system.
ovrCameraStatus_Calibrating
Bit set when the camera is undergoing calibration.
ovrCameraStatus_CalibrationFailed
Bit set when the camera has tried & failed calibration.
ovrCameraStatus_Calibrated
Bit set when the camera has tried & passed calibration.
ovrCameraStatus_Capturing
Bit set when the camera is capturing.
ovrCameraStatus_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrInitFlags
Initialization flags.
Enumerator
ovrInit_Debug
When a debug library is requested, a slower debugging version of the library will run which can be used to help solve problems in the library and debug application code.
ovrInit_RequestVersion
When a version is requested, the LibOVR runtime respects the RequestedMinorVersion field and verifies that the RequestedMinorVersion is supported.
ovrInit_Invisible
This client will not be visible in the HMD.
ovrInit_MixedRendering
This client will alternate between VR and 2D rendering.
ovrInit_FocusAware
This client is aware of ovrSessionStatus focus states (e.g.
ovrinit_WritableBits
These bits are writable by user code.
ovrInit_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrLogLevel
Logging levels.
Enumerator
ovrLogLevel_Debug
Debug-level log event.
ovrLogLevel_Info
Info-level log event.
ovrLogLevel_Error
Error-level log event.
ovrLogLevel_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrDebugHudStereoMode
Debug HUD is provided to help developers gauge and debug the fidelity of their app's stereo rendering characteristics.
Enumerator
ovrDebugHudStereo_Off
Turns off the Stereo Debug HUD.
ovrDebugHudStereo_Quad
Renders Quad in world for Stereo Debugging.
ovrDebugHudStereo_QuadWithCrosshair
Renders Quad+crosshair in world for Stereo Debugging.
ovrDebugHudStereo_CrosshairAtInfinity
Renders screen-space crosshair at infinity for Stereo Debugging.
ovrDebugHudStereo_Count
ovrDebugHudStereo_EnumSize= 0x7fffffff

Typedef Documentation

typedef char ovrBool ( )
Boolean type.
typedef struct ovrHmdStruct* ovrSession ( )
Used as an opaque pointer to an OVR session.
typedef uint32_t ovrProcessId ( )
typedef struct ovrTextureSwapChainData* ovrTextureSwapChain ( )
typedef struct ovrMirrorTextureData* ovrMirrorTexture ( )
typedef void(OVR_CDECL* ovrLogCallback) (uintptr_t userData, int level, const char *message) ( )
Signature of the logging callback function pointer type.
Parameters
userData
is an arbitrary value specified by the user of ovrInitParams.
level
is one of the ovrLogLevel constants.
message
is a UTF8-encoded null-terminated string.

Function Documentation

ovrResult ovr_GetFovStencil ( ovrSession session, const ovrFovStencilDesc * fovStencilDesc, ovrFovStencilMeshBuffer * meshBuffer )
Returns a viewport stencil mesh to be used for defining the area or outline the user can see through the lens on an area defined by a given ovrFovPort.
Parameters
session
Specifies an ovrSession previously returned by ovr_Create.
fovStencilDesc
Info provided by caller necessary to generate a stencil mesh.
meshBuffer
Mesh buffer to be partially filled in and returned by the SDK.
Returns an ovrResult indicating success or failure. In the case of failure, use ovr_GetLastErrorInfo to get more information. Return values include but aren't limited to:
  • ovrSuccess: Completed successfully.
  • ovrError_ServiceConnection: The service connection was lost and the application must destroy the session.
  • ovrError_InvalidParameter: One or more of the parameters
To find out how big the vertex and index buffers in meshBuffer buffer should be, first call this function setting AllocVertexCount & AllocIndexCount to 0 while also sending in nullptr for VertexBuffer & IndexBuffer. The SDK will populate UsedVertexCount & UsedIndexCount values.
If Alloc*Count fields in meshBuffer are smaller than the expected Used*Count fields, (except when they are 0) then the SDK will return ovrError_InvalidParameter and leave VertexBuffer and IndexBuffer untouched.
2D positions provided in the buffer will be in the [0,1] range where Y increases downward, similar to texture-UV space. If Y coordinates need to be flipped upside down, use the ovrFovStencilFlag_MeshOriginAtBottomLeft.
ovrResult ovr_Initialize ( const ovrInitParams * params )
Initializes LibOVR.
Initialize LibOVR for application usage. This includes finding and loading the LibOVRRT shared library. No LibOVR API functions, other than ovr_GetLastErrorInfo and ovr_Detect, can be called unless ovr_Initialize succeeds. A successful call to ovr_Initialize must be eventually followed by a call to ovr_Shutdown. ovr_Initialize calls are idempotent. Calling ovr_Initialize twice does not require two matching calls to ovr_Shutdown. If already initialized, the return value is ovr_Success.
LibOVRRT shared library search order:
  1. Current working directory (often the same as the application directory).
  2. Module directory (usually the same as the application directory, but not if the module is a separate shared library).
  3. Application directory
  4. Development directory (only if OVR_ENABLE_DEVELOPER_SEARCH is enabled, which is off by default).
  5. Standard OS shared library search location(s) (OS-specific).
Parameters
params
Specifies custom initialization options. May be NULL to indicate default options when using the CAPI shim. If you are directly calling the LibOVRRT version of ovr_Initialize in the LibOVRRT DLL then this must be valid and include ovrInit_RequestVersion.
Returns an ovrResult indicating success or failure. In the case of failure, use ovr_GetLastErrorInfo to get more information. Example failed results include:
  • ovrError_Initialize: Generic initialization error.
  • ovrError_LibLoad: Couldn't load LibOVRRT.
  • ovrError_LibVersion: LibOVRRT version incompatibility.
  • ovrError_ServiceConnection: Couldn't connect to the OVR Service.
  • ovrError_ServiceVersion: OVR Service version incompatibility.
  • ovrError_IncompatibleOS: The operating system version is incompatible.
  • ovrError_DisplayInit: Unable to initialize the HMD display.
  • ovrError_ServerStart: Unable to start the server. Is it already running?
  • ovrError_Reinitialization: Attempted to re-initialize with a different version.
Example code
ovrInitParams initParams = { ovrInit_RequestVersion, OVR_MINOR_VERSION, NULL, 0, 0 };
ovrResult result = ovr_Initialize(&initParams);
if(OVR_FAILURE(result)) {
    ovrErrorInfo errorInfo;
    ovr_GetLastErrorInfo(&errorInfo);
    DebugLog("ovr_Initialize failed: %s", errorInfo.ErrorString);
returnfalse;
}
[...]
See Also:
void ovr_Shutdown ( )
Shuts down LibOVR.
A successful call to ovr_Initialize must be eventually matched by a call to ovr_Shutdown. After calling ovr_Shutdown, no LibOVR functions can be called except ovr_GetLastErrorInfo or another ovr_Initialize. ovr_Shutdown invalidates all pointers, references, and created objects previously returned by LibOVR functions. The LibOVRRT shared library can be unloaded by ovr_Shutdown.
See Also:
void ovr_GetLastErrorInfo ( ovrErrorInfo * errorInfo )
Returns information about the most recent failed return value by the current thread for this library.
This function itself can never generate an error. The last error is never cleared by LibOVR, but will be overwritten by new errors. Do not use this call to determine if there was an error in the last API call as successful API calls don't clear the last ovrErrorInfo. To avoid any inconsistency, ovr_GetLastErrorInfo should be called immediately after an API function that returned a failed ovrResult, with no other API functions called in the interim.
Parameters
errorInfo
The last ovrErrorInfo for the current thread.
See Also:
const char* ovr_GetVersionString ( )
Returns the version string representing the LibOVRRT version.
The returned string pointer is valid until the next call to ovr_Shutdown.
Note that the returned version string doesn't necessarily match the current OVR_MAJOR_VERSION, etc., as the returned string refers to the LibOVRRT shared library version and not the locally compiled interface version.
The format of this string is subject to change in future versions and its contents should not be interpreted.
Returns a UTF8-encoded null-terminated version string.
int ovr_TraceMessage ( int level, const char * message )
Writes a message string to the LibOVR tracing mechanism (if enabled).
This message will be passed back to the application via the ovrLogCallback if it was registered.
Parameters
level
One of the ovrLogLevel constants.
message
A UTF8-encoded null-terminated string.
returns the strlen of the message or a negative value if the message is too large.
ovrResult ovr_IdentifyClient ( const char * identity )
Identify client application info.
The string is one or more newline-delimited lines of optional info indicating engine name, engine version, engine plugin name, engine plugin version, engine editor. The order of the lines is not relevant. Individual lines are optional. A newline is not necessary at the end of the last line. Call after ovr_Initialize and before the first call to ovr_Create. Each value is limited to 20 characters. Key names such as 'EngineName:' 'EngineVersion:' do not count towards this limit.
Parameters
identity
Specifies one or more newline-delimited lines of optional info: EngineName: s EngineVersion: s EnginePluginName: s EnginePluginVersion: s EngineEditor: <boolean> ('true' or 'false') Example code
ovr_IdentifyClient("EngineName: Unity\n"
"EngineVersion: 5.3.3\n"
"EnginePluginName: OVRPlugin\n"
"EnginePluginVersion: 1.2.0\n"
"EngineEditor: true");
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
64
65
66
67
68
69
70
71
72
73
74
75
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
243
244
245
246
247
248
249
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
287
288
289
290
292
293
294
295
297
298
299
300
303
304
305
306
307
309
310
311
312
314
315
316
317
319
320
321
322
324
325
326
327
329
330
331
332
335
336
337
338
339
345
346
347
348
349
350
351
352
353
354
360
361
362
363
364
365
366
367
368
369
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
393
394
395
397
398
399
400
401
402
405
406
407
408
409
410
411
413
414
415
416
417
418
422
423
424
425
426
427
428
431
443
444
453
454
455
456
457
458
459
462
463
464
465
466
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
490
491
492
493
494
495
496
497
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
550
551
552
553
554
555
556
561
563
564
567
568
569
572
574
575
578
579
583
584
585
586
587
593
595
596
598
599
603
604
606
607
615
616
617
618
619
620
628
629
630
631
632
633
634
635
643
644
645
646
647
648
649
664
665
666
667
668
669
670
671
676
677
678
679
680
681
682
683
691
692
693
695
696
698
699
702
703
704
705
706
707
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
755
756
757
762
763
766
767
771
772
776
777
778
779
780
781
787
788
789
790
791
792
793
794
795
796
797
798
799
806
811
812
815
816
819
820
821
823
824
826
827
829
830
834
835
836
837
838
839
846
847
848
849
850
851
852
853
854
855
856
857
858
860
875
878
879
880
881
882
883
885
886
887
890
891
894
895
896
897
898
901
902
903
904
905
906
907
909
913
915
916
917
918
920
921
922
923
924
952
953
954
955
956
957
958
959
965
967
968
970
971
973
974
976
977
978
980
981
983
984
986
987
989
990
992
993
995
996
998
999
1001
1002
1006
1007
1010
1011
1013
1014
1016
1017
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1114
1116
1117
1118
1120
1121
1123
1125
1127
1129
1130
1131
1133
1134
1135
1136
1137
1138
1139
1140
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1158
1160
1161
1164
1165
1166
1168
1170
1171
1172
1174
1177
1178
1180
1181
1183
1184
1186
1187
1188
1193
1194
1195
1196
1197
1198
1199
1203
1205
1206
1208
1209
1211
1212
1218
1219
1224
1225
1230
1231
1233
1234
1240
1241
1247
1248
1252
1253
1259
1260
1266
1267
1271
1272
1273
1274
1275
1277
1278
1280
1281
1283
1284
1286
1287
1289
1290
1292
1293
1295
1296
1298
1299
1300
1301
1302
1304
1305
1307
1308
1310
1311
1313
1314
1316
1317
1319
1320
1321
1322
1323
1324
1327
1328
1330
1331
1336
1337
1340
1341
1343
1344
1346
1347
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1368
1371
1372
1373
1379
1380
1381
1384
1385
1388
1389
1392
1393
1394
1395
1396
1397
1398
1400
1401
1402
1403
1404
1409
1410
1411
1412
1413
1414
1415
1416
1424
1425
1430
1433
1434
1439
1440
1444
1445
1449
1450
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1519
1520
1532
1533
1549
1550
1564
1565
1577
1578
1605
1606
1607
1612
1627
1628
1641
1642
1662
1663
1664
1693
1694
1700
1701
1702
1703
1704
1709
1711
1712
1714
1715
1717
1718
1720
1721
1723
1724
1727
1728
1732
1733
1738
1739
1742
1743
1744
1745
1746
1747
1760
1761
1762
1763
1775
1776
1777
1778
1779
1780
1792
1793
1794
1796
1797
1806
1807
1820
1821
1822
1831
1832
1862
1863
1908
1909
1916
1917
1936
1937
1938
1954
1955
1956
1957
1958
1959
1960
1961
1962
1976
1977
1978
1987
1988
1989
1996
1997
2005
2006
2007
2025
2026
2027
2028
2029
2030
2031
2047
2048
2049
2050
2051
2052
2066
2067
2068
2069
2070
2071
2092
2093
2094
2095
2096
2097
2098
2115
2116
2117
2118
2119
2120
2121
2133
2134
2135
2142
2143
2157
2158
2159
2160
2161
2162
2163
2176
2177
2178
2179
2180
2181
2195
2196
2204
2205
2206
2211
2221
2222
2223
2224
2225
2226
2237
2238
2239
2240
2241
2242
2243
2245
2246
2247
2248
2249
2250
2252
2257
2258
2264
2266
2267
2269
2270
2272
2273
2275
2276
2277
2278
2279
2281
2282
2283
2285
2286
2288
2289
2291
2292
2293
2294
2295
2296
2297
2298
2303
2309
2310
2313
2314
2320
2321
2322
2323
2324
2325
2333
2334
2335
2336
2337
2338
2339
2340
2356
2358
2359
2362
2363
2366
2367
2369
2370
2374
2375
2380
2381
2382
2401
2403
2404
2407
2408
2411
2412
2414
2415
2419
2420
2425
2426
2429
2430
2433
2434
2435
2436
2439
2440
2441
2442
2443
2444
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2510
2511
2512
2513
2529
2531
2532
2535
2536
2539
2540
2542
2543
2547
2548
2553
2554
2556
2557
2559
2560
2561
2580
2582
2583
2586
2587
2590
2591
2595
2596
2602
2603
2608
2609
2610
2624
2626
2627
2629
2630
2632
2633
2639
2640
2642
2643
2644
2680
2682
2683
2685
2686
2688
2689
2694
2695
2697
2698
2701
2702
2708
2709
2710
2721
2723
2724
2726
2727
2729
2730
2731
2732
2733
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2748
2749
2750
2760
2761
2765
2776
2777
2778
2789
2790
2791
2803
2804
2805
2806
2807
2808
2827
2828
2829
2838
2839
2840
2844
2853
2854
2855
2882
2883
2884
2885
2886
2887
2888
2900
2901
2902
2926
2927
2928
2949
2950
2951
3010
3011
3012
3013
3014
3015
3016
3017
3084
3085
3086
3087
3088
3089
3090
3091
3093
3094
3095
3096
3099
3100
3106
3110
3111
3115
3117
3118
3121
3122
3127
3128
3133
3134
3138
3139
3142
3143
3147
3151
3152
3157
3158
3162
3163
3167
3168
3171
3172
3176
3177
3180
3181
3185
3188
3189
3192
3193
3196
3197
3200
3201
3202
3203
3207
3208
3213
3225
3226
3227
3230
3231
3244
3245
3248
3249
3253
3254
3255
3256
3257
3288
3289
3302
3303
3326
3327
3336
3337
3338
3339
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3370
3371
3372
3373
3374
3375
3377
3393
3395
3396
3398
3399
3401
3402
3404
3405
3407
3408
3409
3410
3411
3412
3413
3414
3420
3421
3429
3430
3431
3441
3442
3443
3451
3452
3462
3463
3471
3472
3473
3482
3483
3484
3492
3493
3494
3495
3496
3497
3498
3507
3508
3509
3510
3511
3512
3513
3523
3524
3525
3534
3535
3536
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3567
3568
/************************************************************************************
 \file      OVR_CAPI.h
 \brief     C Interface to the Oculus PC SDK tracking and rendering library.
 \copyright Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
 ************************************************************************************/

// We don't use version numbers within OVR_CAPI_h, as all versioned variations
// of this file are currently mutually exclusive.
#ifndef OVR_CAPI_h
#define OVR_CAPI_h

#include "OVR_CAPI_Keys.h"
#include "OVR_Version.h"
#include "OVR_ErrorCode.h"

#if !defined(_WIN32)
#include <sys/types.h>
#endif


// Turn on OpenXR support on all builds
// Note: we're not shipping the loader, only exposing xrNegotiateLoaderRuntimeInterface
#define OVR_OPENXR_SUPPORT_ENABLED

#include <stdint.h>

#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4324) // structure was padded due to __declspec(align())
#pragma warning(disable : 4359) // The alignment specified for a type is less than the
// alignment of the type of one of its data members
#endif

//-----------------------------------------------------------------------------------
// ***** OVR_OS
//
#if !defined(OVR_OS_WIN32) && defined(_WIN32)
#define OVR_OS_WIN32
#endif

#if !defined(OVR_OS_MAC) && defined(__APPLE__)
#define OVR_OS_MAC
#endif

#if !defined(OVR_OS_LINUX) && defined(__linux__)
#define OVR_OS_LINUX
#endif

//-----------------------------------------------------------------------------------
// ***** OVR_CPP
//
#if !defined(OVR_CPP)
#if defined(__cplusplus)
#define OVR_CPP(x) x
#else
#define OVR_CPP(x) /* Not C++ */
#endif
#endif

//-----------------------------------------------------------------------------------
// ***** OVR_CDECL
//
//
#if !defined(OVR_CDECL)
#if defined(_WIN32)
#define OVR_CDECL __cdecl
#else
#define OVR_CDECL
#endif
#endif

//-----------------------------------------------------------------------------------
// ***** OVR_EXTERN_C
//
//
#if !defined(OVR_EXTERN_C)
#ifdef __cplusplus
#define OVR_EXTERN_C extern "C"
#else
#define OVR_EXTERN_C
#endif
#endif

//-----------------------------------------------------------------------------------
// ***** OVR_PUBLIC_FUNCTION / OVR_PRIVATE_FUNCTION
//
// OVR_PUBLIC_FUNCTION  - Functions that externally visible from a shared library.
//                        Corresponds to Microsoft __dllexport.
// OVR_PUBLIC_CLASS     - C++ structs and classes that are externally visible from a
//                        shared library. Corresponds to Microsoft __dllexport.
// OVR_PRIVATE_FUNCTION - Functions that are not visible outside of a shared library.
//                        They are private to the shared library.
// OVR_PRIVATE_CLASS    - C++ structs and classes that are not visible outside of a
//                        shared library. They are private to the shared library.
//
// OVR_DLL_BUILD        - Used to indicate that the current compilation unit is of a shared library.
// OVR_DLL_IMPORT       - Used to indicate that the current compilation unit is a
//                        user of the corresponding shared library.
// OVR_STATIC_BUILD     - used to indicate that the current compilation unit is not a
//                        shared library but rather statically linked code.
//
#if !defined(OVR_PUBLIC_FUNCTION)
#if defined(OVR_DLL_BUILD)
#if defined(_WIN32)
#define OVR_PUBLIC_FUNCTION(rval) OVR_EXTERN_C __declspec(dllexport) rval OVR_CDECL
#define OVR_PUBLIC_CLASS __declspec(dllexport)
#define OVR_PRIVATE_FUNCTION(rval) rval OVR_CDECL
#define OVR_PRIVATE_CLASS
#else
#define OVR_PUBLIC_FUNCTION(rval) \
  OVR_EXTERN_C __attribute__((visibility("default"))) rval OVR_CDECL /* Requires GCC 4.0+ */
#define OVR_PUBLIC_CLASS __attribute__((visibility("default"))) /* Requires GCC 4.0+ */
#define OVR_PRIVATE_FUNCTION(rval) __attribute__((visibility("hidden"))) rval OVR_CDECL
#define OVR_PRIVATE_CLASS __attribute__((visibility("hidden")))
#endif
#elif defined(OVR_DLL_IMPORT)
#if defined(_WIN32)
#define OVR_PUBLIC_FUNCTION(rval) OVR_EXTERN_C __declspec(dllimport) rval OVR_CDECL
#define OVR_PUBLIC_CLASS __declspec(dllimport)
#else
#define OVR_PUBLIC_FUNCTION(rval) OVR_EXTERN_C rval OVR_CDECL
#define OVR_PUBLIC_CLASS
#endif
#define OVR_PRIVATE_FUNCTION(rval) rval OVR_CDECL
#define OVR_PRIVATE_CLASS
#else // OVR_STATIC_BUILD
#define OVR_PUBLIC_FUNCTION(rval) OVR_EXTERN_C rval OVR_CDECL
#define OVR_PUBLIC_CLASS
#define OVR_PRIVATE_FUNCTION(rval) rval OVR_CDECL
#define OVR_PRIVATE_CLASS
#endif
#endif

//-----------------------------------------------------------------------------------
// ***** OVR_EXPORT
//
//
#if !defined(OVR_EXPORT)
#ifdef OVR_OS_WIN32
#define OVR_EXPORT __declspec(dllexport)
#else
#define OVR_EXPORT
#endif
#endif

//-----------------------------------------------------------------------------------
// ***** OVR_ALIGNAS
//
#if !defined(OVR_ALIGNAS)
#if defined(__GNUC__) || defined(__clang__)
#define OVR_ALIGNAS(n) __attribute__((aligned(n)))
#elif defined(_MSC_VER) || defined(__INTEL_COMPILER)
#define OVR_ALIGNAS(n) __declspec(align(n))
#elif defined(__CC_ARM)
#define OVR_ALIGNAS(n) __align(n)
#else
#error Need to define OVR_ALIGNAS
#endif
#endif

//-----------------------------------------------------------------------------------
// ***** OVR_CC_HAS_FEATURE
//
// This is a portable way to use compile-time feature identification available
// with some compilers in a clean way. Direct usage of __has_feature in preprocessing
// statements of non-supporting compilers results in a preprocessing error.
//
// Example usage:
//     #if OVR_CC_HAS_FEATURE(is_pod)
//         if(__is_pod(T)) // If the type is plain data then we can safely memcpy it.
//             memcpy(&destObject, &srcObject, sizeof(object));
//     #endif
//
#if !defined(OVR_CC_HAS_FEATURE)
#if defined(__clang__) // http://clang.llvm.org/docs/LanguageExtensions.html#id2
#define OVR_CC_HAS_FEATURE(x) __has_feature(x)
#else
#define OVR_CC_HAS_FEATURE(x) 0
#endif
#endif

// ------------------------------------------------------------------------
// ***** OVR_STATIC_ASSERT
//
// Portable support for C++11 static_assert().
// Acts as if the following were declared:
//     void OVR_STATIC_ASSERT(bool const_expression, const char* msg);
//
// Example usage:
//     OVR_STATIC_ASSERT(sizeof(int32_t) == 4, "int32_t expected to be 4 bytes.");

#if !defined(OVR_STATIC_ASSERT)
#if !(defined(__cplusplus) && (__cplusplus >= 201103L)) /* Other */ && \
    !(defined(__GXX_EXPERIMENTAL_CXX0X__)) /* GCC */ &&                \
    !(defined(__clang__) && defined(__cplusplus) &&                    \
      OVR_CC_HAS_FEATURE(cxx_static_assert)) /* clang */               \
    && !(defined(_MSC_VER) && (_MSC_VER >= 1600) && defined(__cplusplus)) /* VS2010+  */

#if !defined(OVR_SA_UNUSED)
#if defined(OVR_CC_GNU) || defined(OVR_CC_CLANG)
#define OVR_SA_UNUSED __attribute__((unused))
#else
#define OVR_SA_UNUSED
#endif
#define OVR_SA_PASTE(a, b) a##b
#define OVR_SA_HELP(a, b) OVR_SA_PASTE(a, b)
#endif

#if defined(__COUNTER__)
#define OVR_STATIC_ASSERT(expression, msg) \
  typedef char OVR_SA_HELP(staticAssert, __COUNTER__)[((expression) != 0) ? 1 : -1] OVR_SA_UNUSED
#else
#define OVR_STATIC_ASSERT(expression, msg) \
  typedef char OVR_SA_HELP(staticAssert, __LINE__)[((expression) != 0) ? 1 : -1] OVR_SA_UNUSED
#endif

#else
#define OVR_STATIC_ASSERT(expression, msg) static_assert(expression, msg)
#endif
#endif

// OVR_STATIC_ASSERT_OFFSETOF statically asserts offsetof(Type.member) == expected_offset
#define OVR_STATIC_ASSERT_OFFSETOF(Type, member, expected_offset) \
  OVR_STATIC_ASSERT(                                              \
      offsetof(Type, member) == (expected_offset),                \
      "Expected " #Type "." #member " offset == " #expected_offset)

// OVR_STATIC_ASSERT_SIZEOF statically asserts sizeof(Type) == expected_size
#define OVR_STATIC_ASSERT_SIZEOF(Type, expected_size) \
  OVR_STATIC_ASSERT(                                  \
      sizeof(Type) == (expected_size), "Expected sizeof(" #Type ") == " #expected_size)

//-----------------------------------------------------------------------------------
// ***** Padding
//
#if !defined(OVR_UNUSED_STRUCT_PAD)
#define OVR_UNUSED_STRUCT_PAD(padName, size) char padName[size];
#endif

//-----------------------------------------------------------------------------------
// ***** Word Size
//
#if !defined(OVR_PTR_SIZE)
#if defined(__WORDSIZE)
#define OVR_PTR_SIZE ((__WORDSIZE) / 8)
#elif defined(_WIN64) || defined(__LP64__) || defined(_LP64) || defined(_M_IA64) || \
    defined(__ia64__) || defined(__arch64__) || defined(__64BIT__) || defined(__Ptr_Is_64)
#define OVR_PTR_SIZE 8
#elif defined(__CC_ARM) && (__sizeof_ptr == 8)
#define OVR_PTR_SIZE 8
#else
#define OVR_PTR_SIZE 4
#endif
#endif

//-----------------------------------------------------------------------------------
// ***** OVR_ON32 / OVR_ON64
//
#if OVR_PTR_SIZE == 8
#define OVR_ON32(x)
#define OVR_ON64(x) x
#else
#define OVR_ON32(x) x
#define OVR_ON64(x)
#endif

//-----------------------------------------------------------------------------------
// ***** ovrBool

typedefchar ovrBool; 
#define ovrFalse 0 
#define ovrTrue 1 

//-----------------------------------------------------------------------------------
// ***** Simple Math Structures

typedefstruct OVR_ALIGNAS(4) ovrColorf_ {
float r, g, b, a;
} ovrColorf;

typedefstruct OVR_ALIGNAS(4) ovrVector2i_ {
int x, y;
} ovrVector2i;

typedefstruct OVR_ALIGNAS(4) ovrSizei_ {
int w, h;
} ovrSizei;

typedefstruct OVR_ALIGNAS(4) ovrRecti_ {
  ovrVector2i Pos;
  ovrSizei Size;
} ovrRecti;

typedefstruct OVR_ALIGNAS(4) ovrQuatf_ {
float x, y, z, w;
} ovrQuatf;

typedefstruct OVR_ALIGNAS(4) ovrVector2f_ {
float x, y;
} ovrVector2f;

typedefstruct OVR_ALIGNAS(4) ovrVector3f_ {
float x, y, z;
} ovrVector3f;

typedefstruct OVR_ALIGNAS(4) ovrVector4f_ {
float x, y, z, w;
} ovrVector4f;

typedefstruct OVR_ALIGNAS(4) ovrMatrix4f_ {
float M[4][4];
} ovrMatrix4f;

typedefstruct OVR_ALIGNAS(4) ovrPosef_ {
  ovrQuatf Orientation;
  ovrVector3f Position;
} ovrPosef;

typedefstruct OVR_ALIGNAS(8) ovrPoseStatef_ {
  ovrPosef ThePose; 
  ovrVector3f AngularVelocity; 
  ovrVector3f LinearVelocity; 
  ovrVector3f AngularAcceleration; 
  ovrVector3f LinearAcceleration; 
  OVR_UNUSED_STRUCT_PAD(pad0, 4) 
  double TimeInSeconds; 
} ovrPoseStatef;

typedef struct OVR_ALIGNAS(4) ovrFovPort_ {
float UpTan; 
float DownTan; 
float LeftTan; 
float RightTan; 
} ovrFovPort;

//-----------------------------------------------------------------------------------
// ***** HMD Types

typedefenum ovrHmdType_ {
  ovrHmd_None = 0,
  ovrHmd_DK1 = 3,
  ovrHmd_DKHD = 4,
  ovrHmd_DK2 = 6,
  ovrHmd_CB = 8,
  ovrHmd_Other = 9,
  ovrHmd_E3_2015 = 10,
  ovrHmd_ES06 = 11,
  ovrHmd_ES09 = 12,
  ovrHmd_ES11 = 13,
  ovrHmd_CV1 = 14,
  ovrHmd_RiftS = 16,

  ovrHmd_EnumSize = 0x7fffffff 
} ovrHmdType;

typedefenum ovrHmdCaps_ {
// Read-only flags

  ovrHmdCap_DebugDevice = 0x0010,


  ovrHmdCap_EnumSize = 0x7fffffff 
} ovrHmdCaps;

typedefenum ovrTrackingCaps_ {
  ovrTrackingCap_Orientation = 0x0010, 
  ovrTrackingCap_MagYawCorrection = 0x0020, 
  ovrTrackingCap_Position = 0x0040, 
  ovrTrackingCap_EnumSize = 0x7fffffff 
} ovrTrackingCaps;

typedefenum ovrExtensions_ {
  ovrExtension_TextureLayout_Octilinear = 0, 
  ovrExtension_Count, 
  ovrExtension_EnumSize = 0x7fffffff 
} ovrExtensions;

typedefenum ovrEyeType_ {
  ovrEye_Left = 0, 
  ovrEye_Right = 1, 
  ovrEye_Count = 2, 
  ovrEye_EnumSize = 0x7fffffff 
} ovrEyeType;

typedefenum ovrTrackingOrigin_ {
  ovrTrackingOrigin_EyeLevel = 0,

  ovrTrackingOrigin_FloorLevel = 1,

  ovrTrackingOrigin_Count = 2, 
  ovrTrackingOrigin_EnumSize = 0x7fffffff 
} ovrTrackingOrigin;


typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrGraphicsLuid_ {
// Public definition reserves space for graphics API-specific implementation
char Reserved[8];
} ovrGraphicsLuid;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrHmdDesc_ {
  ovrHmdType Type; 
  OVR_ON64(OVR_UNUSED_STRUCT_PAD(pad0, 4)) 
  char ProductName[64]; 
char Manufacturer[64]; 
short VendorId; 
short ProductId; 
char SerialNumber[24]; 
short FirmwareMajor; 
short FirmwareMinor; 
unsignedint AvailableHmdCaps; 
unsignedint DefaultHmdCaps; 
unsignedint AvailableTrackingCaps; 
unsignedint DefaultTrackingCaps; 
  ovrFovPort DefaultEyeFov[ovrEye_Count]; 
  ovrFovPort MaxEyeFov[ovrEye_Count]; 
  ovrSizei Resolution; 
float DisplayRefreshRate; 
  OVR_ON64(OVR_UNUSED_STRUCT_PAD(pad1, 4)) 
} ovrHmdDesc;

typedef struct ovrHmdStruct* ovrSession;

#ifdef OVR_OS_WIN32
typedef uint32_t ovrProcessId;
#else
typedef pid_t ovrProcessId;
#endif

#if !defined(VK_VERSION_1_0)
// From <vulkan/vulkan.h>:
#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object;
#if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__)) || \
    defined(_M_X64) || defined(__ia64) || defined(_M_IA64) || defined(__aarch64__) ||       \
    defined(__powerpc64__)
#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T* object;
#else
#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;
#endif
VK_DEFINE_HANDLE(VkInstance)
VK_DEFINE_HANDLE(VkPhysicalDevice)
VK_DEFINE_HANDLE(VkDevice)
VK_DEFINE_HANDLE(VkQueue)
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImage)
#endif

typedefenum ovrStatusBits_ {
// Device orientation is currently tracked. It's possible that the device orientation is not
// tracked,
// but its reported orientation is nevertheless valid (e.g. due to estimation)
  ovrStatus_OrientationTracked = 0x0001,

// Device position is currently tracked. It's possible that the device position is not tracked,
// but its reported position is nevertheless valid (e.g. due to estimation).
  ovrStatus_PositionTracked = 0x0002,

// The reported device orientation is valid for application use. In the case that OrientationValid
// is true and
// OrientationTracked is false, the runtime may be estimating the orientation of the device.
// In the case that OrientationValid is false, the application should not use the returned
// orientation value.
  ovrStatus_OrientationValid = 0x0004,

// The reported device orientation is valid for application use. In the case that PositionValid is
// true and
// PositionTracked is false, the runtime may be estimating the position of the device.
// In the case that PositionValid is false, the application should not use the returned position
// value.
  ovrStatus_PositionValid = 0x0008
} ovrStatusBits;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrTrackerDesc_ {
float FrustumHFovInRadians; 
float FrustumVFovInRadians; 
float FrustumNearZInMeters; 
float FrustumFarZInMeters; 
} ovrTrackerDesc;

typedefenum ovrTrackerFlags_ {
  ovrTracker_Connected = 0x0020,

  ovrTracker_PoseTracked = 0x0004
} ovrTrackerFlags;

typedefstruct OVR_ALIGNAS(8) _ovrTrackerPose {
unsignedint TrackerFlags;

  ovrPosef Pose;

  ovrPosef LeveledPose;

  OVR_UNUSED_STRUCT_PAD(pad0, 4) 
} ovrTrackerPose;

typedefstruct OVR_ALIGNAS(8) ovrTrackingState_ {
  ovrPoseStatef HeadPose;

unsignedint StatusFlags;

  ovrPoseStatef HandPoses[2];

unsignedint HandStatusFlags[2];

  ovrPosef CalibratedOrigin;

} ovrTrackingState;



typedefstruct OVR_ALIGNAS(4) ovrEyeRenderDesc_ {
  ovrEyeType Eye; 
  ovrFovPort Fov; 
  ovrRecti DistortedViewport; 
  ovrVector2f PixelsPerTanAngleAtCenter; 
  ovrPosef HmdToEyePose; 
} ovrEyeRenderDesc;

typedefstruct OVR_ALIGNAS(4) ovrTimewarpProjectionDesc_ {
float Projection22; 
float Projection23; 
float Projection32; 
} ovrTimewarpProjectionDesc;


typedefstruct OVR_ALIGNAS(4) ovrViewScaleDesc_ {
  ovrPosef HmdToEyePose[ovrEye_Count]; 
float HmdSpaceToWorldScaleInMeters; 
} ovrViewScaleDesc;

//-----------------------------------------------------------------------------------
// ***** Platform-independent Rendering Configuration

typedefenum ovrTextureType_ {
  ovrTexture_2D, 
  ovrTexture_2D_External, 
  ovrTexture_Cube, 
  ovrTexture_Count,
  ovrTexture_EnumSize = 0x7fffffff 
} ovrTextureType;

typedefenum ovrTextureBindFlags_ {
  ovrTextureBind_None,

  ovrTextureBind_DX_RenderTarget = 0x0001,

  ovrTextureBind_DX_UnorderedAccess = 0x0002,

  ovrTextureBind_DX_DepthStencil = 0x0004,


  ovrTextureBind_EnumSize = 0x7fffffff 
} ovrTextureBindFlags;

typedefenum ovrTextureFormat_ {
  OVR_FORMAT_UNKNOWN = 0,
  OVR_FORMAT_B5G6R5_UNORM = 1, 
  OVR_FORMAT_B5G5R5A1_UNORM = 2, 
  OVR_FORMAT_B4G4R4A4_UNORM = 3, 
  OVR_FORMAT_R8G8B8A8_UNORM = 4,
  OVR_FORMAT_R8G8B8A8_UNORM_SRGB = 5,
  OVR_FORMAT_B8G8R8A8_UNORM = 6,
  OVR_FORMAT_B8G8R8_UNORM = 27,
  OVR_FORMAT_B8G8R8A8_UNORM_SRGB = 7, 
  OVR_FORMAT_B8G8R8X8_UNORM = 8, 
  OVR_FORMAT_B8G8R8X8_UNORM_SRGB = 9, 
  OVR_FORMAT_R16G16B16A16_FLOAT = 10,
  OVR_FORMAT_R11G11B10_FLOAT = 25, 

// Depth formats
  OVR_FORMAT_D16_UNORM = 11,
  OVR_FORMAT_D24_UNORM_S8_UINT = 12,
  OVR_FORMAT_D32_FLOAT = 13,
  OVR_FORMAT_D32_FLOAT_S8X24_UINT = 14,

// Added in 1.5 compressed formats can be used for static layers
  OVR_FORMAT_BC1_UNORM = 15,
  OVR_FORMAT_BC1_UNORM_SRGB = 16,
  OVR_FORMAT_BC2_UNORM = 17,
  OVR_FORMAT_BC2_UNORM_SRGB = 18,
  OVR_FORMAT_BC3_UNORM = 19,
  OVR_FORMAT_BC3_UNORM_SRGB = 20,
  OVR_FORMAT_BC6H_UF16 = 21,
  OVR_FORMAT_BC6H_SF16 = 22,
  OVR_FORMAT_BC7_UNORM = 23,
  OVR_FORMAT_BC7_UNORM_SRGB = 24,


  OVR_FORMAT_LAST,
  OVR_FORMAT_ENUMSIZE = 0x7fffffff 
} ovrTextureFormat;

typedefenum ovrTextureMiscFlags_ {
  ovrTextureMisc_None,

  ovrTextureMisc_DX_Typeless = 0x0001,

  ovrTextureMisc_AllowGenerateMips = 0x0002,

  ovrTextureMisc_ProtectedContent = 0x0004,

  ovrTextureMisc_AutoGenerateMips = 0x0008,


  ovrTextureMisc_EnumSize = 0x7fffffff 
} ovrTextureFlags;

typedefstruct ovrTextureSwapChainDesc_ {
  ovrTextureType Type; 
  ovrTextureFormat Format;
int ArraySize; 
int Width;
int Height;
int MipLevels;
int SampleCount;
  ovrBool StaticImage; 
  OVR_ALIGNAS(4) unsigned int MiscFlags; 
  OVR_ALIGNAS(4) unsignedint BindFlags; 
} ovrTextureSwapChainDesc;

typedef enum ovrMirrorOptions_ {
  ovrMirrorOption_Default = 0x0000,

  ovrMirrorOption_PostDistortion = 0x0001,

  ovrMirrorOption_LeftEyeOnly = 0x0002,
  ovrMirrorOption_RightEyeOnly = 0x0004,

  ovrMirrorOption_IncludeGuardian = 0x0008,

  ovrMirrorOption_IncludeNotifications = 0x0010,

  ovrMirrorOption_IncludeSystemGui = 0x0020,

  ovrMirrorOption_ForceSymmetricFov = 0x0040,


  ovrMirrorOption_EnumSize = 0x7fffffff 
} ovrMirrorOptions;

typedefstruct ovrMirrorTextureDesc_ {
  ovrTextureFormat Format;
int Width;
int Height;
unsignedint MiscFlags; 
unsignedint MirrorOptions; 
} ovrMirrorTextureDesc;

typedefstruct ovrTextureSwapChainData* ovrTextureSwapChain;
typedefstruct ovrMirrorTextureData* ovrMirrorTexture;

//-----------------------------------------------------------------------------------



typedefenum ovrFovStencilType_ {
  ovrFovStencil_HiddenArea = 0, 
  ovrFovStencil_VisibleArea = 1, 
  ovrFovStencil_BorderLine = 2, 
  ovrFovStencil_VisibleRectangle = 3, 

  ovrFovStencilType_EnumSize = 0x7fffffff 
} ovrFovStencilType;

typedefenum ovrFovStencilFlags_ {

  ovrFovStencilFlag_MeshOriginAtBottomLeft = 0x01,

  ovrFovStencilFlag_EnumSize = 0x7fffffff 
} ovrFovStencilFlags;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrFovStencilDesc_ {
  ovrFovStencilType StencilType;
  uint32_t StencilFlags; 
  ovrEyeType Eye;
  ovrFovPort FovPort; 
  ovrQuatf HmdToEyeRotation; 
} ovrFovStencilDesc;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrFovStencilMeshBuffer_ {
int AllocVertexCount; 
int UsedVertexCount; 
  ovrVector2f* VertexBuffer; 

int AllocIndexCount; 
int UsedIndexCount; 
  uint16_t* IndexBuffer; 
} ovrFovStencilMeshBuffer;

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_GetFovStencil(
    ovrSession session,
const ovrFovStencilDesc* fovStencilDesc,
    ovrFovStencilMeshBuffer* meshBuffer);

//-----------------------------------------------------------------------------------

typedefenum ovrButton_ {
  ovrButton_A = 0x00000001,

  ovrButton_B = 0x00000002,

  ovrButton_RThumb = 0x00000004,

  ovrButton_RShoulder = 0x00000008,


  ovrButton_X = 0x00000100,

  ovrButton_Y = 0x00000200,

  ovrButton_LThumb = 0x00000400,

  ovrButton_LShoulder = 0x00000800,

  ovrButton_Up = 0x00010000,

  ovrButton_Down = 0x00020000,

  ovrButton_Left = 0x00040000,

  ovrButton_Right = 0x00080000,

  ovrButton_Enter = 0x00100000,

  ovrButton_Back = 0x00200000,

  ovrButton_VolUp = 0x00400000,

  ovrButton_VolDown = 0x00800000,

  ovrButton_Home = 0x01000000,

// Bit mask of all buttons that are for private usage by Oculus
  ovrButton_Private = ovrButton_VolUp | ovrButton_VolDown | ovrButton_Home,

// Bit mask of all buttons on the right Touch controller
  ovrButton_RMask = ovrButton_A | ovrButton_B | ovrButton_RThumb | ovrButton_RShoulder,

// Bit mask of all buttons on the left Touch controller
  ovrButton_LMask =
      ovrButton_X | ovrButton_Y | ovrButton_LThumb | ovrButton_LShoulder | ovrButton_Enter,

  ovrButton_EnumSize = 0x7fffffff 
} ovrButton;

typedefenum ovrTouch_ {
  ovrTouch_A = ovrButton_A,
  ovrTouch_B = ovrButton_B,
  ovrTouch_RThumb = ovrButton_RThumb,
  ovrTouch_RThumbRest = 0x00000008,
  ovrTouch_RIndexTrigger = 0x00000010,

// Bit mask of all the button touches on the right controller
  ovrTouch_RButtonMask =
      ovrTouch_A | ovrTouch_B | ovrTouch_RThumb | ovrTouch_RThumbRest | ovrTouch_RIndexTrigger,

  ovrTouch_X = ovrButton_X,
  ovrTouch_Y = ovrButton_Y,
  ovrTouch_LThumb = ovrButton_LThumb,
  ovrTouch_LThumbRest = 0x00000800,
  ovrTouch_LIndexTrigger = 0x00001000,

// Bit mask of all the button touches on the left controller
  ovrTouch_LButtonMask =
      ovrTouch_X | ovrTouch_Y | ovrTouch_LThumb | ovrTouch_LThumbRest | ovrTouch_LIndexTrigger,

// Finger pose state
// Derived internally based on distance, proximity to sensors and filtering.
  ovrTouch_RIndexPointing = 0x00000020,
  ovrTouch_RThumbUp = 0x00000040,
  ovrTouch_LIndexPointing = 0x00002000,
  ovrTouch_LThumbUp = 0x00004000,

// Bit mask of all right controller poses
  ovrTouch_RPoseMask = ovrTouch_RIndexPointing | ovrTouch_RThumbUp,

// Bit mask of all left controller poses
  ovrTouch_LPoseMask = ovrTouch_LIndexPointing | ovrTouch_LThumbUp,

  ovrTouch_EnumSize = 0x7fffffff 
} ovrTouch;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrTouchHapticsDesc_ {
// Haptics engine frequency/sample-rate, sample time in seconds equals 1.0/sampleRateHz
int SampleRateHz;
// Size of each Haptics sample, sample value range is [0, 2^(Bytes*8)-1]
int SampleSizeInBytes;

// Queue size that would guarantee Haptics engine would not starve for data
// Make sure size doesn't drop below it for best results
int QueueMinSizeToAvoidStarvation;

// Minimum, Maximum and Optimal number of samples that can be sent to Haptics through
// ovr_SubmitControllerVibration
int SubmitMinSamples;
int SubmitMaxSamples;
int SubmitOptimalSamples;
} ovrTouchHapticsDesc;

typedefenum ovrControllerType_ {
  ovrControllerType_None = 0x0000,
  ovrControllerType_LTouch = 0x0001,
  ovrControllerType_RTouch = 0x0002,
  ovrControllerType_Touch = (ovrControllerType_LTouch | ovrControllerType_RTouch),
  ovrControllerType_Remote = 0x0004,

  ovrControllerType_XBox = 0x0010,

  ovrControllerType_Object0 = 0x0100,
  ovrControllerType_Object1 = 0x0200,
  ovrControllerType_Object2 = 0x0400,
  ovrControllerType_Object3 = 0x0800,

  ovrControllerType_Active = 0xffffffff, 

  ovrControllerType_EnumSize = 0x7fffffff 
} ovrControllerType;

typedefenum ovrHapticsBufferSubmitMode_ {
  ovrHapticsBufferSubmit_Enqueue
} ovrHapticsBufferSubmitMode;

#define OVR_HAPTICS_BUFFER_SAMPLES_MAX 256

typedefstruct ovrHapticsBuffer_ {
constvoid* Samples;
int SamplesCount;
  ovrHapticsBufferSubmitMode SubmitMode;
} ovrHapticsBuffer;

typedefstruct ovrHapticsPlaybackState_ {
// Remaining space available to queue more samples
int RemainingQueueSpace;

// Number of samples currently queued
int SamplesQueued;
} ovrHapticsPlaybackState;

typedefenum ovrTrackedDeviceType_ {
  ovrTrackedDevice_None = 0x0000,
  ovrTrackedDevice_HMD = 0x0001,
  ovrTrackedDevice_LTouch = 0x0002,
  ovrTrackedDevice_RTouch = 0x0004,
  ovrTrackedDevice_Touch = (ovrTrackedDevice_LTouch | ovrTrackedDevice_RTouch),

  ovrTrackedDevice_Object0 = 0x0010,
  ovrTrackedDevice_Object1 = 0x0020,
  ovrTrackedDevice_Object2 = 0x0040,
  ovrTrackedDevice_Object3 = 0x0080,

  ovrTrackedDevice_All = 0xFFFF,
} ovrTrackedDeviceType;

typedefenum ovrBoundaryType_ {
  ovrBoundary_Outer = 0x0001,

  ovrBoundary_PlayArea = 0x0100,
} ovrBoundaryType;

typedefstruct ovrBoundaryLookAndFeel_ {
  ovrColorf Color;
} ovrBoundaryLookAndFeel;

typedefstruct ovrBoundaryTestResult_ {
  ovrBool IsTriggering;

float ClosestDistance;

  ovrVector3f ClosestPoint;

  ovrVector3f ClosestPointNormal;
} ovrBoundaryTestResult;

typedefenum ovrHandType_ {
  ovrHand_Left = 0,
  ovrHand_Right = 1,
  ovrHand_Count = 2,
  ovrHand_EnumSize = 0x7fffffff 
} ovrHandType;

typedefstruct ovrInputState_ {
double TimeInSeconds;

unsignedint Buttons;

unsignedint Touches;

float IndexTrigger[ovrHand_Count];

float HandTrigger[ovrHand_Count];

  ovrVector2f Thumbstick[ovrHand_Count];

  ovrControllerType ControllerType;

float IndexTriggerNoDeadzone[ovrHand_Count];

float HandTriggerNoDeadzone[ovrHand_Count];

  ovrVector2f ThumbstickNoDeadzone[ovrHand_Count];

float IndexTriggerRaw[ovrHand_Count];

float HandTriggerRaw[ovrHand_Count];

  ovrVector2f ThumbstickRaw[ovrHand_Count];

} ovrInputState;

typedefstruct ovrCameraIntrinsics_ {
double LastChangedTime;

  ovrFovPort FOVPort;

float VirtualNearPlaneDistanceMeters;

float VirtualFarPlaneDistanceMeters;

  ovrSizei ImageSensorPixelResolution;

  ovrMatrix4f LensDistortionMatrix;

double ExposurePeriodSeconds;

double ExposureDurationSeconds;

} ovrCameraIntrinsics;

typedefenum ovrCameraStatusFlags_ {
  ovrCameraStatus_None = 0x0,

  ovrCameraStatus_Connected = 0x1,

  ovrCameraStatus_Calibrating = 0x2,

  ovrCameraStatus_CalibrationFailed = 0x4,

  ovrCameraStatus_Calibrated = 0x8,

  ovrCameraStatus_Capturing = 0x10,

  ovrCameraStatus_EnumSize = 0x7fffffff 
} ovrCameraStatusFlags;

typedefstruct ovrCameraExtrinsics_ {
double LastChangedTimeSeconds;

unsignedint CameraStatusFlags;

  ovrTrackedDeviceType AttachedToDevice;

  ovrPosef RelativePose;

double LastExposureTimeSeconds;

double ExposureLatencySeconds;

double AdditionalLatencySeconds;

} ovrCameraExtrinsics;
#define OVR_MAX_EXTERNAL_CAMERA_COUNT 16
#define OVR_EXTERNAL_CAMERA_NAME_SIZE 32
typedefstruct ovrExternalCamera_ {
char Name[OVR_EXTERNAL_CAMERA_NAME_SIZE]; // camera identifier: vid + pid + serial number etc.
  ovrCameraIntrinsics Intrinsics;
  ovrCameraExtrinsics Extrinsics;
} ovrExternalCamera;

//-----------------------------------------------------------------------------------
// ***** Initialize structures

typedefenum ovrInitFlags_ {
  ovrInit_Debug = 0x00000001,


  ovrInit_RequestVersion = 0x00000004,


  ovrInit_Invisible = 0x00000010,

  ovrInit_MixedRendering = 0x00000020,

  ovrInit_FocusAware = 0x00000040,






  ovrinit_WritableBits = 0x00ffffff,

  ovrInit_EnumSize = 0x7fffffff 
} ovrInitFlags;

typedefenum ovrLogLevel_ {
  ovrLogLevel_Debug = 0, 
  ovrLogLevel_Info = 1, 
  ovrLogLevel_Error = 2, 

  ovrLogLevel_EnumSize = 0x7fffffff 
} ovrLogLevel;

typedef void(OVR_CDECL* ovrLogCallback)(uintptr_t userData, int level, constchar* message);

typedefstruct OVR_ALIGNAS(8) ovrInitParams_ {
  uint32_t Flags;

  uint32_t RequestedMinorVersion;

  ovrLogCallback LogCallback;

  uintptr_t UserData;

  uint32_t ConnectionTimeoutMS;

  OVR_ON64(OVR_UNUSED_STRUCT_PAD(pad0, 4)) 

} ovrInitParams;


#ifdef __cplusplus
extern"C" {
#endif


#if !defined(OVR_EXPORTING_CAPI)

// -----------------------------------------------------------------------------------
// ***** API Interfaces

OVR_PUBLIC_FUNCTION(ovrResult) ovr_Initialize(const ovrInitParams* params);

OVR_PUBLIC_FUNCTION(void) ovr_Shutdown();

OVR_PUBLIC_FUNCTION(void) ovr_GetLastErrorInfo(ovrErrorInfo* errorInfo);

OVR_PUBLIC_FUNCTION(constchar*) ovr_GetVersionString();

OVR_PUBLIC_FUNCTION(int) ovr_TraceMessage(int level, constchar* message);

OVR_PUBLIC_FUNCTION(ovrResult) ovr_IdentifyClient(constchar* identity);

//-------------------------------------------------------------------------------------

OVR_PUBLIC_FUNCTION(ovrHmdDesc) ovr_GetHmdDesc(ovrSession session);

OVR_PUBLIC_FUNCTION(unsignedint) ovr_GetTrackerCount(ovrSession session);

OVR_PUBLIC_FUNCTION(ovrTrackerDesc)
ovr_GetTrackerDesc(ovrSession session, unsignedint trackerDescIndex);

OVR_PUBLIC_FUNCTION(ovrResult) ovr_Create(ovrSession* pSession, ovrGraphicsLuid* pLuid);

OVR_PUBLIC_FUNCTION(void) ovr_Destroy(ovrSession session);


#endif // !defined(OVR_EXPORTING_CAPI)

typedefstruct ovrSessionStatus_ {
  ovrBool IsVisible;

  ovrBool HmdPresent;

  ovrBool HmdMounted;

  ovrBool DisplayLost;

  ovrBool ShouldQuit;

  ovrBool ShouldRecenter;

  ovrBool HasInputFocus;

  ovrBool OverlayPresent;

  ovrBool DepthRequested;

} ovrSessionStatus;

#if !defined(OVR_EXPORTING_CAPI)

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_GetSessionStatus(ovrSession session, ovrSessionStatus* sessionStatus);


OVR_PUBLIC_FUNCTION(ovrResult)
ovr_IsExtensionSupported(
    ovrSession session,
    ovrExtensions extension,
    ovrBool* outExtensionSupported);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_EnableExtension(ovrSession session, ovrExtensions extension);


//-------------------------------------------------------------------------------------


OVR_PUBLIC_FUNCTION(ovrResult)
ovr_SetTrackingOriginType(ovrSession session, ovrTrackingOrigin origin);

OVR_PUBLIC_FUNCTION(ovrTrackingOrigin) ovr_GetTrackingOriginType(ovrSession session);

OVR_PUBLIC_FUNCTION(ovrResult) ovr_RecenterTrackingOrigin(ovrSession session);

OVR_PUBLIC_FUNCTION(ovrResult) ovr_SpecifyTrackingOrigin(ovrSession session, ovrPosef originPose);

OVR_PUBLIC_FUNCTION(void) ovr_ClearShouldRecenterFlag(ovrSession session);

OVR_PUBLIC_FUNCTION(ovrTrackingState)
ovr_GetTrackingState(ovrSession session, double absTime, ovrBool latencyMarker);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_GetDevicePoses(
    ovrSession session,
    ovrTrackedDeviceType* deviceTypes,
int deviceCount,
double absTime,
    ovrPoseStatef* outDevicePoses);


OVR_PUBLIC_FUNCTION(ovrTrackerPose)
ovr_GetTrackerPose(ovrSession session, unsignedint trackerPoseIndex);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_GetInputState(ovrSession session, ovrControllerType controllerType, ovrInputState* inputState);

OVR_PUBLIC_FUNCTION(unsignedint) ovr_GetConnectedControllerTypes(ovrSession session);

OVR_PUBLIC_FUNCTION(ovrTouchHapticsDesc)
ovr_GetTouchHapticsDesc(ovrSession session, ovrControllerType controllerType);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_SetControllerVibration(
    ovrSession session,
    ovrControllerType controllerType,
float frequency,
float amplitude);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_SubmitControllerVibration(
    ovrSession session,
    ovrControllerType controllerType,
const ovrHapticsBuffer* buffer);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_GetControllerVibrationState(
    ovrSession session,
    ovrControllerType controllerType,
    ovrHapticsPlaybackState* outState);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_TestBoundary(
    ovrSession session,
    ovrTrackedDeviceType deviceBitmask,
    ovrBoundaryType boundaryType,
    ovrBoundaryTestResult* outTestResult);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_TestBoundaryPoint(
    ovrSession session,
const ovrVector3f* point,
    ovrBoundaryType singleBoundaryType,
    ovrBoundaryTestResult* outTestResult);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_SetBoundaryLookAndFeel(ovrSession session, const ovrBoundaryLookAndFeel* lookAndFeel);

OVR_PUBLIC_FUNCTION(ovrResult) ovr_ResetBoundaryLookAndFeel(ovrSession session);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_GetBoundaryGeometry(
    ovrSession session,
    ovrBoundaryType boundaryType,
    ovrVector3f* outFloorPoints,
int* outFloorPointsCount);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_GetBoundaryDimensions(
    ovrSession session,
    ovrBoundaryType boundaryType,
    ovrVector3f* outDimensions);

OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetBoundaryVisible(ovrSession session, ovrBool* outIsVisible);

OVR_PUBLIC_FUNCTION(ovrResult) ovr_RequestBoundaryVisible(ovrSession session, ovrBool visible);

// -----------------------------------------------------------------------------------

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_GetExternalCameras(
    ovrSession session,
    ovrExternalCamera* cameras,
unsignedint* inoutCameraCount);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_SetExternalCameraProperties(
    ovrSession session,
constchar* name,
const ovrCameraIntrinsics* const intrinsics,
const ovrCameraExtrinsics* const extrinsics);


#endif // !defined(OVR_EXPORTING_CAPI)

//-------------------------------------------------------------------------------------
// @name Layers
//

enum { ovrMaxLayerCount = 16 };

typedefenum ovrLayerType_ {
  ovrLayerType_Disabled = 0,

  ovrLayerType_EyeFov = 1,

  ovrLayerType_EyeFovDepth = 2,

  ovrLayerType_Quad = 3,

// enum 4 used to be ovrLayerType_QuadHeadLocked. Instead, use ovrLayerType_Quad with
// ovrLayerFlag_HeadLocked.

  ovrLayerType_EyeMatrix = 5,


  ovrLayerType_EyeFovMultires = 7,

  ovrLayerType_Cylinder = 8,

  ovrLayerType_Cube = 10,



  ovrLayerType_EnumSize = 0x7fffffff 

} ovrLayerType;

typedefenum ovrLayerFlags_ {
  ovrLayerFlag_HighQuality = 0x01,

  ovrLayerFlag_TextureOriginAtBottomLeft = 0x02,

  ovrLayerFlag_HeadLocked = 0x04,


  ovrLayerFlags_EnumSize = 0x7fffffff 
} ovrLayerFlags;

typedefstruct ovrLayerHeader_ ovrLayerHeader;
struct OVR_ALIGNAS(OVR_PTR_SIZE) ovrLayerHeader_ {
  ovrLayerType Type; 
unsigned Flags; 

char Reserved[128];
};

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrLayerEyeFov_ {
  ovrLayerHeader Header;

  ovrTextureSwapChain ColorTexture[ovrEye_Count];

  ovrRecti Viewport[ovrEye_Count];

  ovrFovPort Fov[ovrEye_Count];

  ovrPosef RenderPose[ovrEye_Count];

double SensorSampleTime;
} ovrLayerEyeFov;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrLayerEyeFovDepth_ {
  ovrLayerHeader Header;

  ovrTextureSwapChain ColorTexture[ovrEye_Count];

  ovrRecti Viewport[ovrEye_Count];

  ovrFovPort Fov[ovrEye_Count];

  ovrPosef RenderPose[ovrEye_Count];

double SensorSampleTime;

  ovrTextureSwapChain DepthTexture[ovrEye_Count];

  ovrTimewarpProjectionDesc ProjectionDesc;
} ovrLayerEyeFovDepth;


typedefenum ovrTextureLayout_ {
  ovrTextureLayout_Rectilinear = 0, 
  ovrTextureLayout_Octilinear = 1, 
  ovrTextureLayout_EnumSize = 0x7fffffff 
} ovrTextureLayout;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrTextureLayoutOctilinear_ {
// W warping
float WarpLeft;
float WarpRight;
float WarpUp;
float WarpDown;

// Size of W quadrants.
//
// SizeLeft + SizeRight <= Viewport.Size.w
// SizeUp   + sizeDown  <= Viewport.Size.h
//
// Clip space (0,0) is located at Viewport.Pos + (SizeLeft,SizeUp) where
// Viewport is given in the layer description.
//
// Viewport Top left
// +-----------------------------------------------------+
// |                        ^                       |    |
// |                        |                       |    |
// |           0          SizeUp         1          |    |
// |                        |                       |<--Portion of viewport
// |                        |                       |   determined by sizes
// |                        |                       |    |
// |<--------SizeLeft-------+-------SizeRight------>|    |
// |                        |                       |    |
// |                        |                       |    |
// |           2         SizeDown        3          |    |
// |                        |                       |    |
// |                        |                       |    |
// |                        v                       |    |
// +------------------------------------------------+    |
// |                                                     |
// +-----------------------------------------------------+
//                                                       Viewport bottom right
//
// For example, when rendering quadrant 0 its scissor rectangle will be
//
//  Top    = 0
//  Left   = 0
//  Right  = SizeLeft
//  Bottom = SizeUp
//
// and the scissor rectangle for quadrant 1 will be:
//
//  Top    = 0
//  Left   = SizeLeft
//  Right  = SizeLeft + SizeRight
//  Bottom = SizeUp
//
float SizeLeft;
float SizeRight;
float SizeUp;
float SizeDown;

} ovrTextureLayoutOctilinear;

typedefunion OVR_ALIGNAS(OVR_PTR_SIZE) ovrTextureLayoutDesc_Union_ {
  ovrTextureLayoutOctilinear Octilinear[ovrEye_Count];
} ovrTextureLayoutDesc_Union;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrLayerEyeFovMultires_ {
  ovrLayerHeader Header;

  ovrTextureSwapChain ColorTexture[ovrEye_Count];

  ovrRecti Viewport[ovrEye_Count];

  ovrFovPort Fov[ovrEye_Count];

  ovrPosef RenderPose[ovrEye_Count];

double SensorSampleTime;

  ovrTextureLayout TextureLayout;

  ovrTextureLayoutDesc_Union TextureLayoutDesc;
} ovrLayerEyeFovMultires;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrLayerEyeMatrix_ {
  ovrLayerHeader Header;

  ovrTextureSwapChain ColorTexture[ovrEye_Count];

  ovrRecti Viewport[ovrEye_Count];

  ovrPosef RenderPose[ovrEye_Count];

  ovrMatrix4f Matrix[ovrEye_Count];

double SensorSampleTime;
} ovrLayerEyeMatrix;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrLayerQuad_ {
  ovrLayerHeader Header;

  ovrTextureSwapChain ColorTexture;

  ovrRecti Viewport;

  ovrPosef QuadPoseCenter;

  ovrVector2f QuadSize;
} ovrLayerQuad;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrLayerCylinder_ {
  ovrLayerHeader Header;

  ovrTextureSwapChain ColorTexture;

  ovrRecti Viewport;

  ovrPosef CylinderPoseCenter;

float CylinderRadius;

float CylinderAngle;

float CylinderAspectRatio;
} ovrLayerCylinder;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrLayerCube_ {
  ovrLayerHeader Header;

  ovrQuatf Orientation;

  ovrTextureSwapChain CubeMapTexture;
} ovrLayerCube;



typedefunion ovrLayer_Union_ {
  ovrLayerHeader Header;
  ovrLayerEyeFov EyeFov;
  ovrLayerEyeFovDepth EyeFovDepth;
  ovrLayerQuad Quad;
  ovrLayerEyeMatrix EyeMatrix;
  ovrLayerEyeFovMultires Multires;
  ovrLayerCylinder Cylinder;
  ovrLayerCube Cube;
} ovrLayer_Union;


#if !defined(OVR_EXPORTING_CAPI)




OVR_PUBLIC_FUNCTION(ovrResult)
ovr_GetTextureSwapChainLength(ovrSession session, ovrTextureSwapChain chain, int* out_Length);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_GetTextureSwapChainCurrentIndex(ovrSession session, ovrTextureSwapChain chain, int* out_Index);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_GetTextureSwapChainDesc(
    ovrSession session,
    ovrTextureSwapChain chain,
    ovrTextureSwapChainDesc* out_Desc);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_CommitTextureSwapChain(ovrSession session, ovrTextureSwapChain chain);

OVR_PUBLIC_FUNCTION(void)
ovr_DestroyTextureSwapChain(ovrSession session, ovrTextureSwapChain chain);


OVR_PUBLIC_FUNCTION(void)
ovr_DestroyMirrorTexture(ovrSession session, ovrMirrorTexture mirrorTexture);

OVR_PUBLIC_FUNCTION(ovrSizei)
ovr_GetFovTextureSize(
    ovrSession session,
    ovrEyeType eye,
    ovrFovPort fov,
float pixelsPerDisplayPixel);

OVR_PUBLIC_FUNCTION(ovrEyeRenderDesc)
ovr_GetRenderDesc(ovrSession session, ovrEyeType eyeType, ovrFovPort fov);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_WaitToBeginFrame(ovrSession session, longlong frameIndex);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_BeginFrame(ovrSession session, longlong frameIndex);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_EndFrame(
    ovrSession session,
longlong frameIndex,
const ovrViewScaleDesc* viewScaleDesc,
    ovrLayerHeader const* const* layerPtrList,
unsignedint layerCount);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_SubmitFrame(
    ovrSession session,
longlong frameIndex,
const ovrViewScaleDesc* viewScaleDesc,
    ovrLayerHeader const* const* layerPtrList,
unsignedint layerCount);


#endif // !defined(OVR_EXPORTING_CAPI)

//-------------------------------------------------------------------------------------


typedefstruct OVR_ALIGNAS(4) ovrPerfStatsPerCompositorFrame_ {
int HmdVsyncIndex;


int AppFrameIndex;

int AppDroppedFrameCount;

float AppMotionToPhotonLatency;

float AppQueueAheadTime;

float AppCpuElapsedTime;

float AppGpuElapsedTime;


int CompositorFrameIndex;

int CompositorDroppedFrameCount;

float CompositorLatency;

float CompositorCpuElapsedTime;

float CompositorGpuElapsedTime;

float CompositorCpuStartToGpuEndElapsedTime;

float CompositorGpuEndToVsyncElapsedTime;


  ovrBool AswIsActive;

int AswActivatedToggleCount;

int AswPresentedFrameCount;

int AswFailedFrameCount;

} ovrPerfStatsPerCompositorFrame;

enum { ovrMaxProvidedFrameStats = 5 };

typedefstruct OVR_ALIGNAS(4) ovrPerfStats_ {
  ovrPerfStatsPerCompositorFrame FrameStats[ovrMaxProvidedFrameStats];
int FrameStatsCount;

  ovrBool AnyFrameStatsDropped;

float AdaptiveGpuPerformanceScale;

  ovrBool AswIsAvailable;

  ovrProcessId VisibleProcessId;
} ovrPerfStats;

#if !defined(OVR_EXPORTING_CAPI)

OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetPerfStats(ovrSession session, ovrPerfStats* outStats);

OVR_PUBLIC_FUNCTION(ovrResult) ovr_ResetPerfStats(ovrSession session);

OVR_PUBLIC_FUNCTION(double) ovr_GetPredictedDisplayTime(ovrSession session, longlong frameIndex);

OVR_PUBLIC_FUNCTION(double) ovr_GetTimeInSeconds();

#endif // !defined(OVR_EXPORTING_CAPI)

typedefenum ovrPerfHudMode_ {
  ovrPerfHud_Off = 0, 
  ovrPerfHud_PerfSummary = 1, 
  ovrPerfHud_LatencyTiming = 2, 
  ovrPerfHud_AppRenderTiming = 3, 
  ovrPerfHud_CompRenderTiming = 4, 
  ovrPerfHud_AswStats = 6, 
  ovrPerfHud_VersionInfo = 5, 
  ovrPerfHud_Count = 7, 
  ovrPerfHud_EnumSize = 0x7fffffff 
} ovrPerfHudMode;

typedefenum ovrLayerHudMode_ {
  ovrLayerHud_Off = 0, 
  ovrLayerHud_Info = 1, 
  ovrLayerHud_EnumSize = 0x7fffffff
} ovrLayerHudMode;


typedefenum ovrDebugHudStereoMode_ {
  ovrDebugHudStereo_Off = 0,

  ovrDebugHudStereo_Quad = 1,

  ovrDebugHudStereo_QuadWithCrosshair = 2,

  ovrDebugHudStereo_CrosshairAtInfinity = 3,

  ovrDebugHudStereo_Count,

  ovrDebugHudStereo_EnumSize = 0x7fffffff 
} ovrDebugHudStereoMode;

#if !defined(OVR_EXPORTING_CAPI)

// -----------------------------------------------------------------------------------


OVR_PUBLIC_FUNCTION(ovrBool)
ovr_GetBool(ovrSession session, constchar* propertyName, ovrBool defaultVal);

OVR_PUBLIC_FUNCTION(ovrBool)
ovr_SetBool(ovrSession session, constchar* propertyName, ovrBool value);

OVR_PUBLIC_FUNCTION(int) ovr_GetInt(ovrSession session, constchar* propertyName, int defaultVal);

OVR_PUBLIC_FUNCTION(ovrBool) ovr_SetInt(ovrSession session, constchar* propertyName, int value);

OVR_PUBLIC_FUNCTION(float)
ovr_GetFloat(ovrSession session, constchar* propertyName, float defaultVal);

OVR_PUBLIC_FUNCTION(ovrBool)
ovr_SetFloat(ovrSession session, constchar* propertyName, float value);

OVR_PUBLIC_FUNCTION(unsignedint)
ovr_GetFloatArray(
    ovrSession session,
constchar* propertyName,
float values[],
unsignedint valuesCapacity);

OVR_PUBLIC_FUNCTION(ovrBool)
ovr_SetFloatArray(
    ovrSession session,
constchar* propertyName,
constfloat values[],
unsignedint valuesSize);

OVR_PUBLIC_FUNCTION(constchar*)
ovr_GetString(ovrSession session, constchar* propertyName, constchar* defaultVal);

OVR_PUBLIC_FUNCTION(ovrBool)
ovr_SetString(ovrSession session, constchar* propertyName, constchar* value);


#endif // !defined(OVR_EXPORTING_CAPI)

#ifdef __cplusplus
} // extern "C"
#endif

#if defined(_MSC_VER)
#pragma warning(pop)
#endif



OVR_STATIC_ASSERT(
sizeof(ovrTextureSwapChainDesc) == 10 * 4,
"ovrTextureSwapChainDesc size mismatch");

// -----------------------------------------------------------------------------------
// ***** Backward compatibility #includes
//
// This is at the bottom of this file because the following is dependent on the
// declarations above.

#if !defined(OVR_CAPI_NO_UTILS)
#include "Extras/OVR_CAPI_Util.h"
#endif


#endif // OVR_CAPI_h
The documentation for this file was generated from the following file: Include/OVR_CAPI.h