Varjo Native SDK
Varjo.h File Reference

Go to the source code of this file.

Functions

varjo_Bool varjo_IsAvailable ()
 Checks whether Varjo system is available. More...
 
const char * varjo_GetVersionString ()
 Gets the short version of the runtime. More...
 
const uint64_t varjo_GetVersion ()
 Gets the version number of the runtime. More...
 
struct varjo_Session * varjo_SessionInit (void)
 Initializes a Varjo client session. More...
 
void varjo_SessionShutDown (struct varjo_Session *session)
 Shuts down a session and releases all the resources internally allocated by Varjo session. More...
 
void varjo_SessionSetPriority (struct varjo_Session *session, int32_t priority)
 Sets session overlay priority. More...
 
varjo_Nanoseconds varjo_GetCurrentTime (struct varjo_Session *session)
 Gets the current time in a format that Varjo API uses. More...
 
struct varjo_FrameInfovarjo_CreateFrameInfo (struct varjo_Session *session)
 Creates a frame info with initial values. More...
 
void varjo_FreeFrameInfo (struct varjo_FrameInfo *frameInfo)
 Frees an allocated frame info. More...
 
void varjo_SetCenteredProjection (struct varjo_Session *session, varjo_Bool enabled)
 Forces the provided projection matrices to be centered. More...
 
int32_t varjo_GetViewCount (struct varjo_Session *session)
 Gets numbers of views. More...
 
struct varjo_AlignedView varjo_GetAlignedView (double *projectionMatrix)
 Gets an aligned view from a projection matrix. More...
 
void varjo_WaitSync (struct varjo_Session *session, struct varjo_FrameInfo *frameInfo)
 Called at the start of a frame. More...
 
varjo_Nanoseconds varjo_FrameGetDisplayTime (struct varjo_Session *session)
 Gets the time when the frame is scheduled to be displayed. More...
 
struct varjo_Matrix varjo_FrameGetPose (struct varjo_Session *session, varjo_PoseType type)
 Gets a pose for the current frame. More...
 
struct varjo_Matrix varjo_GetTrackingToLocalTransform (struct varjo_Session *session)
 Transform from tracking space to local client space. More...
 
struct varjo_Matrix varjo_GetRelativePoseTransform (struct varjo_Session *session, varjo_PoseType src, varjo_PoseType dest)
 Gets a relative transformation from source pose to destination pose. More...
 
struct varjo_Matrix varjo_ApplyTransform (struct varjo_Session *session, struct varjo_Matrix *m1, struct varjo_Matrix *m2)
 Applies transform using post multiplication. More...
 
void varjo_ResetPose (struct varjo_Session *session, varjo_Bool position, varjo_RotationReset rotation)
 Resets pose tracking origin. More...
 
struct varjo_ViewDescription varjo_GetViewDescription (struct varjo_Session *session, int32_t viewIndex)
 Gets the display information for a given view. More...
 
struct varjo_Mesh2Dfvarjo_CreateOcclusionMesh (struct varjo_Session *session, int32_t viewIndex, varjo_WindingOrder windingOrder)
 Creates the occlusion mesh for a given view index. More...
 
void varjo_FreeOcclusionMesh (struct varjo_Mesh2Df *mesh)
 Frees the memory allocated by varjo_CreateOcclusionMesh. More...
 
varjo_Error varjo_GetError (struct varjo_Session *session)
 Gets the latest error code. More...
 
const char * varjo_GetErrorDesc (varjo_Error error)
 Gets error description for the specified error code. More...
 
void varjo_GazeInit (struct varjo_Session *session)
 Initializes the gaze tracking system. More...
 
void varjo_GazeInitWithParameters (struct varjo_Session *session, struct varjo_GazeParameters *parameters, int32_t parameterCount)
 Initializes the gaze tracking system with provided parameters. More...
 
varjo_Bool varjo_IsGazeAllowed (struct varjo_Session *session)
 Is gaze allowed to be used? More...
 
void varjo_RequestGazeCalibration (struct varjo_Session *session)
 Requests a HMD gaze calibration. More...
 
void varjo_RequestGazeCalibrationWithParameters (struct varjo_Session *session, struct varjo_GazeCalibrationParameters *parameters, int32_t parameterCount)
 Requests a HMD gaze calibration with provided parameters. More...
 
struct varjo_Gaze varjo_GetGaze (struct varjo_Session *session)
 Gets the current state of the user gaze. More...
 
int32_t varjo_GetGazeArray (struct varjo_Session *session, struct varjo_Gaze *array, int32_t maxSize)
 Gets gaze measurements since last query. More...
 
void varjo_SyncProperties (struct varjo_Session *session)
 Updates and synchronizes system properties with the system state. More...
 
int32_t varjo_GetPropertyCount (struct varjo_Session *session)
 Gets the number of system properties. More...
 
varjo_PropertyKey varjo_GetPropertyKey (struct varjo_Session *session, int32_t index)
 Gets a property key for a property index. More...
 
const char * varjo_GetPropertyName (struct varjo_Session *session, varjo_PropertyKey propertyKey)
 Gets the name of the property key. More...
 
varjo_Bool varjo_HasProperty (struct varjo_Session *session, varjo_PropertyKey propertyKey)
 Checks if the key has value in the properties. More...
 
varjo_Bool varjo_GetPropertyBool (struct varjo_Session *session, varjo_PropertyKey propertyKey)
 Gets a boolean value of a property. More...
 
double varjo_GetPropertyDouble (struct varjo_Session *session, varjo_PropertyKey propertyKey)
 Gets a floating point value of a property. More...
 
int32_t varjo_GetPropertyInt (struct varjo_Session *session, varjo_PropertyKey propertyKey)
 Gets an integer value of a property. More...
 
void varjo_GetPropertyString (struct varjo_Session *session, varjo_PropertyKey propertyKey, char *buffer, uint32_t maxSize)
 Gets a string value of a property. More...
 
uint32_t varjo_GetPropertyStringSize (struct varjo_Session *session, varjo_PropertyKey propertyKey)
 Gets the size of a buffer that is big enough to hold the property, including the null terminator. More...
 
struct varjo_SwapChainLimits varjo_GetSwapChainLimits (struct varjo_Session *session)
 Gets swap chain limits. More...
 
void varjo_GetSupportedTextureFormats (struct varjo_Session *session, varjo_RenderAPI renderApi, int32_t *formatCount, varjo_TextureFormat *formats)
 Gets supported texture formats in the order of most preferred to least preferred. More...
 
struct varjo_Eventvarjo_AllocateEvent ()
 Allocates an event. More...
 
void varjo_FreeEvent (struct varjo_Event *event)
 Free an event. More...
 
varjo_Bool varjo_PollEvent (struct varjo_Session *session, struct varjo_Event *evt)
 Polls events. More...
 
void varjo_GetTextureSize (struct varjo_Session *session, varjo_TextureSize_Type type, int32_t viewIndex, int32_t *width, int32_t *height)
 Gets texture size for specific varjo_TextureSize_type and view index. More...
 
void varjo_D3D12UpdateVariableRateShadingTexture (struct varjo_Session *session, struct ID3D12GraphicsCommandList *commandList, struct ID3D12Resource *texture, struct varjo_VariableRateShadingConfig *config)
 Creates variable rate shading texture. More...
 
void varjo_D3D11UpdateVariableRateShadingTexture (struct varjo_Session *session, struct ID3D11Device *device, struct ID3D11Texture2D *texture, struct varjo_VariableRateShadingConfig *config, struct varjo_ShadingRateTable *shadingRateTable)
 Updates variable rate shading texture. More...
 
void varjo_GLUpdateVariableRateShadingTexture (struct varjo_Session *session, unsigned int texture, int width, int height, struct varjo_VariableRateShadingConfig *config, struct varjo_ShadingRateTable *shadingRateTable)
 Updates variable rate shading texture. More...
 
varjo_Bool varjo_GetRenderingGaze (struct varjo_Session *session, struct varjo_Gaze *gaze)
 Returns gaze which can be used for foveated rendering or to generate variable rate shading texture. More...
 
struct varjo_FovTangents varjo_GetFoveatedFovTangents (struct varjo_Session *session, int32_t indexView, struct varjo_Gaze *gaze, struct varjo_FoveatedFovTangents_Hints *hints)
 Returns foveated view tangents for a given index and gaze vector. More...
 
struct varjo_FovTangents varjo_GetFovTangents (struct varjo_Session *session, int32_t viewIndex)
 Returns tangents for a given view index. More...
 

Function Documentation

◆ varjo_AllocateEvent()

struct varjo_Event* varjo_AllocateEvent ( )

Allocates an event.

Helper function if you don't want to do the allocation by yourself.

Returns
Allocated event.

◆ varjo_ApplyTransform()

struct varjo_Matrix varjo_ApplyTransform ( struct varjo_Session *  session,
struct varjo_Matrix m1,
struct varjo_Matrix m2 
)

Applies transform using post multiplication.

Parameters
sessionVarjo session handle.
m1First transform.
m2Second transform.
Returns
Second transformation applied to the first one.

◆ varjo_CreateFrameInfo()

struct varjo_FrameInfo* varjo_CreateFrameInfo ( struct varjo_Session *  session)

Creates a frame info with initial values.

Allocates enough data to hold all of the views.

Use varjo_FreeFrameInfo to free the allocated memory.

Parameters
sessionVarjo session handle.
Returns
Frame info.

◆ varjo_CreateOcclusionMesh()

struct varjo_Mesh2Df* varjo_CreateOcclusionMesh ( struct varjo_Session *  session,
int32_t  viewIndex,
varjo_WindingOrder  windingOrder 
)

Creates the occlusion mesh for a given view index.

Due to lens distortion some display pixels are not visible in the optical path so the application can stencil out pixels to reduce shading workload and improve performance.

Mesh data is a triangle list where each triplet of vertices forms a triangle.

Use varjo_FreeOcclusionMesh to free the created mesh.

Parameters
sessionVarjo session handle.
viewIndexView number to get the occlusion mesh for. Must be in range [0, varjo_GetViewCount - 1].
windingOrderWinding order of the triangles
Returns
Occlusion mesh, null if the viewIndex invalid.

◆ varjo_D3D11UpdateVariableRateShadingTexture()

void varjo_D3D11UpdateVariableRateShadingTexture ( struct varjo_Session *  session,
struct ID3D11Device *  device,
struct ID3D11Texture2D *  texture,
struct varjo_VariableRateShadingConfig config,
struct varjo_ShadingRateTable shadingRateTable 
)

Updates variable rate shading texture.

This function will add execution of compute shader which will calculate best possible VRS map based on flags. Function should be executed as late as possible to get most recent gaze. Function should be called as many times as there are views: 4 or 2.

See also
varjo_VariableRateShadingConfig for details.
Parameters
sessionVarjo session handle.
deviceD3D11 device.
textureTexture which will be used as VRS map. Format must be R8 UINT.
configConfiguration flags.
shadingRateTableArray that specifies which shading rate matches which integer value. This is very similar to shading rate table in NV_D3D11_VIEWPORT_SHADING_RATE_DESC_V1.

◆ varjo_D3D12UpdateVariableRateShadingTexture()

void varjo_D3D12UpdateVariableRateShadingTexture ( struct varjo_Session *  session,
struct ID3D12GraphicsCommandList *  commandList,
struct ID3D12Resource *  texture,
struct varjo_VariableRateShadingConfig config 
)

Creates variable rate shading texture.

This function will add execution of compute shader which will calculate best possible VRS map based on flags. Command list should be executed as late as possible to get most recent gaze. Function should be called as many times as there are views: 4 or 2.

Texture has to be in D3D12_RESOURCE_STATE_UNORDERED_ACCESS state.

See also
varjo_VariableRateShadingConfig for details.
Parameters
sessionVarjo session handle.
commandListD3D12 command list.
textureTexture which will be used as VRS map. Format must be R8 UINT.
configConfiguration flags.

◆ varjo_FrameGetDisplayTime()

varjo_Nanoseconds varjo_FrameGetDisplayTime ( struct varjo_Session *  session)

Gets the time when the frame is scheduled to be displayed.

This time refers to the average perceived moment of when the image is shown.

The display time is updated in varjo_WaitSync and is guaranteed to remain constant for the duration of the frame.

This is a helper function for when you don't have access to varjo_FrameInfo.

Parameters
sessionVarjo session handle.
Returns
Nanoseconds since epoch.

◆ varjo_FrameGetPose()

struct varjo_Matrix varjo_FrameGetPose ( struct varjo_Session *  session,
varjo_PoseType  type 
)

Gets a pose for the current frame.

If it's called before varjo_WaitSync() is complete, it will return new pose. Following calls to varjo_FrameGetPose() will return the same matrix. varjo_WaitSync() will also derive it's matrices from that pose. If varjo_FrameGetPose() is called after varjo_WaitSync() it will derive matrices from that pose.

Parameters
sessionVarjo session handle.
typeType of the pose.
Returns
The pose matrix.

◆ varjo_FreeEvent()

void varjo_FreeEvent ( struct varjo_Event event)

Free an event.

Must be allocated with varjo_AllocateEvent.

Parameters
eventEvent to free.

◆ varjo_FreeFrameInfo()

void varjo_FreeFrameInfo ( struct varjo_FrameInfo frameInfo)

Frees an allocated frame info.

Parameters
frameInfoFrame info to free.

◆ varjo_FreeOcclusionMesh()

void varjo_FreeOcclusionMesh ( struct varjo_Mesh2Df mesh)

Frees the memory allocated by varjo_CreateOcclusionMesh.

Parameters
meshOcclusion mesh to free.

◆ varjo_GazeInit()

void varjo_GazeInit ( struct varjo_Session *  session)

Initializes the gaze tracking system.

Parameters
sessionVarjo session handle.

◆ varjo_GazeInitWithParameters()

void varjo_GazeInitWithParameters ( struct varjo_Session *  session,
struct varjo_GazeParameters parameters,
int32_t  parameterCount 
)

Initializes the gaze tracking system with provided parameters.

Parameters
sessionVarjo session handle.
parametersGaze key-value parameters.
parameterCountNumber of parameters provided.

◆ varjo_GetAlignedView()

struct varjo_AlignedView varjo_GetAlignedView ( double *  projectionMatrix)

Gets an aligned view from a projection matrix.

Note: the projection matrix from varjo_FrameInfo might not always be axis aligned.

Parameters
projectionMatrixProjection matrix.
Returns
Aligned view.

◆ varjo_GetCurrentTime()

varjo_Nanoseconds varjo_GetCurrentTime ( struct varjo_Session *  session)

Gets the current time in a format that Varjo API uses.

This is a realtime monotonic counter since system-specific starting point and is not affected by time-of-day setting.

Parameters
sessionVarjo session handle.
Returns
Nanoseconds since epoch.

◆ varjo_GetError()

varjo_Error varjo_GetError ( struct varjo_Session *  session)

Gets the latest error code.

You should check for errors at least once a frame.

Error status will be cleared after this function.

Use varjo_GetErrorDesc to get more detailed error description.

Returns
Error code if there was an error, varjo_NoError if there wasn't.

◆ varjo_GetErrorDesc()

const char* varjo_GetErrorDesc ( varjo_Error  error)

Gets error description for the specified error code.

Returns
Error description string.

◆ varjo_GetFoveatedFovTangents()

struct varjo_FovTangents varjo_GetFoveatedFovTangents ( struct varjo_Session *  session,
int32_t  indexView,
struct varjo_Gaze gaze,
struct varjo_FoveatedFovTangents_Hints hints 
)

Returns foveated view tangents for a given index and gaze vector.

varjo_Error_GazeInvalid error will be set if the provided gaze is not valid.

Parameters
sessionVarjo session handle
indexViewView index in range [0, varjo_GetViewCount() - 1].
gazeA valid gaze, returned by varjo_GetRenderingGaze().
hintsA non-null pointer to a varjo_FoveatedFovTangents_Hints struct.
Returns
Foveated tangents for the given view.
See also
varjo_FovTangents

◆ varjo_GetFovTangents()

struct varjo_FovTangents varjo_GetFovTangents ( struct varjo_Session *  session,
int32_t  viewIndex 
)

Returns tangents for a given view index.

Parameters
sessionVarjo session handle
viewIndexView index in range [0, varjo_GetViewCount() - 1].
Returns
Tangents for the given view.
See also
varjo_FovTangents

◆ varjo_GetGaze()

struct varjo_Gaze varjo_GetGaze ( struct varjo_Session *  session)

Gets the current state of the user gaze.

Gaze system must have been previously initialized by calling varjo_GazeInit or varjo_GazeInitWithParameters.

Parameters
sessionVarjo session handle.
Returns
Current state of the user gaze.

◆ varjo_GetGazeArray()

int32_t varjo_GetGazeArray ( struct varjo_Session *  session,
struct varjo_Gaze array,
int32_t  maxSize 
)

Gets gaze measurements since last query.

Gaze system must have been previously initialized by calling varjo_GazeInit or varjo_GazeInitWithParameters.

Parameters
sessionVarjo session handle.
arrayArray of varjo_Gaze structures
maxSizeNumber of elements in array
Returns
Number of items written to array

◆ varjo_GetPropertyBool()

varjo_Bool varjo_GetPropertyBool ( struct varjo_Session *  session,
varjo_PropertyKey  propertyKey 
)

Gets a boolean value of a property.

Parameters
sessionVarjo session handle.
propertyKeyThe property key.
Returns
Value of a boolean property if exists, false if the property does not exist. Undefined if the key type is not a boolean.

◆ varjo_GetPropertyCount()

int32_t varjo_GetPropertyCount ( struct varjo_Session *  session)

Gets the number of system properties.

Parameters
sessionVarjo session handle.
Returns
Number of system properties.

◆ varjo_GetPropertyDouble()

double varjo_GetPropertyDouble ( struct varjo_Session *  session,
varjo_PropertyKey  propertyKey 
)

Gets a floating point value of a property.

Parameters
sessionVarjo session handle.
propertyKeyThe property key.
Returns
Value of a floating point property if exists, 0.0 if the property does not exist. Undefined if the key type is not a float.

◆ varjo_GetPropertyInt()

int32_t varjo_GetPropertyInt ( struct varjo_Session *  session,
varjo_PropertyKey  propertyKey 
)

Gets an integer value of a property.

Parameters
sessionVarjo session handle.
propertyKeyThe property key.
Returns
Value of an integer property if exists, 0 if the property does not exist. Undefined if the key type is not an integer.

◆ varjo_GetPropertyKey()

varjo_PropertyKey varjo_GetPropertyKey ( struct varjo_Session *  session,
int32_t  index 
)

Gets a property key for a property index.

Parameters
sessionVarjo session handle.
indexZero-based index.
Returns
Key at index location in the properties. 0 if the key index is out of bounds.

◆ varjo_GetPropertyName()

const char* varjo_GetPropertyName ( struct varjo_Session *  session,
varjo_PropertyKey  propertyKey 
)

Gets the name of the property key.

Parameters
sessionVarjo session handle.
propertyKeyThe property key.
Returns
Name of the property key.

◆ varjo_GetPropertyString()

void varjo_GetPropertyString ( struct varjo_Session *  session,
varjo_PropertyKey  propertyKey,
char *  buffer,
uint32_t  maxSize 
)

Gets a string value of a property.

A null-terminated string will be returned to the given buffer. The string will not be copied if the size is smaller than the length of the property string + 1 (null terminator), i.e. truncation will not happen.

Parameters
sessionVarjo session handle.
propertyKeyThe property key.
bufferPointer to a char buffer.
maxSizeSize of the given char buffer.

◆ varjo_GetPropertyStringSize()

uint32_t varjo_GetPropertyStringSize ( struct varjo_Session *  session,
varjo_PropertyKey  propertyKey 
)

Gets the size of a buffer that is big enough to hold the property, including the null terminator.

Parameters
sessionVarjo session handle.
propertyKeyThe property key.
Returns
Size of a buffer that is big enough to hold the string. If the string is empty, the return value will be 1 (for the null terminator), and 0 if the property key does not exist or is not of a string type.

◆ varjo_GetRelativePoseTransform()

struct varjo_Matrix varjo_GetRelativePoseTransform ( struct varjo_Session *  session,
varjo_PoseType  src,
varjo_PoseType  dest 
)

Gets a relative transformation from source pose to destination pose.

Parameters
sessionVarjo session handle.
srcSource pose.
destDestination pose.
Returns
Relative transformation from source pose to destination pose.

◆ varjo_GetRenderingGaze()

varjo_Bool varjo_GetRenderingGaze ( struct varjo_Session *  session,
struct varjo_Gaze gaze 
)

Returns gaze which can be used for foveated rendering or to generate variable rate shading texture.

It may not be the same as the one returned by varjo_GetGaze(). For example, it handles eye blinks and doesn't return invalid gaze in those cases.

varjo_Error_NullPointer error will be set if the gaze pointer is null.

Parameters
sessionVarjo session handle.
gazeA pointer to valid varjo_Gaze.
Returns
True if there is a valid gaze, otherwise false.

◆ varjo_GetSupportedTextureFormats()

void varjo_GetSupportedTextureFormats ( struct varjo_Session *  session,
varjo_RenderAPI  renderApi,
int32_t *  formatCount,
varjo_TextureFormat formats 
)

Gets supported texture formats in the order of most preferred to least preferred.

To allocate memory for the formats output buffer, you should first call this function by passing null formats and query the count for the formats.

Parameters
sessionVarjo session handle.
renderApiRendering API being used.
formatCountOutput pointer for the format count. Cannot be null.
formatsOutput pointer for the formats. Can be null.

◆ varjo_GetSwapChainLimits()

struct varjo_SwapChainLimits varjo_GetSwapChainLimits ( struct varjo_Session *  session)

Gets swap chain limits.

Parameters
sessionVarjo session handle.
Returns
Swap chain limits.

◆ varjo_GetTextureSize()

void varjo_GetTextureSize ( struct varjo_Session *  session,
varjo_TextureSize_Type  type,
int32_t  viewIndex,
int32_t *  width,
int32_t *  height 
)

Gets texture size for specific varjo_TextureSize_type and view index.

Check varjo_TextureSize_Type description for details about different varjo_TextureSize_type.

Parameters
sessionVarjo session handle.
typeRequeste texture size type.
viewIndexView index.
widthA pointer to an int which will contain width (cannot be null).
heightA pointer to an int which will contain height (cannot be null).

◆ varjo_GetTrackingToLocalTransform()

struct varjo_Matrix varjo_GetTrackingToLocalTransform ( struct varjo_Session *  session)

Transform from tracking space to local client space.

Client space may differ from tracking space if: client has explicitly called varjo_ResetPose or by implicit change of tracking origin for all clients. Client should use varjo_GetTrackingToLocalTransform() in order to sync tracking space poses (e.g. controller poses) with client local space poses.

Parameters
sessionVarjo session handle.
Returns
The pose offset matrix.

◆ varjo_GetVersion()

const uint64_t varjo_GetVersion ( )

Gets the version number of the runtime.

Use VARJO_MAKE_VERSION macro to create a version that can be then used to test against the returned version number.

Note that VarjoLib version is stored in VARJO_VERSION define.

eg. VARJO_MAKE_VERSION(0, 7, 0, 0) >= varjo_GetVersion()

Returns
Installed Varjo runtime version number.

◆ varjo_GetVersionString()

const char* varjo_GetVersionString ( )

Gets the short version of the runtime.

Eg. "0.7.0.0".

Returns
Installed Varjo runtime version string.

◆ varjo_GetViewCount()

int32_t varjo_GetViewCount ( struct varjo_Session *  session)

Gets numbers of views.

Parameters
sessionVarjo session handle.

◆ varjo_GetViewDescription()

struct varjo_ViewDescription varjo_GetViewDescription ( struct varjo_Session *  session,
int32_t  viewIndex 
)

Gets the display information for a given view.

Use this to retrieve information about which display or eye the given view belongs to.

varjo_ViewDescription also contains the recommended render texture dimensions. Use varjo_GetTextureSize to query sizes for various different purposes (for example, best quality rendering).

Parameters
sessionVarjo session handle.
viewIndexView number to get the display information for. Must be in range [0, varjo_GetViewCount - 1].
Returns
View description.

◆ varjo_GLUpdateVariableRateShadingTexture()

void varjo_GLUpdateVariableRateShadingTexture ( struct varjo_Session *  session,
unsigned int  texture,
int  width,
int  height,
struct varjo_VariableRateShadingConfig config,
struct varjo_ShadingRateTable shadingRateTable 
)

Updates variable rate shading texture.

This function will add execution of compute shader which will calculate best possible VRS map based on flags. Function should be executed as late as possible to get most recent gaze. Function should be called as many times as there are views: 4 or 2.

See also
varjo_VariableRateShadingConfig for details.
Parameters
sessionVarjo session handle.
textureOpenGL texture (GLuint) which will be used as VRS map. Format must be GL_R8UI.
widthTexture width.
heightTexture height.
configConfiguration flags.
shadingRateTableArray that specifies which shading rate matches which integer value. This is very similar to shading rate palette in glShadingRateImagePaletteNV.

◆ varjo_HasProperty()

varjo_Bool varjo_HasProperty ( struct varjo_Session *  session,
varjo_PropertyKey  propertyKey 
)

Checks if the key has value in the properties.

Parameters
sessionVarjo session handle.
propertyKeyThe property key.
Returns
1 if the property key has a value, 0 if the value doesn't exist.

◆ varjo_IsAvailable()

varjo_Bool varjo_IsAvailable ( )

Checks whether Varjo system is available.

If varjo_IsAvailable() returns false, it is guaranteed that the session cannot be initialized. If this returns true, application may try initiating a new session.

This call executes fast and can be called per frame unlike varjo_SessionInit.

Returns
0 if Varjo system is not available, 1 if it is available.

◆ varjo_IsGazeAllowed()

varjo_Bool varjo_IsGazeAllowed ( struct varjo_Session *  session)

Is gaze allowed to be used?

User can disallow gaze tracking completely.

Parameters
sessionVarjo session handle.
Returns
varjo_True if gaze is allowed to be used, varjo_False otherwise.

◆ varjo_PollEvent()

varjo_Bool varjo_PollEvent ( struct varjo_Session *  session,
struct varjo_Event evt 
)

Polls events.

Holds the latest 100 events in the queue. If the queue size exceeds that, starts dropping events starting from the oldest. Make sure to call often enough (eg. once per frame) if you don't want to miss an event.

Use this in a loop to go through all of the queued events.

Parameters
sessionVarjo session handle.
evtEvent to receive data to.
Returns
varjo_True if there was an event, varjo_False if all events have been processed.

◆ varjo_RequestGazeCalibration()

void varjo_RequestGazeCalibration ( struct varjo_Session *  session)

Requests a HMD gaze calibration.

This attempts to trigger the gaze calibration sequence if the user has allowed gaze tracking from Varjo settings and Varjo system is in a state where it can bring up the calibration UI.

Parameters
sessionVarjo session handle.

◆ varjo_RequestGazeCalibrationWithParameters()

void varjo_RequestGazeCalibrationWithParameters ( struct varjo_Session *  session,
struct varjo_GazeCalibrationParameters parameters,
int32_t  parameterCount 
)

Requests a HMD gaze calibration with provided parameters.

This attempts to trigger the gaze calibration sequence if the user has allowed gaze tracking from Varjo settings and Varjo system is in a state where it can bring up the calibration UI.

Parameters
sessionVarjo session handle.
parametersGaze calibration key-value parameters.
parameterCountNumber of parameters provided.

◆ varjo_ResetPose()

void varjo_ResetPose ( struct varjo_Session *  session,
varjo_Bool  position,
varjo_RotationReset  rotation 
)

Resets pose tracking origin.

This will reset the tracking origin to the current transform of the user. rotation parameter can be used to reset only some components of the transform.

Parameters
sessionVarjo session handle.
positionReset position
rotationRotation reset type

◆ varjo_SessionInit()

struct varjo_Session* varjo_SessionInit ( void  )

Initializes a Varjo client session.

varjo_SessionInit initializes a new Varjo session and returns an opaque pointer handle representing the session which should be passed to all Varjo API calls that are related to this session. When done, the session needs to be cleaned up by calling varjo_SessionShutDown.

There can be multiple simultaneous sessions, but generally applications don't need more than one. Single session can be shared between different threads.

◆ varjo_SessionSetPriority()

void varjo_SessionSetPriority ( struct varjo_Session *  session,
int32_t  priority 
)

Sets session overlay priority.

All sessions are grouped based on this value. Only one session from a group is displayed. Higher priority sessions are overlaid on top of lower priority one's.

Parameters
sessionVarjo session handle.
priorityVarjo session priority. Negative values allowed. Zero on SessionInit by default.

◆ varjo_SessionShutDown()

void varjo_SessionShutDown ( struct varjo_Session *  session)

Shuts down a session and releases all the resources internally allocated by Varjo session.

Session pointer will become invalid after calling this function.

Parameters
sessionVarjo session handle.

◆ varjo_SetCenteredProjection()

void varjo_SetCenteredProjection ( struct varjo_Session *  session,
varjo_Bool  enabled 
)

Forces the provided projection matrices to be centered.

This may result in suboptimal resolution.

Parameters
sessionVarjo session handle.
enabledTrue, if the matrices need to be centered. False if off-center projection is ok.

◆ varjo_SyncProperties()

void varjo_SyncProperties ( struct varjo_Session *  session)

Updates and synchronizes system properties with the system state.

Parameters
sessionVarjo session handle.

◆ varjo_WaitSync()

void varjo_WaitSync ( struct varjo_Session *  session,
struct varjo_FrameInfo frameInfo 
)

Called at the start of a frame.

Obtains required metadata for the frame and blocks until optimal time to start rendering so that the application can use the latest possible pose data. In some cases, compositor may block the call for longer duration. (e.g. if it has something else to display.)

varjo_WaitSync() and varjo_FrameGetPose() will always derive matrixes from the same pose. So it's safe to call varjo_FrameGetPose() before varjo_WaitSync() is complete.

Parameters
sessionVarjo session handle.
frameInfoOutput pointer for frame info.