Qualcomm© Snapdragon™ VR SDK  3.0.2
Classes | Namespaces | Macros | Enumerations | Functions
sxrApi.h File Reference
#include <stdlib.h>
#include <jni.h>

Go to the source code of this file.

Classes

struct  sxrVector2
 Simple structure to hold 2-component vector data. More...
 
struct  sxrVector3
 Simple structure to hold 3-component vector data. More...
 
struct  sxrVector4
 Simple structure to hold 4-component vector data. More...
 
struct  sxrQuaternion
 Simple structure to hold quaternion data. More...
 
struct  sxrMatrix4
 Simple structure to hold 4x4 matrix data. More...
 
struct  sxrHeadPose
 Structure containing the position and orientation of the head. More...
 
struct  sxrHeadPoseState
 Structure containing the full set of pose data. More...
 
struct  sxrEyePoseState
 Structure containing the eye tracking data. More...
 
struct  sxrBeginParams
 Structure containing parameters needed to enable VR mode. More...
 
struct  sxrVulkanTexInfo
 Information about texture if type is kTypeVulkan. More...
 
struct  sxrLayoutCoords
 Render layer screen position and UV coordinates. More...
 
struct  sxrRenderLayer
 Description of render layers. More...
 
struct  sxrFrameParams
 Per-frame data needed for time warp, distortion/aberration correction. More...
 
struct  sxrInitParams
 Initialization parameters that are constant over the life-cycle of the application. More...
 
struct  sxrViewFrustum
 View Frustum. These values are based on physical device properties, except the far plane is arbitrary. More...
 
struct  sxrFoveation
 
struct  sxrDeviceInfo
 Basic device information to allow the client code to optimally setup their simulation and rendering pipelines. More...
 
struct  sxrEventData_Thermal
 
union  sxrEventData
 
struct  sxrEvent
 
struct  sxrControllerState
 
struct  sxrControllerCaps
 

Namespaces

 sxrControllerTouch
 Controller Touch button enumerations.
 
 sxrControllerAxis1D
 Controller Trigger enumerations.
 
 sxrControllerAxis2D
 Controller Joystick enumerations.
 
 sxrControllerButton
 Controller Button enumerations.
 

Macros

#define SXR_MAJOR_VERSION   3
 
#define SXR_MINOR_VERSION   0
 
#define SXR_REVISION_VERSION   2
 
#define SXR_MAX_RENDER_LAYERS   16
 
#define SXRP_EXPORT
 

Enumerations

enum  SxrResult {
  SXR_ERROR_NONE = 0, SXR_ERROR_UNKNOWN = 1, SXR_ERROR_UNSUPPORTED, SXR_ERROR_VRMODE_NOT_INITIALIZED,
  SXR_ERROR_VRMODE_NOT_STARTED, SXR_ERROR_VRMODE_NOT_STOPPED, SXR_ERROR_QVR_SERVICE_UNAVAILABLE, SXR_ERROR_JAVA_ERROR
}
 
enum  sxrEventType {
  kEventNone = 0, kEventSdkServiceStarting = 1, kEventSdkServiceStarted = 2, kEventSdkServiceStopped = 3,
  kEventControllerConnecting = 4, kEventControllerConnected = 5, kEventControllerDisconnected = 6, kEventThermal = 7,
  kEventVrModeStarted = 8, kEventVrModeStopping = 9, kEventVrModeStopped = 10, kEventSensorError = 11,
  kEventMagnometerUncalibrated = 12, kEventBoundarySystemCollision = 13, kEvent6dofRelocation = 14, kEvent6dofWarningFeatureCount = 15,
  kEvent6dofWarningLowLight = 16, kEvent6dofWarningBrightLight = 17, kEvent6dofWarningCameraCalibration = 18
}
 Events.
 
enum  sxrWhichEye { kLeftEye = 0, kRightEye, kNumEyes }
 Enum used to indicate which eye is being used.
 
enum  sxrEyeMask { kEyeMaskLeft = 0x00000001, kEyeMaskRight = 0x00000002, kEyeMaskBoth = 0x00000003 }
 Enum used to indicate which eye to apply a render layer.
 
enum  sxrLayerFlags { kLayerFlagNone = 0x00000000, kLayerFlagHeadLocked = 0x00000001, kLayerFlagOpaque = 0x00000002 }
 Enum used to indicate flags passed as part of a render layer.
 
enum  sxrColorSpace { kColorSpaceLinear = 0, kColorSpaceSRGB = 1, kNumColorSpaces }
 
enum  sxrTrackingMode { kTrackingRotation = (1 << 0), kTrackingPosition = (1 << 1), kTrackingEye = (1 << 2) }
 Enum used to indicate valid components of an pose state.
 
enum  sxrEyePoseStatus {
  kGazePointValid = (1 << 0), kGazeVectorValid = (1 << 1), kEyeOpennessValid = (1 << 2), kEyePupilDilationValid = (1 << 3),
  kEyePositionGuideValid = (1 << 4)
}
 Structure containing flags indicating data valididty of an eye pose.
 
enum  sxrPerfLevel {
  kPerfSystem = 0, kPerfMinimum = 1, kPerfMedium = 2, kPerfMaximum = 3,
  kNumPerfLevels
}
 Enum used for indicating the CPU/GPU performance levels. More...
 
enum  sxrOptionFlags { kProtectedContent = (1 << 0), kMotionAwareFrames = (1 << 1) }
 Flags used to set SXR options.
 
enum  sxrFrameOption { kDisableDistortionCorrection = ( 1 << 0 ), kDisableReprojection = ( 1 << 1 ), kEnableMotionToPhoton = ( 1 << 2 ), kDisableChromaticCorrection = ( 1 << 3 ) }
 Options which can be set when submitting a frame to modify the behavior of asynchronous time warp. More...
 
enum  sxrTextureType {
  kTypeTexture = 0, kTypeTextureArray, kTypeImage, kTypeEquiRectTexture,
  kTypeEquiRectImage, kTypeCubemapTexture, kTypeVulkan
}
 Enum used to indicate the type of texture passed in as a render layer. More...
 
enum  sxrWarpType { kSimple }
 Enum used to indicate the type of warp/composition that should be used for a frame. More...
 
enum  sxrWarpMeshType { kMeshTypeColumsLtoR = 0, kMeshTypeColumsRtoL, kMeshTypeRowsTtoB, kMeshTypeRowsBtoT }
 Enumeration of possible warp mesh types. More...
 
enum  sxrWarpMeshEnum {
  kMeshEnumLeft = 0, kMeshEnumRight, kMeshEnumUL, kMeshEnumUR,
  kMeshEnumLL, kMeshEnumLR, kWarpMeshCount
}
 Enumeration of possible warp meshes. More...
 
enum  sxrThermalLevel {
  kSafe, kLevel1, kLevel2, kLevel3,
  kCritical, kNumThermalLevels
}
 
enum  sxrThermalZone { kCpu, kGpu, kSkin, kNumThermalZones }
 
enum  sxrControllerMessageType { kControllerMessageRecenter = 0, kControllerMessageVibration = 1 }
 Events to use in sxrControllerSendMessage.
 
enum  sxrControllerQueryType { kControllerQueryBatteryRemaining = 0, kControllerQueryControllerCaps = 1 }
 Query Values.
 
enum  sxrControllerConnectionState {
  kNotInitialized = 0, kDisconnected = 1, kConnected = 2, kConnecting = 3,
  kError = 4
}
 Controller Connection state.
 
enum  {
  None = 0x00000000, One = 0x00000001, Two = 0x00000002, Three = 0x00000004,
  Four = 0x00000008, PrimaryThumbstick = 0x00000010, SecondaryThumstick = 0x00000020, Any = ~None
}
 
enum  { PrimaryIndexTrigger = 0x00000000, SecondaryIndexTrigger = 0x00000001, PrimaryHandTrigger = 0x00000002, SecondaryHandTrigger = 0x00000003 }
 
enum  { PrimaryThumbstick = 0x00000000, SecondaryThumbstick = 0x00000001 }
 
enum  {
  None = 0x00000000, One = 0x00000001, Two = 0x00000002, Three = 0x00000004,
  Four = 0x00000008, DpadUp = 0x00000010, DpadDown = 0x00000020, DpadLeft = 0x00000040,
  DpadRight = 0x00000080, Start = 0x00000100, Back = 0x00000200, PrimaryShoulder = 0x00001000,
  PrimaryIndexTrigger = 0x00002000, PrimaryHandTrigger = 0x00004000, PrimaryThumbstick = 0x00008000, PrimaryThumbstickUp = 0x00010000,
  PrimaryThumbstickDown = 0x00020000, PrimaryThumbstickLeft = 0x00040000, PrimaryThumbstickRight = 0x00080000, SecondaryShoulder = 0x00100000,
  SecondaryIndexTrigger = 0x00200000, SecondaryHandTrigger = 0x00400000, SecondaryThumbstick = 0x00800000, SecondaryThumbstickUp = 0x01000000,
  SecondaryThumbstickDown = 0x02000000, SecondaryThumbstickLeft = 0x04000000, SecondaryThumbstickRight = 0x08000000, Up = 0x10000000,
  Down = 0x20000000, Left = 0x40000000, Right = 0x80000000, Any = ~None
}
 

Functions

SXRP_EXPORT const char * sxrGetVersion ()
 Returns the VR SDK version string.
 
SXRP_EXPORT SxrResult sxrGetXrServiceVersion (char *pRetBuffer, int bufferSize)
 Returns the VR service version string.
 
SXRP_EXPORT SxrResult sxrGetXrClientVersion (char *pRetBuffer, int bufferSize)
 Returns the VR client version string.
 
SXRP_EXPORT SxrResult sxrInitialize (const sxrInitParams *pInitParams)
 Initializes VR components. More...
 
SXRP_EXPORT SxrResult sxrShutdown ()
 Releases VR components.
 
SXRP_EXPORT sxrDeviceInfo sxrGetDeviceInfo ()
 Queries for device specific information. More...
 
SXRP_EXPORT SxrResult sxrSetPerformanceLevels (sxrPerfLevel cpuPerfLevel, sxrPerfLevel gpuPerfLevel)
 Requests specific brackets of CPU/GPU performance. More...
 
SXRP_EXPORT SxrResult sxrBeginXr (const sxrBeginParams *pBeginParams)
 Enables XR services. More...
 
SXRP_EXPORT SxrResult sxrEndXr ()
 Disables XR services.
 
SXRP_EXPORT float sxrGetPredictedDisplayTime ()
 Calculates a predicted time when the current frame would be displayed. Assumes a pipeline depth of 1. More...
 
SXRP_EXPORT float sxrGetPredictedDisplayTimePipelined (unsigned int depth)
 Calculates a predicted time when the current frame would be displayed. Allows for specifying the current depth of the pipeline. More...
 
SXRP_EXPORT sxrHeadPoseState sxrGetPredictedHeadPose (float predictedTimeMs)
 Calculates a predicted head pose. More...
 
SXRP_EXPORT sxrHeadPoseState sxrGetHistoricHeadPose (int64_t timestampNs)
 Retrieves a historic head pose. More...
 
SXRP_EXPORT SxrResult sxrGetEyePose (sxrEyePoseState *pReturnPose)
 Retrieves a current eye pose. More...
 
SXRP_EXPORT SxrResult sxrRecenterPose ()
 Recenters the head position and orientation at the current values.
 
SXRP_EXPORT SxrResult sxrRecenterPosition ()
 Recenters the head position at the current position.
 
SXRP_EXPORT SxrResult sxrRecenterOrientation (bool yawOnly=true)
 Recenters the head orientation (Yaw only) at the current value.
 
SXRP_EXPORT uint32_t sxrGetSupportedTrackingModes ()
 Returns the supported tracking types. More...
 
SXRP_EXPORT SxrResult sxrSetTrackingMode (uint32_t trackingModes)
 Sets the current head tracking mode. More...
 
SXRP_EXPORT uint32_t sxrGetTrackingMode ()
 Returns the current head tracking mode. More...
 
SXRP_EXPORT bool sxrPollEvent (sxrEvent *pEvent)
 Polls for an available event. If event(s) are present pEvent will be filled with the event details. More...
 
SXRP_EXPORT SxrResult sxrBeginEye (sxrWhichEye whichEye, sxrTextureType imageType=kTypeTexture)
 Called after eye buffer is bound but before game rendering starts. More...
 
SXRP_EXPORT SxrResult sxrEndEye (sxrWhichEye whichEye, sxrTextureType imageType=kTypeTexture)
 Called after eye buffer is rendered but before frame is submitted. More...
 
SXRP_EXPORT SxrResult sxrSubmitFrame (const sxrFrameParams *pFrameParams)
 Submits a frame to asynchronous time warp. More...
 
SXRP_EXPORT int sxrControllerStartTracking (const char *controllerDesc)
 Starts Tracking. More...
 
SXRP_EXPORT void sxrControllerStopTracking (int controllerHandle)
 Stops tracking the controller. More...
 
SXRP_EXPORT sxrControllerState sxrControllerGetState (int controllerHandle, int controllerSpace=0)
 Get the current state of the controller. More...
 
SXRP_EXPORT void sxrControllerSendMessage (int controllerHandle, int what, int arg1, int arg2)
 Send a message to the controller. More...
 
SXRP_EXPORT int sxrControllerQuery (int controllerHandle, int what, void *memory, unsigned int memorySize)
 make a query to the controller More...
 
SXRP_EXPORT SxrResult sxrSetWarpMesh (sxrWarpMeshEnum whichMesh, void *pVertexData, int vertexSize, int nVertices, unsigned int *pIndices, int nIndices)
 Replaces the current Time Warp mesh the supplied mesh. More...
 
SXRP_EXPORT SxrResult sxrGetOcclusionMesh (sxrWhichEye whichEye, int *pTriangleCount, int *pVertexStride, float *pTriangles)
 Gets triangle data for the occlusion area mesh. More...
 
SXRP_EXPORT bool sxrIsBoundarySystemEnabled ()
 Check whether the Boundary system is enabled. More...
 
SXRP_EXPORT void sxrEnableBoundarySystem (bool enableBoundary=true)
 Enable/Disable the Boundary system. More...
 
SXRP_EXPORT void sxrForceDisplayBoundarySystem (bool forceDisplayBoundary=true)
 Enable/Disable the forced display of Boundary system. More...
 
SXRP_EXPORT SxrResult sxrSetBoundaryParameters (float *pMinValues, float *pMaxValues, float visibilityRadius)
 Set parameters for the Boundary system. More...
 
SXRP_EXPORT SxrResult sxrGetBoundaryParameters (float *pMinValues, float *pMaxValues, float *pVisibilityRadius)
 Get parameters for the Boundary system. More...
 

Enumeration Type Documentation

Options which can be set when submitting a frame to modify the behavior of asynchronous time warp.

See also
sxrSubmitFrame
Enumerator
kDisableDistortionCorrection 

Disables the lens distortion correction (useful for debugging)

kDisableReprojection 

Disables re-projection.

kEnableMotionToPhoton 

Enables motion to photon testing.

kDisableChromaticCorrection 

Disables the lens chromatic aberration correction (performance optimization)

Enum used for indicating the CPU/GPU performance levels.

See also
sxrBeginVr, sxrSetPerformanceLevels
Enumerator
kPerfSystem 

System defined performance level (default)

kPerfMinimum 

Minimum performance level.

kPerfMedium 

Medium performance level.

kPerfMaximum 

Maximum performance level.

Enum used to indicate the type of texture passed in as a render layer.

See also
sxrSubmitFrame
Enumerator
kTypeTexture 

Standard texture.

kTypeTextureArray 

Standard texture array (Left eye is first layer, right eye is second layer)

kTypeImage 

EGL Image texture.

kTypeEquiRectTexture 

Equirectangular texture.

kTypeEquiRectImage 

Equirectangular Image texture.

kTypeCubemapTexture 

Cubemap texture (Not supporting cubemap image)

kTypeVulkan 

Vulkan texture.

Enumeration of possible warp meshes.

See also
sxrSetWarpMesh, sxrWarpMeshType

Enumeration of possible warp mesh types.

See also
sxrDeviceInfo

Enum used to indicate the type of warp/composition that should be used for a frame.

Enumerator
kSimple 

Basic single layer (world) warp.

Function Documentation

SXRP_EXPORT SxrResult sxrBeginEye ( sxrWhichEye  whichEye,
sxrTextureType  imageType = kTypeTexture 
)

Called after eye buffer is bound but before game rendering starts.

Parameters
whichEyeWhich eye is being rendered
imageTypeType of eye render buffer
SXRP_EXPORT SxrResult sxrBeginXr ( const sxrBeginParams pBeginParams)

Enables XR services.

Parameters
pBeginParamssxrBeginParams structure
SXRP_EXPORT sxrControllerState sxrControllerGetState ( int  controllerHandle,
int  controllerSpace = 0 
)

Get the current state of the controller.

Parameters
controllerHandlehandle for the controller
SXRP_EXPORT int sxrControllerQuery ( int  controllerHandle,
int  what,
void *  memory,
unsigned int  memorySize 
)

make a query to the controller

Parameters
controllerHandlehandle for the controller
whatinfo
memorymemory to fill in
memorySizesize of the memory to fill in
Returns
number of bytes written into the memory
SXRP_EXPORT void sxrControllerSendMessage ( int  controllerHandle,
int  what,
int  arg1,
int  arg2 
)

Send a message to the controller.

Parameters
controllerHandlehandle for the controller
whattype of event
arg1argument for the event
arg2argument for the event
SXRP_EXPORT int sxrControllerStartTracking ( const char *  controllerDesc)

Starts Tracking.

Parameters
controllerDescController Description
Returns
handle for the controller
SXRP_EXPORT void sxrControllerStopTracking ( int  controllerHandle)

Stops tracking the controller.

Parameters
controllerHandlehandle for the controller
SXRP_EXPORT void sxrEnableBoundarySystem ( bool  enableBoundary = true)

Enable/Disable the Boundary system.

Parameters
enableBoundaryWhether to enable or disable the Boundary system
SXRP_EXPORT SxrResult sxrEndEye ( sxrWhichEye  whichEye,
sxrTextureType  imageType = kTypeTexture 
)

Called after eye buffer is rendered but before frame is submitted.

Parameters
whichEyeWhich eye is being rendered
imageTypeType of eye render buffer
SXRP_EXPORT void sxrForceDisplayBoundarySystem ( bool  forceDisplayBoundary = true)

Enable/Disable the forced display of Boundary system.

Parameters
enableBoundaryWhether to enable or disable the forced display of Boundary system
SXRP_EXPORT SxrResult sxrGetBoundaryParameters ( float *  pMinValues,
float *  pMaxValues,
float *  pVisibilityRadius 
)

Get parameters for the Boundary system.

Parameters
pMinValuesReal world minimum physical boundaries (Meters. 0 = X-Position; 1 = Y-Position; 2 = Z-Position)
pMaxValuesReal world maximum physical boundaries (Meters. 0 = X-Position; 1 = Y-Position; 2 = Z-Position)
pVisibilityRadiusDistance from physical boundaries when visual notification starts to appear
Returns
SXR_ERROR_NONE for success; SXR_ERROR_UNKNOWN for any other error
SXRP_EXPORT sxrDeviceInfo sxrGetDeviceInfo ( )

Queries for device specific information.

Returns
sxrDeviceInfo structure containing device specific information (resolution, fov, etc..)
SXRP_EXPORT SxrResult sxrGetEyePose ( sxrEyePoseState pReturnPose)

Retrieves a current eye pose.

Returns
The eye pose
SXRP_EXPORT sxrHeadPoseState sxrGetHistoricHeadPose ( int64_t  timestampNs)

Retrieves a historic head pose.

Parameters
predictedTimeMsTime in ns to retrieve a head pose for
Returns
The head pose and relevant pose state information
SXRP_EXPORT SxrResult sxrGetOcclusionMesh ( sxrWhichEye  whichEye,
int *  pTriangleCount,
int *  pVertexStride,
float *  pTriangles 
)

Gets triangle data for the occlusion area mesh.

Parameters
whichEyewhich eye to get the occlusion mesh for
nTriangleCountthe number of triangles needed for the mesh, set to required size if pTriangles == NULL
pTrianglesbuffer to store occlusion mesh data
Returns
SXR_ERROR_NONE for success; SXR_ERROR_UNKNOWN for any other error
SXRP_EXPORT float sxrGetPredictedDisplayTime ( )

Calculates a predicted time when the current frame would be displayed. Assumes a pipeline depth of 1.

Returns
Predicted display time for the current frame in milliseconds
SXRP_EXPORT float sxrGetPredictedDisplayTimePipelined ( unsigned int  depth)

Calculates a predicted time when the current frame would be displayed. Allows for specifying the current depth of the pipeline.

Returns
Predicted display time for the current frame in milliseconds
SXRP_EXPORT sxrHeadPoseState sxrGetPredictedHeadPose ( float  predictedTimeMs)

Calculates a predicted head pose.

Parameters
predictedTimeMsTime ahead of the current time in ms to predict a head pose for
Returns
The predicted head pose and relevant pose state information
SXRP_EXPORT uint32_t sxrGetSupportedTrackingModes ( )

Returns the supported tracking types.

Returns
Bitfield of sxrTrackingType values indicating the supported tracking modes
SXRP_EXPORT uint32_t sxrGetTrackingMode ( )

Returns the current head tracking mode.

Returns
trackingMode Bitfield of sxrTrackingType values indicating the tracking modes enabled
SXRP_EXPORT SxrResult sxrInitialize ( const sxrInitParams pInitParams)

Initializes VR components.

Parameters
pInitParamssxrInitParams structure
SXRP_EXPORT bool sxrIsBoundarySystemEnabled ( )

Check whether the Boundary system is enabled.

Returns
True/False for Enabled/Disabled
SXRP_EXPORT bool sxrPollEvent ( sxrEvent pEvent)

Polls for an available event. If event(s) are present pEvent will be filled with the event details.

Returns
true if an event was present, false if not
SXRP_EXPORT SxrResult sxrSetBoundaryParameters ( float *  pMinValues,
float *  pMaxValues,
float  visibilityRadius 
)

Set parameters for the Boundary system.

Parameters
pMinValuesReal world minimum physical boundaries (Meters. 0 = X-Position; 1 = Y-Position; 2 = Z-Position)
pMaxValuesReal world maximum physical boundaries (Meters. 0 = X-Position; 1 = Y-Position; 2 = Z-Position)
visibilityRadiusDistance from physical boundaries when visual notification starts to appear
Returns
SXR_ERROR_NONE for success; SXR_ERROR_UNKNOWN for any other error
SXRP_EXPORT SxrResult sxrSetPerformanceLevels ( sxrPerfLevel  cpuPerfLevel,
sxrPerfLevel  gpuPerfLevel 
)

Requests specific brackets of CPU/GPU performance.

Parameters
cpuPerfLevelRequested performance level for CPU
gpuPerfLevelRequested performance level for GPU
SXRP_EXPORT SxrResult sxrSetTrackingMode ( uint32_t  trackingModes)

Sets the current head tracking mode.

Parameters
trackingModesBitfield of sxrTrackingType values indicating the tracking modes to enable
SXRP_EXPORT SxrResult sxrSetWarpMesh ( sxrWarpMeshEnum  whichMesh,
void *  pVertexData,
int  vertexSize,
int  nVertices,
unsigned int *  pIndices,
int  nIndices 
)

Replaces the current Time Warp mesh the supplied mesh.

Parameters
whichMeshWhich mesh is to be replaced
pVertexData15 float values per vertex: Position = 3; R|G|B UV values 4 each (Fourth value is Vignette multiplier [0,1]). NULL reverts the override.
vertexSizeSize of pVertexData
nVerticesNumber of vertices contained in pVertexData
pIndicesPointer to indice data. Expected to be used with GL_TRIANGLES
nIndicesNumber of indices contained in pIndices. Expected to be used with GL_TRIANGLES
Returns
SXR_ERROR_NONE for success; SXR_ERROR_UNSUPPORTED if vertexSize is incorrect; SXR_ERROR_UNKNOWN for any other error
See also
sxrWarpMeshType, sxrWarpMeshEnum
SXRP_EXPORT SxrResult sxrSubmitFrame ( const sxrFrameParams pFrameParams)

Submits a frame to asynchronous time warp.

Parameters
pFrameParamssxrFrameParams structure