tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

openvr.h (262964B)


      1 #pragma once
      2 
      3 // openvr.h
      4 //========= Copyright Valve Corporation ============//
      5 // Dynamically generated file. Do not modify this file directly.
      6 
      7 #ifndef _OPENVR_API
      8 #define _OPENVR_API
      9 
     10 #include <stdint.h>
     11 
     12 
     13 
     14 // version.h
     15 namespace vr
     16 {
     17 static const uint32_t k_nSteamVRVersionMajor = 1;
     18 static const uint32_t k_nSteamVRVersionMinor = 11;
     19 static const uint32_t k_nSteamVRVersionBuild = 11;
     20 } // namespace vr
     21 
     22 // vrtypes.h
     23 #ifndef _INCLUDE_VRTYPES_H
     24 #define _INCLUDE_VRTYPES_H
     25 
     26 // Forward declarations to avoid requiring vulkan.h
     27 struct VkDevice_T;
     28 struct VkPhysicalDevice_T;
     29 struct VkInstance_T;
     30 struct VkQueue_T;
     31 
     32 // Forward declarations to avoid requiring d3d12.h
     33 struct ID3D12Resource;
     34 struct ID3D12CommandQueue;
     35 
     36 namespace vr
     37 {
     38 #pragma pack( push, 8 )
     39 
     40 /** A handle for a spatial anchor.  This handle is only valid during the session it was created in.
     41 * Anchors that live beyond one session should be saved by their string descriptors. */
     42 typedef uint32_t SpatialAnchorHandle_t;
     43 
     44 typedef void* glSharedTextureHandle_t;
     45 typedef int32_t glInt_t;
     46 typedef uint32_t glUInt_t;
     47 
     48 // right-handed system
     49 // +y is up
     50 // +x is to the right
     51 // -z is forward
     52 // Distance unit is  meters
     53 struct HmdMatrix34_t
     54 {
     55 float m[3][4];
     56 };
     57 
     58 struct HmdMatrix33_t
     59 {
     60 float m[3][3];
     61 };
     62 
     63 struct HmdMatrix44_t
     64 {
     65 float m[4][4];
     66 };
     67 
     68 struct HmdVector3_t
     69 {
     70 float v[3];
     71 };
     72 
     73 struct HmdVector4_t
     74 {
     75 float v[4];
     76 };
     77 
     78 struct HmdVector3d_t
     79 {
     80 double v[3];
     81 };
     82 
     83 struct HmdVector2_t
     84 {
     85 float v[2];
     86 };
     87 
     88 struct HmdQuaternion_t
     89 {
     90 double w, x, y, z;
     91 };
     92 
     93 struct HmdQuaternionf_t
     94 {
     95 float w, x, y, z;
     96 };
     97 
     98 struct HmdColor_t
     99 {
    100 float r, g, b, a;
    101 };
    102 
    103 struct HmdQuad_t
    104 {
    105 HmdVector3_t vCorners[ 4 ];
    106 };
    107 
    108 struct HmdRect2_t
    109 {
    110 HmdVector2_t vTopLeft;
    111 HmdVector2_t vBottomRight;
    112 };
    113 
    114 /** Used to return the post-distortion UVs for each color channel. 
    115 * UVs range from 0 to 1 with 0,0 in the upper left corner of the 
    116 * source render target. The 0,0 to 1,1 range covers a single eye. */
    117 struct DistortionCoordinates_t
    118 {
    119 float rfRed[2];
    120 float rfGreen[2];
    121 float rfBlue[2];
    122 };
    123 
    124 enum EVREye
    125 {
    126 Eye_Left = 0,
    127 Eye_Right = 1
    128 };
    129 
    130 enum ETextureType
    131 {
    132 TextureType_Invalid = -1, // Handle has been invalidated
    133 TextureType_DirectX = 0, // Handle is an ID3D11Texture
    134 TextureType_OpenGL = 1,  // Handle is an OpenGL texture name or an OpenGL render buffer name, depending on submit flags
    135 TextureType_Vulkan = 2, // Handle is a pointer to a VRVulkanTextureData_t structure
    136 TextureType_IOSurface = 3, // Handle is a macOS cross-process-sharable IOSurfaceRef, deprecated in favor of TextureType_Metal on supported platforms
    137 TextureType_DirectX12 = 4, // Handle is a pointer to a D3D12TextureData_t structure
    138 TextureType_DXGISharedHandle = 5, // Handle is a HANDLE DXGI share handle, only supported for Overlay render targets. 
    139 								  // this texture is used directly by our renderer, so only perform atomic (copyresource or resolve) on it
    140 TextureType_Metal = 6, // Handle is a MTLTexture conforming to the MTLSharedTexture protocol. Textures submitted to IVRCompositor::Submit which
    141 					   // are of type MTLTextureType2DArray assume layer 0 is the left eye texture (vr::EVREye::Eye_left), layer 1 is the right
    142 					   // eye texture (vr::EVREye::Eye_Right)
    143 };
    144 
    145 enum EColorSpace
    146 {
    147 ColorSpace_Auto = 0,	// Assumes 'gamma' for 8-bit per component formats, otherwise 'linear'.  This mirrors the DXGI formats which have _SRGB variants.
    148 ColorSpace_Gamma = 1,	// Texture data can be displayed directly on the display without any conversion (a.k.a. display native format).
    149 ColorSpace_Linear = 2,	// Same as gamma but has been converted to a linear representation using DXGI's sRGB conversion algorithm.
    150 };
    151 
    152 struct Texture_t
    153 {
    154 void* handle; // See ETextureType definition above
    155 ETextureType eType;
    156 EColorSpace eColorSpace;
    157 };
    158 
    159 // Handle to a shared texture (HANDLE on Windows obtained using OpenSharedResource).
    160 typedef uint64_t SharedTextureHandle_t;
    161 #define INVALID_SHARED_TEXTURE_HANDLE	((vr::SharedTextureHandle_t)0)
    162 
    163 enum ETrackingResult
    164 {
    165 TrackingResult_Uninitialized			= 1,
    166 
    167 TrackingResult_Calibrating_InProgress	= 100,
    168 TrackingResult_Calibrating_OutOfRange	= 101,
    169 
    170 TrackingResult_Running_OK				= 200,
    171 TrackingResult_Running_OutOfRange		= 201,
    172 
    173 TrackingResult_Fallback_RotationOnly	= 300,
    174 };
    175 
    176 typedef uint32_t DriverId_t;
    177 static const uint32_t k_nDriverNone = 0xFFFFFFFF;
    178 
    179 static const uint32_t k_unMaxDriverDebugResponseSize = 32768;
    180 
    181 /** Used to pass device IDs to API calls */
    182 typedef uint32_t TrackedDeviceIndex_t;
    183 static const uint32_t k_unTrackedDeviceIndex_Hmd = 0;
    184 static const uint32_t k_unMaxTrackedDeviceCount = 64;
    185 static const uint32_t k_unTrackedDeviceIndexOther = 0xFFFFFFFE;
    186 static const uint32_t k_unTrackedDeviceIndexInvalid = 0xFFFFFFFF;
    187 
    188 /** Describes what kind of object is being tracked at a given ID */
    189 enum ETrackedDeviceClass
    190 {
    191 TrackedDeviceClass_Invalid = 0,				// the ID was not valid.
    192 TrackedDeviceClass_HMD = 1,					// Head-Mounted Displays
    193 TrackedDeviceClass_Controller = 2,			// Tracked controllers
    194 TrackedDeviceClass_GenericTracker = 3,		// Generic trackers, similar to controllers
    195 TrackedDeviceClass_TrackingReference = 4,	// Camera and base stations that serve as tracking reference points
    196 TrackedDeviceClass_DisplayRedirect = 5,		// Accessories that aren't necessarily tracked themselves, but may redirect video output from other tracked devices
    197 
    198 TrackedDeviceClass_Max
    199 };
    200 
    201 
    202 /** Describes what specific role associated with a tracked device */
    203 enum ETrackedControllerRole
    204 {
    205 TrackedControllerRole_Invalid = 0,					// Invalid value for controller type
    206 TrackedControllerRole_LeftHand = 1,					// Tracked device associated with the left hand
    207 TrackedControllerRole_RightHand = 2,				// Tracked device associated with the right hand
    208 TrackedControllerRole_OptOut = 3,					// Tracked device is opting out of left/right hand selection
    209 TrackedControllerRole_Treadmill = 4,				// Tracked device is a treadmill or other locomotion device
    210 TrackedControllerRole_Stylus = 5,					// Tracked device is a stylus
    211 TrackedControllerRole_Max = 5
    212 };
    213 
    214 
    215 /** Returns true if the tracked controller role is allowed to be a hand */
    216 inline bool IsRoleAllowedAsHand( ETrackedControllerRole eRole )
    217 {
    218 switch ( eRole )
    219 {
    220 case TrackedControllerRole_Invalid:
    221 case TrackedControllerRole_LeftHand:
    222 case TrackedControllerRole_RightHand:
    223 	return true;
    224 default:
    225 	return false;
    226 }
    227 }
    228 
    229 
    230 /** describes a single pose for a tracked object */
    231 struct TrackedDevicePose_t
    232 {
    233 HmdMatrix34_t mDeviceToAbsoluteTracking;
    234 HmdVector3_t vVelocity;				// velocity in tracker space in m/s
    235 HmdVector3_t vAngularVelocity;		// angular velocity in radians/s (?)
    236 ETrackingResult eTrackingResult;
    237 bool bPoseIsValid;
    238 
    239 // This indicates that there is a device connected for this spot in the pose array.
    240 // It could go from true to false if the user unplugs the device.
    241 bool bDeviceIsConnected;
    242 };
    243 
    244 /** Identifies which style of tracking origin the application wants to use
    245 * for the poses it is requesting */
    246 enum ETrackingUniverseOrigin
    247 {
    248 TrackingUniverseSeated = 0,		// Poses are provided relative to the seated zero pose
    249 TrackingUniverseStanding = 1,	// Poses are provided relative to the safe bounds configured by the user
    250 TrackingUniverseRawAndUncalibrated = 2,	// Poses are provided in the coordinate system defined by the driver.  It has Y up and is unified for devices of the same driver. You usually don't want this one.
    251 };
    252 
    253 enum EAdditionalRadioFeatures
    254 {
    255 AdditionalRadioFeatures_None           = 0x00000000,
    256 AdditionalRadioFeatures_HTCLinkBox     = 0x00000001,
    257 AdditionalRadioFeatures_InternalDongle = 0x00000002,
    258 AdditionalRadioFeatures_ExternalDongle = 0x00000004,
    259 };
    260 
    261 typedef uint64_t WebConsoleHandle_t;
    262 #define INVALID_WEB_CONSOLE_HANDLE	((vr::WebConsoleHandle_t)0)
    263 
    264 // Refers to a single container of properties
    265 typedef uint64_t PropertyContainerHandle_t;
    266 typedef uint32_t PropertyTypeTag_t;
    267 
    268 static const PropertyContainerHandle_t k_ulInvalidPropertyContainer = 0;
    269 static const PropertyTypeTag_t k_unInvalidPropertyTag = 0;
    270 
    271 typedef PropertyContainerHandle_t DriverHandle_t;
    272 static const PropertyContainerHandle_t k_ulInvalidDriverHandle = 0;
    273 
    274 // Use these tags to set/get common types as struct properties
    275 static const PropertyTypeTag_t k_unFloatPropertyTag = 1;
    276 static const PropertyTypeTag_t k_unInt32PropertyTag = 2;
    277 static const PropertyTypeTag_t k_unUint64PropertyTag = 3;
    278 static const PropertyTypeTag_t k_unBoolPropertyTag = 4;
    279 static const PropertyTypeTag_t k_unStringPropertyTag = 5;
    280 static const PropertyTypeTag_t k_unErrorPropertyTag = 6;
    281 static const PropertyTypeTag_t k_unDoublePropertyTag = 7;
    282 
    283 static const PropertyTypeTag_t k_unHmdMatrix34PropertyTag = 20;
    284 static const PropertyTypeTag_t k_unHmdMatrix44PropertyTag = 21;
    285 static const PropertyTypeTag_t k_unHmdVector3PropertyTag = 22;
    286 static const PropertyTypeTag_t k_unHmdVector4PropertyTag = 23;
    287 static const PropertyTypeTag_t k_unHmdVector2PropertyTag = 24;
    288 static const PropertyTypeTag_t k_unHmdQuadPropertyTag = 25;
    289 
    290 static const PropertyTypeTag_t k_unHiddenAreaPropertyTag = 30;
    291 static const PropertyTypeTag_t k_unPathHandleInfoTag = 31;
    292 static const PropertyTypeTag_t k_unActionPropertyTag = 32;
    293 static const PropertyTypeTag_t k_unInputValuePropertyTag = 33;
    294 static const PropertyTypeTag_t k_unWildcardPropertyTag = 34;
    295 static const PropertyTypeTag_t k_unHapticVibrationPropertyTag = 35;
    296 static const PropertyTypeTag_t k_unSkeletonPropertyTag = 36;
    297 
    298 static const PropertyTypeTag_t k_unSpatialAnchorPosePropertyTag = 40;
    299 static const PropertyTypeTag_t k_unJsonPropertyTag = 41;
    300 static const PropertyTypeTag_t k_unActiveActionSetPropertyTag = 42;
    301 
    302 static const PropertyTypeTag_t k_unOpenVRInternalReserved_Start = 1000;
    303 static const PropertyTypeTag_t k_unOpenVRInternalReserved_End = 10000;
    304 
    305 
    306 /** Each entry in this enum represents a property that can be retrieved about a
    307 * tracked device. Many fields are only valid for one ETrackedDeviceClass. */
    308 enum ETrackedDeviceProperty
    309 {
    310 Prop_Invalid								= 0,
    311 
    312 // general properties that apply to all device classes
    313 Prop_TrackingSystemName_String				= 1000,
    314 Prop_ModelNumber_String						= 1001,
    315 Prop_SerialNumber_String					= 1002,
    316 Prop_RenderModelName_String					= 1003,
    317 Prop_WillDriftInYaw_Bool					= 1004,
    318 Prop_ManufacturerName_String				= 1005,
    319 Prop_TrackingFirmwareVersion_String			= 1006,
    320 Prop_HardwareRevision_String				= 1007,
    321 Prop_AllWirelessDongleDescriptions_String	= 1008,
    322 Prop_ConnectedWirelessDongle_String			= 1009,
    323 Prop_DeviceIsWireless_Bool					= 1010,
    324 Prop_DeviceIsCharging_Bool					= 1011,
    325 Prop_DeviceBatteryPercentage_Float			= 1012, // 0 is empty, 1 is full
    326 Prop_StatusDisplayTransform_Matrix34		= 1013,
    327 Prop_Firmware_UpdateAvailable_Bool			= 1014,
    328 Prop_Firmware_ManualUpdate_Bool				= 1015,
    329 Prop_Firmware_ManualUpdateURL_String		= 1016,
    330 Prop_HardwareRevision_Uint64				= 1017,
    331 Prop_FirmwareVersion_Uint64					= 1018,
    332 Prop_FPGAVersion_Uint64						= 1019,
    333 Prop_VRCVersion_Uint64						= 1020,
    334 Prop_RadioVersion_Uint64					= 1021,
    335 Prop_DongleVersion_Uint64					= 1022,
    336 Prop_BlockServerShutdown_Bool				= 1023,
    337 Prop_CanUnifyCoordinateSystemWithHmd_Bool	= 1024,
    338 Prop_ContainsProximitySensor_Bool			= 1025,
    339 Prop_DeviceProvidesBatteryStatus_Bool		= 1026,
    340 Prop_DeviceCanPowerOff_Bool					= 1027,
    341 Prop_Firmware_ProgrammingTarget_String		= 1028,
    342 Prop_DeviceClass_Int32						= 1029,
    343 Prop_HasCamera_Bool							= 1030,
    344 Prop_DriverVersion_String                   = 1031,
    345 Prop_Firmware_ForceUpdateRequired_Bool      = 1032,
    346 Prop_ViveSystemButtonFixRequired_Bool		= 1033,
    347 Prop_ParentDriver_Uint64					= 1034,
    348 Prop_ResourceRoot_String					= 1035,
    349 Prop_RegisteredDeviceType_String			= 1036,
    350 Prop_InputProfilePath_String				= 1037, // input profile to use for this device in the input system. Will default to tracking system name if this isn't provided
    351 Prop_NeverTracked_Bool						= 1038, // Used for devices that will never have a valid pose by design
    352 Prop_NumCameras_Int32						= 1039,
    353 Prop_CameraFrameLayout_Int32				= 1040, // EVRTrackedCameraFrameLayout value
    354 Prop_CameraStreamFormat_Int32				= 1041, // ECameraVideoStreamFormat value
    355 Prop_AdditionalDeviceSettingsPath_String	= 1042, // driver-relative path to additional device and global configuration settings
    356 Prop_Identifiable_Bool						= 1043, // Whether device supports being identified from vrmonitor (e.g. blink LED, vibrate haptics, etc)
    357 Prop_BootloaderVersion_Uint64			    = 1044,
    358 Prop_AdditionalSystemReportData_String		= 1045, // additional string to include in system reports about a tracked device
    359 Prop_CompositeFirmwareVersion_String        = 1046, // additional FW components from a device that gets propagated into reports
    360 Prop_Firmware_RemindUpdate_Bool             = 1047,
    361 Prop_PeripheralApplicationVersion_Uint64	= 1048,
    362 Prop_ManufacturerSerialNumber_String		= 1049,
    363 Prop_ComputedSerialNumber_String			= 1050,
    364 Prop_EstimatedDeviceFirstUseTime_Int32		= 1051,
    365 
    366 // Properties that are unique to TrackedDeviceClass_HMD
    367 Prop_ReportsTimeSinceVSync_Bool				= 2000,
    368 Prop_SecondsFromVsyncToPhotons_Float		= 2001,
    369 Prop_DisplayFrequency_Float					= 2002,
    370 Prop_UserIpdMeters_Float					= 2003,
    371 Prop_CurrentUniverseId_Uint64				= 2004, 
    372 Prop_PreviousUniverseId_Uint64				= 2005, 
    373 Prop_DisplayFirmwareVersion_Uint64			= 2006,
    374 Prop_IsOnDesktop_Bool						= 2007,
    375 Prop_DisplayMCType_Int32					= 2008,
    376 Prop_DisplayMCOffset_Float					= 2009,
    377 Prop_DisplayMCScale_Float					= 2010,
    378 Prop_EdidVendorID_Int32						= 2011,
    379 Prop_DisplayMCImageLeft_String              = 2012,
    380 Prop_DisplayMCImageRight_String             = 2013,
    381 Prop_DisplayGCBlackClamp_Float				= 2014,
    382 Prop_EdidProductID_Int32					= 2015,
    383 Prop_CameraToHeadTransform_Matrix34			= 2016,
    384 Prop_DisplayGCType_Int32					= 2017,
    385 Prop_DisplayGCOffset_Float					= 2018,
    386 Prop_DisplayGCScale_Float					= 2019,
    387 Prop_DisplayGCPrescale_Float				= 2020,
    388 Prop_DisplayGCImage_String					= 2021,
    389 Prop_LensCenterLeftU_Float					= 2022,
    390 Prop_LensCenterLeftV_Float					= 2023,
    391 Prop_LensCenterRightU_Float					= 2024,
    392 Prop_LensCenterRightV_Float					= 2025,
    393 Prop_UserHeadToEyeDepthMeters_Float			= 2026,
    394 Prop_CameraFirmwareVersion_Uint64			= 2027,
    395 Prop_CameraFirmwareDescription_String		= 2028,
    396 Prop_DisplayFPGAVersion_Uint64				= 2029,
    397 Prop_DisplayBootloaderVersion_Uint64		= 2030,
    398 Prop_DisplayHardwareVersion_Uint64			= 2031,
    399 Prop_AudioFirmwareVersion_Uint64			= 2032,
    400 Prop_CameraCompatibilityMode_Int32			= 2033,
    401 Prop_ScreenshotHorizontalFieldOfViewDegrees_Float = 2034,
    402 Prop_ScreenshotVerticalFieldOfViewDegrees_Float = 2035,
    403 Prop_DisplaySuppressed_Bool					= 2036,
    404 Prop_DisplayAllowNightMode_Bool				= 2037,
    405 Prop_DisplayMCImageWidth_Int32				= 2038,
    406 Prop_DisplayMCImageHeight_Int32				= 2039,
    407 Prop_DisplayMCImageNumChannels_Int32		= 2040,
    408 Prop_DisplayMCImageData_Binary				= 2041,
    409 Prop_SecondsFromPhotonsToVblank_Float		= 2042,
    410 Prop_DriverDirectModeSendsVsyncEvents_Bool	= 2043,
    411 Prop_DisplayDebugMode_Bool					= 2044,
    412 Prop_GraphicsAdapterLuid_Uint64				= 2045,
    413 Prop_DriverProvidedChaperonePath_String		= 2048,
    414 Prop_ExpectedTrackingReferenceCount_Int32	= 2049, // expected number of sensors or basestations to reserve UI space for
    415 Prop_ExpectedControllerCount_Int32			= 2050, // expected number of tracked controllers to reserve UI space for
    416 Prop_NamedIconPathControllerLeftDeviceOff_String	= 2051, // placeholder icon for "left" controller if not yet detected/loaded
    417 Prop_NamedIconPathControllerRightDeviceOff_String	= 2052, // placeholder icon for "right" controller if not yet detected/loaded
    418 Prop_NamedIconPathTrackingReferenceDeviceOff_String	= 2053, // placeholder icon for sensor/base if not yet detected/loaded
    419 Prop_DoNotApplyPrediction_Bool				= 2054, // currently no effect. was used to disable HMD pose prediction on MR, which is now done by MR driver setting velocity=0
    420 Prop_CameraToHeadTransforms_Matrix34_Array	= 2055,
    421 Prop_DistortionMeshResolution_Int32			= 2056, // custom resolution of compositor calls to IVRSystem::ComputeDistortion
    422 Prop_DriverIsDrawingControllers_Bool		= 2057,
    423 Prop_DriverRequestsApplicationPause_Bool	= 2058,
    424 Prop_DriverRequestsReducedRendering_Bool	= 2059,
    425 Prop_MinimumIpdStepMeters_Float				= 2060,
    426 Prop_AudioBridgeFirmwareVersion_Uint64		= 2061,
    427 Prop_ImageBridgeFirmwareVersion_Uint64		= 2062,
    428 Prop_ImuToHeadTransform_Matrix34			= 2063,
    429 Prop_ImuFactoryGyroBias_Vector3				= 2064,
    430 Prop_ImuFactoryGyroScale_Vector3			= 2065,
    431 Prop_ImuFactoryAccelerometerBias_Vector3	= 2066,
    432 Prop_ImuFactoryAccelerometerScale_Vector3	= 2067,
    433 // reserved 2068
    434 Prop_ConfigurationIncludesLighthouse20Features_Bool = 2069,
    435 Prop_AdditionalRadioFeatures_Uint64         = 2070,
    436 Prop_CameraWhiteBalance_Vector4_Array		= 2071, // Prop_NumCameras_Int32-sized array of float[4] RGBG white balance calibration data (max size is vr::k_unMaxCameras)
    437 Prop_CameraDistortionFunction_Int32_Array	= 2072, // Prop_NumCameras_Int32-sized array of vr::EVRDistortionFunctionType values (max size is vr::k_unMaxCameras)
    438 Prop_CameraDistortionCoefficients_Float_Array = 2073, // Prop_NumCameras_Int32-sized array of double[vr::k_unMaxDistortionFunctionParameters] (max size is vr::k_unMaxCameras)
    439 Prop_ExpectedControllerType_String			= 2074,
    440 Prop_HmdTrackingStyle_Int32					= 2075, // one of EHmdTrackingStyle
    441 Prop_DriverProvidedChaperoneVisibility_Bool = 2076,
    442 Prop_HmdColumnCorrectionSettingPrefix_String = 2077,
    443 Prop_CameraSupportsCompatibilityModes_Bool	= 2078,
    444 
    445 Prop_DisplayAvailableFrameRates_Float_Array = 2080, // populated by compositor from actual EDID list when available from GPU driver
    446 Prop_DisplaySupportsMultipleFramerates_Bool = 2081, // if this is true but Prop_DisplayAvailableFrameRates_Float_Array is empty, explain to user
    447 Prop_DisplayColorMultLeft_Vector3			= 2082,
    448 Prop_DisplayColorMultRight_Vector3			= 2083,
    449 Prop_DisplaySupportsRuntimeFramerateChange_Bool = 2084,
    450 Prop_DisplaySupportsAnalogGain_Bool 		= 2085,
    451 Prop_DisplayMinAnalogGain_Float 			= 2086,
    452 Prop_DisplayMaxAnalogGain_Float 			= 2087,
    453 
    454 // Prop_DashboardLayoutPathName_String 		= 2090, // DELETED
    455 Prop_DashboardScale_Float 					= 2091,
    456 Prop_IpdUIRangeMinMeters_Float 				= 2100,
    457 Prop_IpdUIRangeMaxMeters_Float 				= 2101,
    458 
    459 // Driver requested mura correction properties
    460 Prop_DriverRequestedMuraCorrectionMode_Int32		= 2200,
    461 Prop_DriverRequestedMuraFeather_InnerLeft_Int32		= 2201,
    462 Prop_DriverRequestedMuraFeather_InnerRight_Int32	= 2202,
    463 Prop_DriverRequestedMuraFeather_InnerTop_Int32		= 2203,
    464 Prop_DriverRequestedMuraFeather_InnerBottom_Int32	= 2204,
    465 Prop_DriverRequestedMuraFeather_OuterLeft_Int32		= 2205,
    466 Prop_DriverRequestedMuraFeather_OuterRight_Int32	= 2206,
    467 Prop_DriverRequestedMuraFeather_OuterTop_Int32		= 2207,
    468 Prop_DriverRequestedMuraFeather_OuterBottom_Int32	= 2208,
    469 
    470 Prop_Audio_DefaultPlaybackDeviceId_String		= 2300,
    471 Prop_Audio_DefaultRecordingDeviceId_String		= 2301,
    472 Prop_Audio_DefaultPlaybackDeviceVolume_Float	= 2302,
    473 
    474 // Properties that are unique to TrackedDeviceClass_Controller
    475 Prop_AttachedDeviceId_String				= 3000,
    476 Prop_SupportedButtons_Uint64				= 3001,
    477 Prop_Axis0Type_Int32						= 3002, // Return value is of type EVRControllerAxisType
    478 Prop_Axis1Type_Int32						= 3003, // Return value is of type EVRControllerAxisType
    479 Prop_Axis2Type_Int32						= 3004, // Return value is of type EVRControllerAxisType
    480 Prop_Axis3Type_Int32						= 3005, // Return value is of type EVRControllerAxisType
    481 Prop_Axis4Type_Int32						= 3006, // Return value is of type EVRControllerAxisType
    482 Prop_ControllerRoleHint_Int32				= 3007, // Return value is of type ETrackedControllerRole
    483 
    484 // Properties that are unique to TrackedDeviceClass_TrackingReference
    485 Prop_FieldOfViewLeftDegrees_Float			= 4000,
    486 Prop_FieldOfViewRightDegrees_Float			= 4001,
    487 Prop_FieldOfViewTopDegrees_Float			= 4002,
    488 Prop_FieldOfViewBottomDegrees_Float			= 4003,
    489 Prop_TrackingRangeMinimumMeters_Float		= 4004,
    490 Prop_TrackingRangeMaximumMeters_Float		= 4005,
    491 Prop_ModeLabel_String						= 4006,
    492 Prop_CanWirelessIdentify_Bool               = 4007, // volatile, based on radio presence and fw discovery
    493 Prop_Nonce_Int32                            = 4008,
    494 
    495 // Properties that are used for user interface like icons names
    496 Prop_IconPathName_String						= 5000, // DEPRECATED. Value not referenced. Now expected to be part of icon path properties.
    497 Prop_NamedIconPathDeviceOff_String				= 5001, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others
    498 Prop_NamedIconPathDeviceSearching_String		= 5002, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others
    499 Prop_NamedIconPathDeviceSearchingAlert_String	= 5003, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others
    500 Prop_NamedIconPathDeviceReady_String			= 5004, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others
    501 Prop_NamedIconPathDeviceReadyAlert_String		= 5005, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others
    502 Prop_NamedIconPathDeviceNotReady_String			= 5006, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others
    503 Prop_NamedIconPathDeviceStandby_String			= 5007, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others
    504 Prop_NamedIconPathDeviceAlertLow_String			= 5008, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others
    505 Prop_NamedIconPathDeviceStandbyAlert_String		= 5009, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others
    506 
    507 // Properties that are used by helpers, but are opaque to applications
    508 Prop_DisplayHiddenArea_Binary_Start				= 5100,
    509 Prop_DisplayHiddenArea_Binary_End				= 5150,
    510 Prop_ParentContainer							= 5151,
    511 Prop_OverrideContainer_Uint64					= 5152,
    512 
    513 // Properties that are unique to drivers
    514 Prop_UserConfigPath_String					= 6000,
    515 Prop_InstallPath_String						= 6001,
    516 Prop_HasDisplayComponent_Bool				= 6002,
    517 Prop_HasControllerComponent_Bool			= 6003,
    518 Prop_HasCameraComponent_Bool				= 6004,
    519 Prop_HasDriverDirectModeComponent_Bool		= 6005,
    520 Prop_HasVirtualDisplayComponent_Bool		= 6006,
    521 Prop_HasSpatialAnchorsSupport_Bool		    = 6007,
    522 
    523 // Properties that are set internally based on other information provided by drivers
    524 Prop_ControllerType_String					= 7000,
    525 //Prop_LegacyInputProfile_String				= 7001, // This is no longer used. See "legacy_binding" in the input profile instead.
    526 Prop_ControllerHandSelectionPriority_Int32	= 7002, // Allows hand assignments to prefer some controllers over others. High numbers are selected over low numbers
    527 
    528 // Vendors are free to expose private debug data in this reserved region
    529 Prop_VendorSpecific_Reserved_Start			= 10000,
    530 Prop_VendorSpecific_Reserved_End			= 10999,
    531 
    532 Prop_TrackedDeviceProperty_Max				= 1000000,
    533 };
    534 
    535 /** No string property will ever be longer than this length */
    536 static const uint32_t k_unMaxPropertyStringSize = 32 * 1024;
    537 
    538 /** Used to return errors that occur when reading properties. */
    539 enum ETrackedPropertyError
    540 {
    541 TrackedProp_Success						= 0,
    542 TrackedProp_WrongDataType				= 1,
    543 TrackedProp_WrongDeviceClass			= 2,
    544 TrackedProp_BufferTooSmall				= 3,
    545 TrackedProp_UnknownProperty				= 4, // Driver has not set the property (and may not ever).
    546 TrackedProp_InvalidDevice				= 5,
    547 TrackedProp_CouldNotContactServer		= 6,
    548 TrackedProp_ValueNotProvidedByDevice	= 7,
    549 TrackedProp_StringExceedsMaximumLength	= 8,
    550 TrackedProp_NotYetAvailable				= 9, // The property value isn't known yet, but is expected soon. Call again later.
    551 TrackedProp_PermissionDenied			= 10,
    552 TrackedProp_InvalidOperation			= 11,
    553 TrackedProp_CannotWriteToWildcards		= 12,
    554 TrackedProp_IPCReadFailure				= 13,
    555 TrackedProp_OutOfMemory					= 14,
    556 TrackedProp_InvalidContainer			= 15,
    557 };
    558 
    559 /** Used to drive certain text in the UI when talking about the tracking system for the HMD */
    560 enum EHmdTrackingStyle
    561 {
    562 HmdTrackingStyle_Unknown				= 0,
    563 
    564 HmdTrackingStyle_Lighthouse				= 1, // base stations and lasers
    565 HmdTrackingStyle_OutsideInCameras		= 2, // Cameras and LED, Rift 1 style
    566 HmdTrackingStyle_InsideOutCameras		= 3, // Cameras on HMD looking at the world
    567 };
    568 
    569 typedef uint64_t VRActionHandle_t;
    570 typedef uint64_t VRActionSetHandle_t;
    571 typedef uint64_t VRInputValueHandle_t;
    572 
    573 static const VRActionHandle_t k_ulInvalidActionHandle = 0;
    574 static const VRActionSetHandle_t k_ulInvalidActionSetHandle = 0;
    575 static const VRInputValueHandle_t k_ulInvalidInputValueHandle = 0;
    576 
    577 
    578 /** Allows the application to control what part of the provided texture will be used in the
    579 * frame buffer. */
    580 struct VRTextureBounds_t
    581 {
    582 float uMin, vMin;
    583 float uMax, vMax;
    584 };
    585 
    586 /** Allows specifying pose used to render provided scene texture (if different from value returned by WaitGetPoses). */
    587 struct VRTextureWithPose_t : public Texture_t
    588 {
    589 HmdMatrix34_t mDeviceToAbsoluteTracking; // Actual pose used to render scene textures.
    590 };
    591 
    592 struct VRTextureDepthInfo_t
    593 {
    594 void* handle; // See ETextureType definition above
    595 HmdMatrix44_t mProjection;
    596 HmdVector2_t vRange; // 0..1
    597 };
    598 
    599 struct VRTextureWithDepth_t : public Texture_t
    600 {
    601 VRTextureDepthInfo_t depth;
    602 };
    603 
    604 struct VRTextureWithPoseAndDepth_t : public VRTextureWithPose_t
    605 {
    606 VRTextureDepthInfo_t depth;
    607 };
    608 
    609 /** Allows the application to control how scene textures are used by the compositor when calling Submit. */
    610 enum EVRSubmitFlags
    611 {
    612 // Simple render path. App submits rendered left and right eye images with no lens distortion correction applied.
    613 Submit_Default = 0x00,
    614 
    615 // App submits final left and right eye images with lens distortion already applied (lens distortion makes the images appear
    616 // barrel distorted with chromatic aberration correction applied). The app would have used the data returned by
    617 // vr::IVRSystem::ComputeDistortion() to apply the correct distortion to the rendered images before calling Submit().
    618 Submit_LensDistortionAlreadyApplied = 0x01,
    619 
    620 // If the texture pointer passed in is actually a renderbuffer (e.g. for MSAA in OpenGL) then set this flag.
    621 Submit_GlRenderBuffer = 0x02,
    622 
    623 // Do not use
    624 Submit_Reserved = 0x04,
    625 
    626 // Set to indicate that pTexture is a pointer to a VRTextureWithPose_t.
    627 // This flag can be combined with Submit_TextureWithDepth to pass a VRTextureWithPoseAndDepth_t.
    628 Submit_TextureWithPose = 0x08,
    629 
    630 // Set to indicate that pTexture is a pointer to a VRTextureWithDepth_t.
    631 // This flag can be combined with Submit_TextureWithPose to pass a VRTextureWithPoseAndDepth_t.
    632 Submit_TextureWithDepth = 0x10,
    633 
    634 // Set to indicate a discontinuity between this and the last frame.
    635 // This will prevent motion smoothing from attempting to extrapolate using the pair.
    636 Submit_FrameDiscontinuty = 0x20,
    637 };
    638 
    639 /** Data required for passing Vulkan textures to IVRCompositor::Submit.
    640 * Be sure to call OpenVR_Shutdown before destroying these resources. 
    641 * Please see https://github.com/ValveSoftware/openvr/wiki/Vulkan for Vulkan-specific documentation */
    642 struct VRVulkanTextureData_t
    643 {
    644 uint64_t m_nImage; // VkImage
    645 VkDevice_T *m_pDevice;
    646 VkPhysicalDevice_T *m_pPhysicalDevice;
    647 VkInstance_T *m_pInstance;
    648 VkQueue_T *m_pQueue;
    649 uint32_t m_nQueueFamilyIndex;
    650 uint32_t m_nWidth, m_nHeight, m_nFormat, m_nSampleCount;
    651 };
    652 
    653 /** Data required for passing D3D12 textures to IVRCompositor::Submit.
    654 * Be sure to call OpenVR_Shutdown before destroying these resources. */
    655 struct D3D12TextureData_t
    656 {
    657 ID3D12Resource *m_pResource;
    658 ID3D12CommandQueue *m_pCommandQueue;
    659 uint32_t m_nNodeMask;
    660 };
    661 
    662 /** Status of the overall system or tracked objects */
    663 enum EVRState
    664 {
    665 VRState_Undefined = -1,
    666 VRState_Off = 0,
    667 VRState_Searching = 1,
    668 VRState_Searching_Alert = 2,
    669 VRState_Ready = 3,
    670 VRState_Ready_Alert = 4,
    671 VRState_NotReady = 5,
    672 VRState_Standby = 6,
    673 VRState_Ready_Alert_Low = 7,
    674 };
    675 
    676 /** The types of events that could be posted (and what the parameters mean for each event type) */
    677 enum EVREventType
    678 {
    679 VREvent_None = 0,
    680 
    681 VREvent_TrackedDeviceActivated		= 100,
    682 VREvent_TrackedDeviceDeactivated	= 101,
    683 VREvent_TrackedDeviceUpdated		= 102,
    684 VREvent_TrackedDeviceUserInteractionStarted	= 103,
    685 VREvent_TrackedDeviceUserInteractionEnded	= 104,
    686 VREvent_IpdChanged					= 105,
    687 VREvent_EnterStandbyMode			= 106,
    688 VREvent_LeaveStandbyMode			= 107,
    689 VREvent_TrackedDeviceRoleChanged	= 108,
    690 VREvent_WatchdogWakeUpRequested		= 109,
    691 VREvent_LensDistortionChanged		= 110,
    692 VREvent_PropertyChanged				= 111,
    693 VREvent_WirelessDisconnect			= 112,
    694 VREvent_WirelessReconnect			= 113,
    695 
    696 VREvent_ButtonPress					= 200, // data is controller
    697 VREvent_ButtonUnpress				= 201, // data is controller
    698 VREvent_ButtonTouch					= 202, // data is controller
    699 VREvent_ButtonUntouch				= 203, // data is controller
    700 
    701 // VREvent_DualAnalog_Press			= 250, // No longer sent
    702 // VREvent_DualAnalog_Unpress		= 251, // No longer sent
    703 // VREvent_DualAnalog_Touch			= 252, // No longer sent
    704 // VREvent_DualAnalog_Untouch		= 253, // No longer sent
    705 // VREvent_DualAnalog_Move			= 254, // No longer sent
    706 // VREvent_DualAnalog_ModeSwitch1	= 255, // No longer sent
    707 // VREvent_DualAnalog_ModeSwitch2	= 256, // No longer sent
    708 VREvent_Modal_Cancel				= 257, // Sent to overlays with the 
    709 
    710 VREvent_MouseMove					= 300, // data is mouse
    711 VREvent_MouseButtonDown				= 301, // data is mouse
    712 VREvent_MouseButtonUp				= 302, // data is mouse
    713 VREvent_FocusEnter					= 303, // data is overlay
    714 VREvent_FocusLeave					= 304, // data is overlay
    715 VREvent_ScrollDiscrete				= 305, // data is scroll
    716 VREvent_TouchPadMove				= 306, // data is mouse
    717 VREvent_OverlayFocusChanged			= 307, // data is overlay, global event
    718 VREvent_ReloadOverlays				= 308, 
    719 VREvent_ScrollSmooth				= 309, // data is scroll
    720 VREvent_LockMousePosition			= 310,
    721 VREvent_UnlockMousePosition			= 311,
    722 
    723 VREvent_InputFocusCaptured			= 400, // data is process DEPRECATED
    724 VREvent_InputFocusReleased			= 401, // data is process DEPRECATED
    725 // VREvent_SceneFocusLost			= 402, // data is process
    726 // VREvent_SceneFocusGained			= 403, // data is process
    727 VREvent_SceneApplicationChanged		= 404, // data is process - The App actually drawing the scene changed (usually to or from the compositor)
    728 VREvent_SceneFocusChanged			= 405, // data is process - New app got access to draw the scene
    729 VREvent_InputFocusChanged			= 406, // data is process
    730 // VREvent_SceneApplicationSecondaryRenderingStarted = 407,
    731 VREvent_SceneApplicationUsingWrongGraphicsAdapter = 408, // data is process
    732 VREvent_ActionBindingReloaded		 = 409, // data is process - The App that action binds reloaded for
    733 
    734 VREvent_HideRenderModels			= 410, // Sent to the scene application to request hiding render models temporarily
    735 VREvent_ShowRenderModels			= 411, // Sent to the scene application to request restoring render model visibility
    736 
    737 VREvent_SceneApplicationStateChanged = 412, // No data; but query VRApplications()->GetSceneApplicationState();
    738 
    739 VREvent_ConsoleOpened               = 420,
    740 VREvent_ConsoleClosed               = 421,
    741 
    742 VREvent_OverlayShown				= 500,
    743 VREvent_OverlayHidden				= 501,
    744 VREvent_DashboardActivated			= 502,
    745 VREvent_DashboardDeactivated		= 503,
    746 //VREvent_DashboardThumbSelected		= 504, // Sent to the overlay manager - data is overlay - No longer sent
    747 VREvent_DashboardRequested			= 505, // Sent to the overlay manager - data is overlay
    748 VREvent_ResetDashboard				= 506, // Send to the overlay manager
    749 //VREvent_RenderToast					= 507, // Send to the dashboard to render a toast - data is the notification ID -- no longer sent
    750 VREvent_ImageLoaded					= 508, // Sent to overlays when a SetOverlayRaw or SetOverlayFromFile call finishes loading
    751 VREvent_ShowKeyboard				= 509, // Sent to keyboard renderer in the dashboard to invoke it
    752 VREvent_HideKeyboard				= 510, // Sent to keyboard renderer in the dashboard to hide it
    753 VREvent_OverlayGamepadFocusGained	= 511, // Sent to an overlay when IVROverlay::SetFocusOverlay is called on it
    754 VREvent_OverlayGamepadFocusLost		= 512, // Send to an overlay when it previously had focus and IVROverlay::SetFocusOverlay is called on something else
    755 VREvent_OverlaySharedTextureChanged = 513,
    756 //VREvent_DashboardGuideButtonDown	= 514, // These are no longer sent
    757 //VREvent_DashboardGuideButtonUp		= 515,
    758 VREvent_ScreenshotTriggered			= 516, // Screenshot button combo was pressed, Dashboard should request a screenshot
    759 VREvent_ImageFailed					= 517, // Sent to overlays when a SetOverlayRaw or SetOverlayfromFail fails to load
    760 VREvent_DashboardOverlayCreated		= 518,
    761 VREvent_SwitchGamepadFocus			= 519,
    762 
    763 // Screenshot API
    764 VREvent_RequestScreenshot				= 520, // Sent by vrclient application to compositor to take a screenshot
    765 VREvent_ScreenshotTaken					= 521, // Sent by compositor to the application that the screenshot has been taken
    766 VREvent_ScreenshotFailed				= 522, // Sent by compositor to the application that the screenshot failed to be taken
    767 VREvent_SubmitScreenshotToDashboard		= 523, // Sent by compositor to the dashboard that a completed screenshot was submitted
    768 VREvent_ScreenshotProgressToDashboard	= 524, // Sent by compositor to the dashboard that a completed screenshot was submitted
    769 
    770 VREvent_PrimaryDashboardDeviceChanged	= 525,
    771 VREvent_RoomViewShown					= 526, // Sent by compositor whenever room-view is enabled
    772 VREvent_RoomViewHidden					= 527, // Sent by compositor whenever room-view is disabled
    773 VREvent_ShowUI							= 528, // data is showUi
    774 VREvent_ShowDevTools					= 529, // data is showDevTools
    775 
    776 VREvent_Notification_Shown				= 600,
    777 VREvent_Notification_Hidden				= 601,
    778 VREvent_Notification_BeginInteraction	= 602,
    779 VREvent_Notification_Destroyed			= 603,
    780 
    781 VREvent_Quit							= 700, // data is process
    782 VREvent_ProcessQuit						= 701, // data is process
    783 //VREvent_QuitAborted_UserPrompt			= 702, // data is process
    784 VREvent_QuitAcknowledged				= 703, // data is process
    785 VREvent_DriverRequestedQuit				= 704, // The driver has requested that SteamVR shut down
    786 VREvent_RestartRequested				= 705, // A driver or other component wants the user to restart SteamVR
    787 
    788 VREvent_ChaperoneDataHasChanged			= 800, // this will never happen with the new chaperone system
    789 VREvent_ChaperoneUniverseHasChanged		= 801,
    790 VREvent_ChaperoneTempDataHasChanged		= 802, // this will never happen with the new chaperone system
    791 VREvent_ChaperoneSettingsHaveChanged	= 803,
    792 VREvent_SeatedZeroPoseReset				= 804,
    793 VREvent_ChaperoneFlushCache				= 805, // Sent when the process needs to reload any cached data it retrieved from VRChaperone()
    794 VREvent_ChaperoneRoomSetupStarting	    = 806, // Triggered by CVRChaperoneClient::RoomSetupStarting
    795 VREvent_ChaperoneRoomSetupFinished	    = 807, // Triggered by CVRChaperoneClient::CommitWorkingCopy
    796 
    797 VREvent_AudioSettingsHaveChanged		= 820,
    798 
    799 VREvent_BackgroundSettingHasChanged				= 850,
    800 VREvent_CameraSettingsHaveChanged				= 851,
    801 VREvent_ReprojectionSettingHasChanged			= 852,
    802 VREvent_ModelSkinSettingsHaveChanged			= 853,
    803 VREvent_EnvironmentSettingsHaveChanged			= 854,
    804 VREvent_PowerSettingsHaveChanged				= 855,
    805 VREvent_EnableHomeAppSettingsHaveChanged		= 856,
    806 VREvent_SteamVRSectionSettingChanged			= 857,
    807 VREvent_LighthouseSectionSettingChanged			= 858,
    808 VREvent_NullSectionSettingChanged				= 859,
    809 VREvent_UserInterfaceSectionSettingChanged		= 860,
    810 VREvent_NotificationsSectionSettingChanged		= 861,
    811 VREvent_KeyboardSectionSettingChanged			= 862,
    812 VREvent_PerfSectionSettingChanged				= 863,
    813 VREvent_DashboardSectionSettingChanged			= 864,
    814 VREvent_WebInterfaceSectionSettingChanged		= 865,
    815 VREvent_TrackersSectionSettingChanged			= 866,
    816 VREvent_LastKnownSectionSettingChanged			= 867,
    817 VREvent_DismissedWarningsSectionSettingChanged	= 868,
    818 VREvent_GpuSpeedSectionSettingChanged			= 869,
    819 VREvent_WindowsMRSectionSettingChanged			= 870,
    820 VREvent_OtherSectionSettingChanged				= 871,
    821 
    822 VREvent_StatusUpdate					= 900,
    823 
    824 VREvent_WebInterface_InstallDriverCompleted = 950,
    825 
    826 VREvent_MCImageUpdated					= 1000,
    827 
    828 VREvent_FirmwareUpdateStarted			= 1100,
    829 VREvent_FirmwareUpdateFinished			= 1101,
    830 
    831 VREvent_KeyboardClosed					= 1200,
    832 VREvent_KeyboardCharInput				= 1201,
    833 VREvent_KeyboardDone					= 1202, // Sent when DONE button clicked on keyboard
    834 
    835 //VREvent_ApplicationTransitionStarted		= 1300,
    836 //VREvent_ApplicationTransitionAborted		= 1301,
    837 //VREvent_ApplicationTransitionNewAppStarted	= 1302,
    838 VREvent_ApplicationListUpdated				= 1303,
    839 VREvent_ApplicationMimeTypeLoad				= 1304,
    840 // VREvent_ApplicationTransitionNewAppLaunchComplete = 1305,
    841 VREvent_ProcessConnected					= 1306,
    842 VREvent_ProcessDisconnected					= 1307,
    843 
    844 //VREvent_Compositor_MirrorWindowShown		= 1400, // DEPRECATED
    845 //VREvent_Compositor_MirrorWindowHidden		= 1401, // DEPRECATED
    846 VREvent_Compositor_ChaperoneBoundsShown		= 1410,
    847 VREvent_Compositor_ChaperoneBoundsHidden	= 1411,
    848 VREvent_Compositor_DisplayDisconnected		= 1412,
    849 VREvent_Compositor_DisplayReconnected		= 1413,
    850 VREvent_Compositor_HDCPError				= 1414, // data is hdcpError
    851 VREvent_Compositor_ApplicationNotResponding	= 1415,
    852 VREvent_Compositor_ApplicationResumed		= 1416,
    853 VREvent_Compositor_OutOfVideoMemory			= 1417,
    854 VREvent_Compositor_DisplayModeNotSupported	= 1418, // k_pch_SteamVR_PreferredRefreshRate
    855 VREvent_Compositor_StageOverrideReady		= 1419,
    856 
    857 VREvent_TrackedCamera_StartVideoStream  = 1500,
    858 VREvent_TrackedCamera_StopVideoStream   = 1501,
    859 VREvent_TrackedCamera_PauseVideoStream  = 1502,
    860 VREvent_TrackedCamera_ResumeVideoStream = 1503,
    861 VREvent_TrackedCamera_EditingSurface    = 1550,
    862 
    863 VREvent_PerformanceTest_EnableCapture	= 1600,
    864 VREvent_PerformanceTest_DisableCapture	= 1601,
    865 VREvent_PerformanceTest_FidelityLevel	= 1602,
    866 
    867 VREvent_MessageOverlay_Closed			= 1650,
    868 VREvent_MessageOverlayCloseRequested	= 1651,
    869 
    870 VREvent_Input_HapticVibration			= 1700, // data is hapticVibration
    871 VREvent_Input_BindingLoadFailed			= 1701, // data is inputBinding
    872 VREvent_Input_BindingLoadSuccessful		= 1702, // data is inputBinding
    873 VREvent_Input_ActionManifestReloaded	= 1703, // no data
    874 VREvent_Input_ActionManifestLoadFailed	= 1704, // data is actionManifest
    875 VREvent_Input_ProgressUpdate			= 1705, // data is progressUpdate
    876 VREvent_Input_TrackerActivated			= 1706,
    877 VREvent_Input_BindingsUpdated			= 1707,
    878 VREvent_Input_BindingSubscriptionChanged = 1708,
    879 
    880 VREvent_SpatialAnchors_PoseUpdated		= 1800,        // data is spatialAnchor. broadcast
    881 VREvent_SpatialAnchors_DescriptorUpdated = 1801,       // data is spatialAnchor. broadcast
    882 VREvent_SpatialAnchors_RequestPoseUpdate = 1802,       // data is spatialAnchor. sent to specific driver
    883 VREvent_SpatialAnchors_RequestDescriptorUpdate = 1803, // data is spatialAnchor. sent to specific driver
    884 
    885 VREvent_SystemReport_Started			= 1900, // user or system initiated generation of a system report. broadcast
    886 
    887 VREvent_Monitor_ShowHeadsetView			= 2000, // data is process
    888 VREvent_Monitor_HideHeadsetView			= 2001, // data is process
    889 
    890 // Vendors are free to expose private events in this reserved region
    891 VREvent_VendorSpecific_Reserved_Start	= 10000,
    892 VREvent_VendorSpecific_Reserved_End		= 19999,
    893 };
    894 
    895 
    896 /** Level of Hmd activity */
    897 // UserInteraction_Timeout means the device is in the process of timing out.
    898 // InUse = ( k_EDeviceActivityLevel_UserInteraction || k_EDeviceActivityLevel_UserInteraction_Timeout )
    899 // VREvent_TrackedDeviceUserInteractionStarted fires when the devices transitions from Standby -> UserInteraction or Idle -> UserInteraction.
    900 // VREvent_TrackedDeviceUserInteractionEnded fires when the devices transitions from UserInteraction_Timeout -> Idle
    901 enum EDeviceActivityLevel
    902 {	
    903 k_EDeviceActivityLevel_Unknown = -1,									
    904 k_EDeviceActivityLevel_Idle = 0,						// No activity for the last 10 seconds
    905 k_EDeviceActivityLevel_UserInteraction = 1,				// Activity (movement or prox sensor) is happening now	
    906 k_EDeviceActivityLevel_UserInteraction_Timeout = 2,		// No activity for the last 0.5 seconds
    907 k_EDeviceActivityLevel_Standby = 3,						// Idle for at least 5 seconds (configurable in Settings -> Power Management)
    908 k_EDeviceActivityLevel_Idle_Timeout = 4,
    909 };
    910 
    911 
    912 /** VR controller button and axis IDs */
    913 enum EVRButtonId
    914 {
    915 k_EButton_System			= 0,
    916 k_EButton_ApplicationMenu	= 1,
    917 k_EButton_Grip				= 2,
    918 k_EButton_DPad_Left			= 3,
    919 k_EButton_DPad_Up			= 4,
    920 k_EButton_DPad_Right		= 5,
    921 k_EButton_DPad_Down			= 6,
    922 k_EButton_A					= 7,
    923 
    924 k_EButton_ProximitySensor   = 31,
    925 
    926 k_EButton_Axis0				= 32,
    927 k_EButton_Axis1				= 33,
    928 k_EButton_Axis2				= 34,
    929 k_EButton_Axis3				= 35,
    930 k_EButton_Axis4				= 36,
    931 
    932 // aliases for well known controllers
    933 k_EButton_SteamVR_Touchpad	= k_EButton_Axis0,
    934 k_EButton_SteamVR_Trigger	= k_EButton_Axis1,
    935 
    936 k_EButton_Dashboard_Back	= k_EButton_Grip,
    937 
    938 k_EButton_IndexController_A		= k_EButton_Grip,
    939 k_EButton_IndexController_B		= k_EButton_ApplicationMenu,
    940 k_EButton_IndexController_JoyStick	= k_EButton_Axis3,
    941 
    942 k_EButton_Max				= 64
    943 };
    944 
    945 inline uint64_t ButtonMaskFromId( EVRButtonId id ) { return 1ull << id; }
    946 
    947 /** used for controller button events */
    948 struct VREvent_Controller_t
    949 {
    950 uint32_t button; // EVRButtonId enum
    951 };
    952 
    953 
    954 /** used for simulated mouse events in overlay space */
    955 enum EVRMouseButton
    956 {
    957 VRMouseButton_Left					= 0x0001,
    958 VRMouseButton_Right					= 0x0002,
    959 VRMouseButton_Middle				= 0x0004,
    960 };
    961 
    962 
    963 /** used for simulated mouse events in overlay space */
    964 struct VREvent_Mouse_t
    965 {
    966 float x, y; // co-ords are in GL space, bottom left of the texture is 0,0
    967 uint32_t button; // EVRMouseButton enum
    968 };
    969 
    970 /** used for simulated mouse wheel scroll */
    971 struct VREvent_Scroll_t
    972 {
    973 float xdelta, ydelta;
    974 uint32_t unused;
    975 float viewportscale; // For scrolling on an overlay with laser mouse, this is the overlay's vertical size relative to the overlay height. Range: [0,1]
    976 };
    977 
    978 /** when in mouse input mode you can receive data from the touchpad, these events are only sent if the users finger
    979   is on the touchpad (or just released from it). These events are sent to overlays with the VROverlayFlags_SendVRTouchpadEvents
    980   flag set.
    981 **/
    982 struct VREvent_TouchPadMove_t
    983 {
    984 // true if the users finger is detected on the touch pad
    985 bool bFingerDown;
    986 
    987 // How long the finger has been down in seconds
    988 float flSecondsFingerDown;
    989 
    990 // These values indicate the starting finger position (so you can do some basic swipe stuff)
    991 float fValueXFirst;
    992 float fValueYFirst;
    993 
    994 // This is the raw sampled coordinate without deadzoning
    995 float fValueXRaw;
    996 float fValueYRaw;
    997 };
    998 
    999 /** notification related events. Details will still change at this point */
   1000 struct VREvent_Notification_t
   1001 {
   1002 uint64_t ulUserValue;
   1003 uint32_t notificationId;
   1004 };
   1005 
   1006 /** Used for events about processes */
   1007 struct VREvent_Process_t
   1008 {
   1009 uint32_t pid;
   1010 uint32_t oldPid;
   1011 bool bForced;
   1012 // If the associated event was triggered by a connection loss
   1013 bool bConnectionLost;
   1014 };
   1015 
   1016 
   1017 /** Used for a few events about overlays */
   1018 struct VREvent_Overlay_t
   1019 {
   1020 uint64_t overlayHandle;
   1021 uint64_t devicePath;
   1022 };
   1023 
   1024 
   1025 /** Used for a few events about overlays */
   1026 struct VREvent_Status_t
   1027 {
   1028 uint32_t statusState; // EVRState enum
   1029 };
   1030 
   1031 /** Used for keyboard events **/
   1032 struct VREvent_Keyboard_t
   1033 {
   1034 char cNewInput[8];	// Up to 11 bytes of new input
   1035 uint64_t uUserValue;	// Possible flags about the new input
   1036 };
   1037 
   1038 struct VREvent_Ipd_t
   1039 {
   1040 float ipdMeters;
   1041 };
   1042 
   1043 struct VREvent_Chaperone_t
   1044 {
   1045 uint64_t m_nPreviousUniverse;
   1046 uint64_t m_nCurrentUniverse;
   1047 };
   1048 
   1049 /** Not actually used for any events */
   1050 struct VREvent_Reserved_t
   1051 {
   1052 uint64_t reserved0;
   1053 uint64_t reserved1;
   1054 uint64_t reserved2;
   1055 uint64_t reserved3;
   1056 uint64_t reserved4;
   1057 uint64_t reserved5;
   1058 };
   1059 
   1060 struct VREvent_PerformanceTest_t
   1061 {
   1062 uint32_t m_nFidelityLevel;
   1063 };
   1064 
   1065 struct VREvent_SeatedZeroPoseReset_t
   1066 {
   1067 bool bResetBySystemMenu;
   1068 };
   1069 
   1070 struct VREvent_Screenshot_t
   1071 {
   1072 uint32_t handle;
   1073 uint32_t type;
   1074 };
   1075 
   1076 struct VREvent_ScreenshotProgress_t
   1077 {
   1078 float progress;
   1079 };
   1080 
   1081 struct VREvent_ApplicationLaunch_t
   1082 {
   1083 uint32_t pid;
   1084 uint32_t unArgsHandle;
   1085 };
   1086 
   1087 struct VREvent_EditingCameraSurface_t
   1088 {
   1089 uint64_t overlayHandle;
   1090 uint32_t nVisualMode;
   1091 };
   1092 
   1093 struct VREvent_MessageOverlay_t
   1094 {
   1095 uint32_t unVRMessageOverlayResponse; // vr::VRMessageOverlayResponse enum
   1096 };
   1097 
   1098 struct VREvent_Property_t
   1099 {
   1100 PropertyContainerHandle_t container;
   1101 ETrackedDeviceProperty prop;
   1102 };
   1103 
   1104 struct VREvent_HapticVibration_t
   1105 {
   1106 uint64_t containerHandle; // property container handle of the device with the haptic component
   1107 uint64_t componentHandle; // Which haptic component needs to vibrate
   1108 float fDurationSeconds;
   1109 float fFrequency;
   1110 float fAmplitude;
   1111 };
   1112 
   1113 struct VREvent_WebConsole_t
   1114 {
   1115 WebConsoleHandle_t webConsoleHandle;
   1116 };
   1117 
   1118 struct VREvent_InputBindingLoad_t
   1119 {
   1120 vr::PropertyContainerHandle_t ulAppContainer;
   1121 uint64_t pathMessage;
   1122 uint64_t pathUrl;
   1123 uint64_t pathControllerType;
   1124 };
   1125 
   1126 struct VREvent_InputActionManifestLoad_t
   1127 {
   1128 uint64_t pathAppKey;
   1129 uint64_t pathMessage;
   1130 uint64_t pathMessageParam;
   1131 uint64_t pathManifestPath;
   1132 };
   1133 
   1134 struct VREvent_SpatialAnchor_t
   1135 {
   1136 SpatialAnchorHandle_t unHandle;
   1137 };
   1138 
   1139 struct VREvent_ProgressUpdate_t
   1140 {
   1141 uint64_t ulApplicationPropertyContainer;
   1142 uint64_t pathDevice;
   1143 uint64_t pathInputSource;
   1144 uint64_t pathProgressAction;
   1145 uint64_t pathIcon;
   1146 float fProgress;
   1147 };
   1148 
   1149 enum EShowUIType
   1150 {
   1151 ShowUI_ControllerBinding = 0,
   1152 ShowUI_ManageTrackers = 1,
   1153 // ShowUI_QuickStart = 2, // Deprecated
   1154 ShowUI_Pairing = 3,
   1155 ShowUI_Settings = 4,
   1156 ShowUI_DebugCommands = 5,
   1157 ShowUI_FullControllerBinding = 6,
   1158 ShowUI_ManageDrivers = 7,
   1159 };
   1160 
   1161 struct VREvent_ShowUI_t
   1162 {
   1163 EShowUIType eType;
   1164 };
   1165 
   1166 struct VREvent_ShowDevTools_t
   1167 {
   1168 int32_t nBrowserIdentifier;
   1169 };
   1170 
   1171 enum EHDCPError
   1172 {
   1173 HDCPError_None = 0,
   1174 HDCPError_LinkLost = 1,
   1175 HDCPError_Tampered = 2,
   1176 HDCPError_DeviceRevoked = 3,
   1177 HDCPError_Unknown = 4
   1178 };
   1179 
   1180 struct VREvent_HDCPError_t
   1181 {
   1182 EHDCPError eCode;
   1183 };
   1184 
   1185 typedef union
   1186 {
   1187 VREvent_Reserved_t reserved;
   1188 VREvent_Controller_t controller;
   1189 VREvent_Mouse_t mouse;
   1190 VREvent_Scroll_t scroll;
   1191 VREvent_Process_t process;
   1192 VREvent_Notification_t notification;
   1193 VREvent_Overlay_t overlay;
   1194 VREvent_Status_t status;
   1195 VREvent_Keyboard_t keyboard;
   1196 VREvent_Ipd_t ipd;
   1197 VREvent_Chaperone_t chaperone;
   1198 VREvent_PerformanceTest_t performanceTest;
   1199 VREvent_TouchPadMove_t touchPadMove;
   1200 VREvent_SeatedZeroPoseReset_t seatedZeroPoseReset;
   1201 VREvent_Screenshot_t screenshot;
   1202 VREvent_ScreenshotProgress_t screenshotProgress;
   1203 VREvent_ApplicationLaunch_t applicationLaunch;
   1204 VREvent_EditingCameraSurface_t cameraSurface;
   1205 VREvent_MessageOverlay_t messageOverlay;
   1206 VREvent_Property_t property;
   1207 VREvent_HapticVibration_t hapticVibration;
   1208 VREvent_WebConsole_t webConsole;
   1209 VREvent_InputBindingLoad_t inputBinding;
   1210 VREvent_InputActionManifestLoad_t actionManifest;
   1211 VREvent_SpatialAnchor_t spatialAnchor;
   1212 VREvent_ProgressUpdate_t progressUpdate;
   1213 VREvent_ShowUI_t showUi;
   1214 VREvent_ShowDevTools_t showDevTools;
   1215 VREvent_HDCPError_t hdcpError;
   1216    /** NOTE!!! If you change this you MUST manually update openvr_interop.cs.py */
   1217 } VREvent_Data_t;
   1218 
   1219 
   1220 #if defined(__linux__) || defined(__APPLE__) 
   1221 // This structure was originally defined mis-packed on Linux, preserved for 
   1222 // compatibility. 
   1223 #pragma pack( push, 4 )
   1224 #endif
   1225 
   1226 /** An event posted by the server to all running applications */
   1227 struct VREvent_t
   1228 {
   1229 uint32_t eventType; // EVREventType enum
   1230 TrackedDeviceIndex_t trackedDeviceIndex;
   1231 float eventAgeSeconds;
   1232 // event data must be the end of the struct as its size is variable
   1233 VREvent_Data_t data;
   1234 };
   1235 
   1236 #if defined(__linux__) || defined(__APPLE__) 
   1237 #pragma pack( pop )
   1238 #endif
   1239 
   1240 typedef uint32_t VRComponentProperties;
   1241 
   1242 enum EVRComponentProperty
   1243 {
   1244 VRComponentProperty_IsStatic = (1 << 0),
   1245 VRComponentProperty_IsVisible = (1 << 1),
   1246 VRComponentProperty_IsTouched = (1 << 2),
   1247 VRComponentProperty_IsPressed = (1 << 3),
   1248 VRComponentProperty_IsScrolled = (1 << 4),
   1249 VRComponentProperty_IsHighlighted = (1 << 5),
   1250 };
   1251 
   1252 
   1253 /** Describes state information about a render-model component, including transforms and other dynamic properties */
   1254 struct RenderModel_ComponentState_t
   1255 {
   1256 HmdMatrix34_t mTrackingToComponentRenderModel;  // Transform required when drawing the component render model
   1257 HmdMatrix34_t mTrackingToComponentLocal;        // Transform available for attaching to a local component coordinate system (-Z out from surface )
   1258 VRComponentProperties uProperties;
   1259 };
   1260 
   1261 
   1262 enum EVRInputError
   1263 {
   1264 VRInputError_None = 0,
   1265 VRInputError_NameNotFound = 1,
   1266 VRInputError_WrongType = 2,
   1267 VRInputError_InvalidHandle = 3,
   1268 VRInputError_InvalidParam = 4,
   1269 VRInputError_NoSteam = 5,
   1270 VRInputError_MaxCapacityReached = 6,
   1271 VRInputError_IPCError = 7,
   1272 VRInputError_NoActiveActionSet = 8,
   1273 VRInputError_InvalidDevice = 9,
   1274 VRInputError_InvalidSkeleton = 10,
   1275 VRInputError_InvalidBoneCount = 11,
   1276 VRInputError_InvalidCompressedData = 12,
   1277 VRInputError_NoData = 13,
   1278 VRInputError_BufferTooSmall = 14,
   1279 VRInputError_MismatchedActionManifest = 15,
   1280 VRInputError_MissingSkeletonData = 16,
   1281 VRInputError_InvalidBoneIndex = 17,
   1282 VRInputError_InvalidPriority = 18,
   1283 VRInputError_PermissionDenied = 19,
   1284 VRInputError_InvalidRenderModel = 20,
   1285 };
   1286 
   1287 enum EVRSpatialAnchorError
   1288 {
   1289 VRSpatialAnchorError_Success = 0,
   1290 VRSpatialAnchorError_Internal = 1,
   1291 VRSpatialAnchorError_UnknownHandle = 2,
   1292 VRSpatialAnchorError_ArrayTooSmall = 3,
   1293 VRSpatialAnchorError_InvalidDescriptorChar = 4,
   1294 VRSpatialAnchorError_NotYetAvailable = 5,
   1295 VRSpatialAnchorError_NotAvailableInThisUniverse = 6,
   1296 VRSpatialAnchorError_PermanentlyUnavailable = 7,
   1297 VRSpatialAnchorError_WrongDriver = 8,
   1298 VRSpatialAnchorError_DescriptorTooLong = 9,
   1299 VRSpatialAnchorError_Unknown = 10,
   1300 VRSpatialAnchorError_NoRoomCalibration = 11,
   1301 VRSpatialAnchorError_InvalidArgument = 12,
   1302 VRSpatialAnchorError_UnknownDriver = 13,
   1303 };
   1304 
   1305 /** The mesh to draw into the stencil (or depth) buffer to perform 
   1306 * early stencil (or depth) kills of pixels that will never appear on the HMD.
   1307 * This mesh draws on all the pixels that will be hidden after distortion. 
   1308 *
   1309 * If the HMD does not provide a visible area mesh pVertexData will be
   1310 * NULL and unTriangleCount will be 0. */
   1311 struct HiddenAreaMesh_t
   1312 {
   1313 const HmdVector2_t *pVertexData;
   1314 uint32_t unTriangleCount;
   1315 };
   1316 
   1317 
   1318 enum EHiddenAreaMeshType
   1319 {
   1320 k_eHiddenAreaMesh_Standard = 0,
   1321 k_eHiddenAreaMesh_Inverse = 1,
   1322 k_eHiddenAreaMesh_LineLoop = 2,
   1323 
   1324 k_eHiddenAreaMesh_Max = 3,
   1325 };
   1326 
   1327 
   1328 /** Identifies what kind of axis is on the controller at index n. Read this type 
   1329 * with pVRSystem->Get( nControllerDeviceIndex, Prop_Axis0Type_Int32 + n );
   1330 */
   1331 enum EVRControllerAxisType
   1332 {
   1333 k_eControllerAxis_None = 0,
   1334 k_eControllerAxis_TrackPad = 1,
   1335 k_eControllerAxis_Joystick = 2,
   1336 k_eControllerAxis_Trigger = 3, // Analog trigger data is in the X axis
   1337 };
   1338 
   1339 
   1340 /** contains information about one axis on the controller */
   1341 struct VRControllerAxis_t
   1342 {
   1343 float x; // Ranges from -1.0 to 1.0 for joysticks and track pads. Ranges from 0.0 to 1.0 for triggers were 0 is fully released.
   1344 float y; // Ranges from -1.0 to 1.0 for joysticks and track pads. Is always 0.0 for triggers.
   1345 };
   1346 
   1347 
   1348 /** the number of axes in the controller state */
   1349 static const uint32_t k_unControllerStateAxisCount = 5;
   1350 
   1351 
   1352 #if defined(__linux__) || defined(__APPLE__) 
   1353 // This structure was originally defined mis-packed on Linux, preserved for 
   1354 // compatibility. 
   1355 #pragma pack( push, 4 )
   1356 #endif
   1357 
   1358 /** Holds all the state of a controller at one moment in time. */
   1359 struct VRControllerState001_t
   1360 {
   1361 // If packet num matches that on your prior call, then the controller state hasn't been changed since 
   1362 // your last call and there is no need to process it
   1363 uint32_t unPacketNum;
   1364 
   1365 // bit flags for each of the buttons. Use ButtonMaskFromId to turn an ID into a mask
   1366 uint64_t ulButtonPressed;
   1367 uint64_t ulButtonTouched;
   1368 
   1369 // Axis data for the controller's analog inputs
   1370 VRControllerAxis_t rAxis[ k_unControllerStateAxisCount ];
   1371 };
   1372 #if defined(__linux__) || defined(__APPLE__) 
   1373 #pragma pack( pop )
   1374 #endif
   1375 
   1376 
   1377 typedef VRControllerState001_t VRControllerState_t;
   1378 
   1379 
   1380 /** determines how to provide output to the application of various event processing functions. */
   1381 enum EVRControllerEventOutputType
   1382 {
   1383 ControllerEventOutput_OSEvents = 0,
   1384 ControllerEventOutput_VREvents = 1,
   1385 };
   1386 
   1387 
   1388 
   1389 /** Collision Bounds Style */
   1390 enum ECollisionBoundsStyle
   1391 {
   1392 COLLISION_BOUNDS_STYLE_BEGINNER = 0,
   1393 COLLISION_BOUNDS_STYLE_INTERMEDIATE,
   1394 COLLISION_BOUNDS_STYLE_SQUARES,
   1395 COLLISION_BOUNDS_STYLE_ADVANCED,
   1396 COLLISION_BOUNDS_STYLE_NONE,
   1397 
   1398 COLLISION_BOUNDS_STYLE_COUNT
   1399 };
   1400 
   1401 /** used to refer to a single VR overlay */
   1402 typedef uint64_t VROverlayHandle_t;
   1403 
   1404 static const VROverlayHandle_t k_ulOverlayHandleInvalid = 0;
   1405 
   1406 /** Errors that can occur around VR overlays */
   1407 enum EVROverlayError
   1408 {
   1409 VROverlayError_None						= 0,
   1410 
   1411 VROverlayError_UnknownOverlay			= 10,
   1412 VROverlayError_InvalidHandle			= 11,
   1413 VROverlayError_PermissionDenied			= 12,
   1414 VROverlayError_OverlayLimitExceeded		= 13, // No more overlays could be created because the maximum number already exist
   1415 VROverlayError_WrongVisibilityType		= 14,
   1416 VROverlayError_KeyTooLong				= 15,
   1417 VROverlayError_NameTooLong				= 16,
   1418 VROverlayError_KeyInUse					= 17,
   1419 VROverlayError_WrongTransformType		= 18,
   1420 VROverlayError_InvalidTrackedDevice		= 19,
   1421 VROverlayError_InvalidParameter			= 20,
   1422 VROverlayError_ThumbnailCantBeDestroyed	= 21,
   1423 VROverlayError_ArrayTooSmall			= 22,
   1424 VROverlayError_RequestFailed			= 23,
   1425 VROverlayError_InvalidTexture			= 24,
   1426 VROverlayError_UnableToLoadFile			= 25,
   1427 VROverlayError_KeyboardAlreadyInUse		= 26,
   1428 VROverlayError_NoNeighbor				= 27,
   1429 VROverlayError_TooManyMaskPrimitives	= 29,
   1430 VROverlayError_BadMaskPrimitive			= 30,
   1431 VROverlayError_TextureAlreadyLocked		= 31,
   1432 VROverlayError_TextureLockCapacityReached = 32,
   1433 VROverlayError_TextureNotLocked			= 33,
   1434 };
   1435 
   1436 /** enum values to pass in to VR_Init to identify whether the application will 
   1437 * draw a 3D scene. */
   1438 enum EVRApplicationType
   1439 {
   1440 VRApplication_Other = 0,		// Some other kind of application that isn't covered by the other entries 
   1441 VRApplication_Scene	= 1,		// Application will submit 3D frames 
   1442 VRApplication_Overlay = 2,		// Application only interacts with overlays
   1443 VRApplication_Background = 3,	// Application should not start SteamVR if it's not already running, and should not
   1444 								// keep it running if everything else quits.
   1445 VRApplication_Utility = 4,		// Init should not try to load any drivers. The application needs access to utility
   1446 								// interfaces (like IVRSettings and IVRApplications) but not hardware.
   1447 VRApplication_VRMonitor = 5,	// Reserved for vrmonitor
   1448 VRApplication_SteamWatchdog = 6,// Reserved for Steam
   1449 VRApplication_Bootstrapper = 7, // reserved for vrstartup
   1450 VRApplication_WebHelper = 8,	// reserved for vrwebhelper
   1451 
   1452 VRApplication_Max
   1453 };
   1454 
   1455 
   1456 /** error codes for firmware */
   1457 enum EVRFirmwareError
   1458 {
   1459 VRFirmwareError_None = 0,
   1460 VRFirmwareError_Success = 1,
   1461 VRFirmwareError_Fail = 2,
   1462 };
   1463 
   1464 
   1465 /** error codes for notifications */
   1466 enum EVRNotificationError
   1467 {
   1468 VRNotificationError_OK = 0,
   1469 VRNotificationError_InvalidNotificationId = 100,
   1470 VRNotificationError_NotificationQueueFull = 101,
   1471 VRNotificationError_InvalidOverlayHandle = 102,
   1472 VRNotificationError_SystemWithUserValueAlreadyExists = 103,
   1473 };
   1474 
   1475 
   1476 enum EVRSkeletalMotionRange
   1477 {
   1478 // The range of motion of the skeleton takes into account any physical limits imposed by
   1479 // the controller itself.  This will tend to be the most accurate pose compared to the user's
   1480 // actual hand pose, but might not allow a closed fist for example
   1481 VRSkeletalMotionRange_WithController = 0,
   1482 
   1483 // Retarget the range of motion provided by the input device to make the hand appear to move
   1484 // as if it was not holding a controller.  eg: map "hand grasping controller" to "closed fist"
   1485 VRSkeletalMotionRange_WithoutController = 1,
   1486 };
   1487 
   1488 enum EVRSkeletalTrackingLevel
   1489 {
   1490 // body part location can't be directly determined by the device. Any skeletal pose provided by
   1491 // the device is estimated by assuming the position required to active buttons, triggers, joysticks, 
   1492 // or other input sensors. 
   1493 // E.g. Vive Controller, Gamepad
   1494 VRSkeletalTracking_Estimated = 0,
   1495 
   1496 // body part location can be measured directly but with fewer degrees of freedom than the actual body 
   1497 // part. Certain body part positions may be unmeasured by the device and estimated from other input data. 
   1498 // E.g. Index Controllers, gloves that only measure finger curl
   1499 VRSkeletalTracking_Partial = 1,
   1500 
   1501 // Body part location can be measured directly throughout the entire range of motion of the body part. 
   1502 // E.g. Mocap suit for the full body, gloves that measure rotation of each finger segment
   1503 VRSkeletalTracking_Full = 2,
   1504 
   1505 VRSkeletalTrackingLevel_Count,
   1506 VRSkeletalTrackingLevel_Max = VRSkeletalTrackingLevel_Count - 1
   1507 };
   1508 
   1509 
   1510 
   1511 /** Holds the transform for a single bone */
   1512 struct VRBoneTransform_t
   1513 {
   1514 HmdVector4_t position;
   1515 HmdQuaternionf_t orientation;
   1516 };
   1517 
   1518 /** Type used for referring to bones by their index */
   1519 typedef int32_t BoneIndex_t;
   1520 const BoneIndex_t k_unInvalidBoneIndex = -1;
   1521 
   1522 
   1523 /** error codes returned by Vr_Init */
   1524 
   1525 // Please add adequate error description to https://developer.valvesoftware.com/w/index.php?title=Category:SteamVRHelp
   1526 enum EVRInitError
   1527 {
   1528 VRInitError_None	= 0,
   1529 VRInitError_Unknown = 1,
   1530 
   1531 VRInitError_Init_InstallationNotFound			= 100,
   1532 VRInitError_Init_InstallationCorrupt			= 101,
   1533 VRInitError_Init_VRClientDLLNotFound			= 102,
   1534 VRInitError_Init_FileNotFound					= 103,
   1535 VRInitError_Init_FactoryNotFound				= 104,
   1536 VRInitError_Init_InterfaceNotFound				= 105,
   1537 VRInitError_Init_InvalidInterface				= 106,
   1538 VRInitError_Init_UserConfigDirectoryInvalid		= 107,
   1539 VRInitError_Init_HmdNotFound					= 108,
   1540 VRInitError_Init_NotInitialized					= 109,
   1541 VRInitError_Init_PathRegistryNotFound			= 110,
   1542 VRInitError_Init_NoConfigPath					= 111,
   1543 VRInitError_Init_NoLogPath						= 112,
   1544 VRInitError_Init_PathRegistryNotWritable		= 113,
   1545 VRInitError_Init_AppInfoInitFailed				= 114,
   1546 VRInitError_Init_Retry							= 115, // Used internally to cause retries to vrserver
   1547 VRInitError_Init_InitCanceledByUser				= 116, // The calling application should silently exit. The user canceled app startup
   1548 VRInitError_Init_AnotherAppLaunching			= 117, 
   1549 VRInitError_Init_SettingsInitFailed				= 118, 
   1550 VRInitError_Init_ShuttingDown					= 119,
   1551 VRInitError_Init_TooManyObjects					= 120,
   1552 VRInitError_Init_NoServerForBackgroundApp		= 121,
   1553 VRInitError_Init_NotSupportedWithCompositor		= 122,
   1554 VRInitError_Init_NotAvailableToUtilityApps		= 123,
   1555 VRInitError_Init_Internal				 		= 124,
   1556 VRInitError_Init_HmdDriverIdIsNone		 		= 125,
   1557 VRInitError_Init_HmdNotFoundPresenceFailed 		= 126,
   1558 VRInitError_Init_VRMonitorNotFound				= 127,
   1559 VRInitError_Init_VRMonitorStartupFailed			= 128,
   1560 VRInitError_Init_LowPowerWatchdogNotSupported	= 129, 
   1561 VRInitError_Init_InvalidApplicationType			= 130,
   1562 VRInitError_Init_NotAvailableToWatchdogApps		= 131,
   1563 VRInitError_Init_WatchdogDisabledInSettings		= 132,
   1564 VRInitError_Init_VRDashboardNotFound			= 133,
   1565 VRInitError_Init_VRDashboardStartupFailed		= 134,
   1566 VRInitError_Init_VRHomeNotFound					= 135,
   1567 VRInitError_Init_VRHomeStartupFailed			= 136,
   1568 VRInitError_Init_RebootingBusy					= 137,
   1569 VRInitError_Init_FirmwareUpdateBusy				= 138,
   1570 VRInitError_Init_FirmwareRecoveryBusy			= 139,
   1571 VRInitError_Init_USBServiceBusy					= 140,
   1572 VRInitError_Init_VRWebHelperStartupFailed		= 141,
   1573 VRInitError_Init_TrackerManagerInitFailed		= 142,
   1574 VRInitError_Init_AlreadyRunning					= 143,
   1575 VRInitError_Init_FailedForVrMonitor				= 144,
   1576 VRInitError_Init_PropertyManagerInitFailed		= 145,
   1577 VRInitError_Init_WebServerFailed				= 146,
   1578 
   1579 VRInitError_Driver_Failed						= 200,
   1580 VRInitError_Driver_Unknown						= 201,
   1581 VRInitError_Driver_HmdUnknown					= 202,
   1582 VRInitError_Driver_NotLoaded					= 203,
   1583 VRInitError_Driver_RuntimeOutOfDate				= 204,
   1584 VRInitError_Driver_HmdInUse						= 205,
   1585 VRInitError_Driver_NotCalibrated				= 206,
   1586 VRInitError_Driver_CalibrationInvalid			= 207,
   1587 VRInitError_Driver_HmdDisplayNotFound			= 208,
   1588 VRInitError_Driver_TrackedDeviceInterfaceUnknown = 209,
   1589 // VRInitError_Driver_HmdDisplayNotFoundAfterFix = 210, // not needed: here for historic reasons
   1590 VRInitError_Driver_HmdDriverIdOutOfBounds		= 211,
   1591 VRInitError_Driver_HmdDisplayMirrored			= 212,
   1592 VRInitError_Driver_HmdDisplayNotFoundLaptop		= 213,
   1593 // Never make error 259 because we return it from main and it would conflict with STILL_ACTIVE
   1594 
   1595 VRInitError_IPC_ServerInitFailed				= 300,
   1596 VRInitError_IPC_ConnectFailed					= 301,
   1597 VRInitError_IPC_SharedStateInitFailed			= 302,
   1598 VRInitError_IPC_CompositorInitFailed			= 303,
   1599 VRInitError_IPC_MutexInitFailed					= 304,
   1600 VRInitError_IPC_Failed							= 305,
   1601 VRInitError_IPC_CompositorConnectFailed			= 306,
   1602 VRInitError_IPC_CompositorInvalidConnectResponse = 307,
   1603 VRInitError_IPC_ConnectFailedAfterMultipleAttempts = 308,
   1604 VRInitError_IPC_ConnectFailedAfterTargetExited = 309,
   1605 VRInitError_IPC_NamespaceUnavailable			 = 310,
   1606 
   1607 VRInitError_Compositor_Failed												= 400,
   1608 VRInitError_Compositor_D3D11HardwareRequired								= 401,
   1609 VRInitError_Compositor_FirmwareRequiresUpdate								= 402,
   1610 VRInitError_Compositor_OverlayInitFailed									= 403,
   1611 VRInitError_Compositor_ScreenshotsInitFailed								= 404,
   1612 VRInitError_Compositor_UnableToCreateDevice									= 405,
   1613 VRInitError_Compositor_SharedStateIsNull									= 406,
   1614 VRInitError_Compositor_NotificationManagerIsNull							= 407,
   1615 VRInitError_Compositor_ResourceManagerClientIsNull							= 408,
   1616 VRInitError_Compositor_MessageOverlaySharedStateInitFailure					= 409,
   1617 VRInitError_Compositor_PropertiesInterfaceIsNull							= 410,
   1618 VRInitError_Compositor_CreateFullscreenWindowFailed							= 411,
   1619 VRInitError_Compositor_SettingsInterfaceIsNull								= 412,
   1620 VRInitError_Compositor_FailedToShowWindow									= 413,
   1621 VRInitError_Compositor_DistortInterfaceIsNull								= 414,
   1622 VRInitError_Compositor_DisplayFrequencyFailure								= 415,
   1623 VRInitError_Compositor_RendererInitializationFailed							= 416,
   1624 VRInitError_Compositor_DXGIFactoryInterfaceIsNull							= 417,
   1625 VRInitError_Compositor_DXGIFactoryCreateFailed								= 418,
   1626 VRInitError_Compositor_DXGIFactoryQueryFailed								= 419,
   1627 VRInitError_Compositor_InvalidAdapterDesktop								= 420,
   1628 VRInitError_Compositor_InvalidHmdAttachment									= 421,
   1629 VRInitError_Compositor_InvalidOutputDesktop									= 422,
   1630 VRInitError_Compositor_InvalidDeviceProvided								= 423,
   1631 VRInitError_Compositor_D3D11RendererInitializationFailed					= 424,
   1632 VRInitError_Compositor_FailedToFindDisplayMode								= 425,
   1633 VRInitError_Compositor_FailedToCreateSwapChain								= 426,
   1634 VRInitError_Compositor_FailedToGetBackBuffer								= 427,
   1635 VRInitError_Compositor_FailedToCreateRenderTarget							= 428,
   1636 VRInitError_Compositor_FailedToCreateDXGI2SwapChain							= 429,
   1637 VRInitError_Compositor_FailedtoGetDXGI2BackBuffer							= 430,
   1638 VRInitError_Compositor_FailedToCreateDXGI2RenderTarget						= 431,
   1639 VRInitError_Compositor_FailedToGetDXGIDeviceInterface						= 432,
   1640 VRInitError_Compositor_SelectDisplayMode									= 433,
   1641 VRInitError_Compositor_FailedToCreateNvAPIRenderTargets						= 434,
   1642 VRInitError_Compositor_NvAPISetDisplayMode									= 435,
   1643 VRInitError_Compositor_FailedToCreateDirectModeDisplay						= 436,
   1644 VRInitError_Compositor_InvalidHmdPropertyContainer							= 437,
   1645 VRInitError_Compositor_UpdateDisplayFrequency								= 438,
   1646 VRInitError_Compositor_CreateRasterizerState								= 439,
   1647 VRInitError_Compositor_CreateWireframeRasterizerState						= 440,
   1648 VRInitError_Compositor_CreateSamplerState									= 441,
   1649 VRInitError_Compositor_CreateClampToBorderSamplerState						= 442,
   1650 VRInitError_Compositor_CreateAnisoSamplerState								= 443,
   1651 VRInitError_Compositor_CreateOverlaySamplerState							= 444,
   1652 VRInitError_Compositor_CreatePanoramaSamplerState							= 445,
   1653 VRInitError_Compositor_CreateFontSamplerState								= 446,
   1654 VRInitError_Compositor_CreateNoBlendState									= 447,
   1655 VRInitError_Compositor_CreateBlendState										= 448,
   1656 VRInitError_Compositor_CreateAlphaBlendState								= 449,
   1657 VRInitError_Compositor_CreateBlendStateMaskR								= 450,
   1658 VRInitError_Compositor_CreateBlendStateMaskG								= 451,
   1659 VRInitError_Compositor_CreateBlendStateMaskB								= 452,
   1660 VRInitError_Compositor_CreateDepthStencilState								= 453,
   1661 VRInitError_Compositor_CreateDepthStencilStateNoWrite						= 454,
   1662 VRInitError_Compositor_CreateDepthStencilStateNoDepth						= 455,
   1663 VRInitError_Compositor_CreateFlushTexture									= 456,
   1664 VRInitError_Compositor_CreateDistortionSurfaces								= 457,
   1665 VRInitError_Compositor_CreateConstantBuffer									= 458,
   1666 VRInitError_Compositor_CreateHmdPoseConstantBuffer							= 459,
   1667 VRInitError_Compositor_CreateHmdPoseStagingConstantBuffer					= 460,
   1668 VRInitError_Compositor_CreateSharedFrameInfoConstantBuffer					= 461,
   1669 VRInitError_Compositor_CreateOverlayConstantBuffer							= 462,
   1670 VRInitError_Compositor_CreateSceneTextureIndexConstantBuffer				= 463,
   1671 VRInitError_Compositor_CreateReadableSceneTextureIndexConstantBuffer		= 464,
   1672 VRInitError_Compositor_CreateLayerGraphicsTextureIndexConstantBuffer		= 465,
   1673 VRInitError_Compositor_CreateLayerComputeTextureIndexConstantBuffer			= 466,
   1674 VRInitError_Compositor_CreateLayerComputeSceneTextureIndexConstantBuffer	= 467,
   1675 VRInitError_Compositor_CreateComputeHmdPoseConstantBuffer					= 468,
   1676 VRInitError_Compositor_CreateGeomConstantBuffer								= 469,
   1677 VRInitError_Compositor_CreatePanelMaskConstantBuffer						= 470,
   1678 VRInitError_Compositor_CreatePixelSimUBO									= 471,
   1679 VRInitError_Compositor_CreateMSAARenderTextures								= 472,
   1680 VRInitError_Compositor_CreateResolveRenderTextures							= 473,
   1681 VRInitError_Compositor_CreateComputeResolveRenderTextures					= 474,
   1682 VRInitError_Compositor_CreateDriverDirectModeResolveTextures				= 475,
   1683 VRInitError_Compositor_OpenDriverDirectModeResolveTextures					= 476,
   1684 VRInitError_Compositor_CreateFallbackSyncTexture							= 477,
   1685 VRInitError_Compositor_ShareFallbackSyncTexture								= 478,
   1686 VRInitError_Compositor_CreateOverlayIndexBuffer								= 479,
   1687 VRInitError_Compositor_CreateOverlayVertexBuffer							= 480,
   1688 VRInitError_Compositor_CreateTextVertexBuffer								= 481,
   1689 VRInitError_Compositor_CreateTextIndexBuffer								= 482,
   1690 VRInitError_Compositor_CreateMirrorTextures									= 483,
   1691 VRInitError_Compositor_CreateLastFrameRenderTexture							= 484,
   1692 VRInitError_Compositor_CreateMirrorOverlay									= 485,
   1693 VRInitError_Compositor_FailedToCreateVirtualDisplayBackbuffer				= 486,
   1694 VRInitError_Compositor_DisplayModeNotSupported								= 487,
   1695 VRInitError_Compositor_CreateOverlayInvalidCall								= 488,
   1696 VRInitError_Compositor_CreateOverlayAlreadyInitialized						= 489,
   1697 VRInitError_Compositor_FailedToCreateMailbox								= 490,
   1698 
   1699 VRInitError_VendorSpecific_UnableToConnectToOculusRuntime		= 1000,
   1700 VRInitError_VendorSpecific_WindowsNotInDevMode					= 1001,
   1701 
   1702 VRInitError_VendorSpecific_HmdFound_CantOpenDevice 				= 1101,
   1703 VRInitError_VendorSpecific_HmdFound_UnableToRequestConfigStart	= 1102,
   1704 VRInitError_VendorSpecific_HmdFound_NoStoredConfig 				= 1103,
   1705 VRInitError_VendorSpecific_HmdFound_ConfigTooBig 				= 1104,
   1706 VRInitError_VendorSpecific_HmdFound_ConfigTooSmall 				= 1105,
   1707 VRInitError_VendorSpecific_HmdFound_UnableToInitZLib 			= 1106,
   1708 VRInitError_VendorSpecific_HmdFound_CantReadFirmwareVersion 	= 1107,
   1709 VRInitError_VendorSpecific_HmdFound_UnableToSendUserDataStart	= 1108,
   1710 VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataStart	= 1109,
   1711 VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataNext		= 1110,
   1712 VRInitError_VendorSpecific_HmdFound_UserDataAddressRange		= 1111,
   1713 VRInitError_VendorSpecific_HmdFound_UserDataError				= 1112,
   1714 VRInitError_VendorSpecific_HmdFound_ConfigFailedSanityCheck		= 1113,
   1715 VRInitError_VendorSpecific_OculusRuntimeBadInstall				= 1114,
   1716 
   1717 VRInitError_Steam_SteamInstallationNotFound = 2000,
   1718 
   1719 // Strictly a placeholder
   1720 VRInitError_LastError
   1721 };
   1722 
   1723 enum EVRScreenshotType
   1724 {
   1725 VRScreenshotType_None = 0,
   1726 VRScreenshotType_Mono = 1, // left eye only
   1727 VRScreenshotType_Stereo = 2,
   1728 VRScreenshotType_Cubemap = 3,
   1729 VRScreenshotType_MonoPanorama = 4,
   1730 VRScreenshotType_StereoPanorama = 5
   1731 };
   1732 
   1733 enum EVRScreenshotPropertyFilenames
   1734 {
   1735 VRScreenshotPropertyFilenames_Preview = 0,
   1736 VRScreenshotPropertyFilenames_VR = 1,
   1737 };
   1738 
   1739 enum EVRTrackedCameraError
   1740 {
   1741 VRTrackedCameraError_None                       = 0,
   1742 VRTrackedCameraError_OperationFailed            = 100,
   1743 VRTrackedCameraError_InvalidHandle              = 101,	
   1744 VRTrackedCameraError_InvalidFrameHeaderVersion  = 102,
   1745 VRTrackedCameraError_OutOfHandles               = 103,
   1746 VRTrackedCameraError_IPCFailure                 = 104,
   1747 VRTrackedCameraError_NotSupportedForThisDevice  = 105,
   1748 VRTrackedCameraError_SharedMemoryFailure        = 106,
   1749 VRTrackedCameraError_FrameBufferingFailure      = 107,
   1750 VRTrackedCameraError_StreamSetupFailure         = 108,
   1751 VRTrackedCameraError_InvalidGLTextureId         = 109,
   1752 VRTrackedCameraError_InvalidSharedTextureHandle = 110,
   1753 VRTrackedCameraError_FailedToGetGLTextureId     = 111,
   1754 VRTrackedCameraError_SharedTextureFailure       = 112,
   1755 VRTrackedCameraError_NoFrameAvailable           = 113,
   1756 VRTrackedCameraError_InvalidArgument            = 114,
   1757 VRTrackedCameraError_InvalidFrameBufferSize     = 115,
   1758 };
   1759 
   1760 enum EVRTrackedCameraFrameLayout
   1761 {
   1762 EVRTrackedCameraFrameLayout_Mono				= 0x0001,
   1763 EVRTrackedCameraFrameLayout_Stereo				= 0x0002,
   1764 EVRTrackedCameraFrameLayout_VerticalLayout		= 0x0010,	// Stereo frames are Top/Bottom (left/right)
   1765 EVRTrackedCameraFrameLayout_HorizontalLayout	= 0x0020,	// Stereo frames are Left/Right
   1766 };
   1767 
   1768 enum EVRTrackedCameraFrameType
   1769 {
   1770 VRTrackedCameraFrameType_Distorted = 0,			// This is the camera video frame size in pixels, still distorted.
   1771 VRTrackedCameraFrameType_Undistorted,			// In pixels, an undistorted inscribed rectangle region without invalid regions. This size is subject to changes shortly.
   1772 VRTrackedCameraFrameType_MaximumUndistorted,	// In pixels, maximum undistorted with invalid regions. Non zero alpha component identifies valid regions.
   1773 MAX_CAMERA_FRAME_TYPES
   1774 };
   1775 
   1776 enum EVRDistortionFunctionType
   1777 {
   1778 VRDistortionFunctionType_None,
   1779 VRDistortionFunctionType_FTheta,
   1780 VRDistortionFunctionType_Extended_FTheta,
   1781 MAX_DISTORTION_FUNCTION_TYPES,
   1782 };
   1783 
   1784 static const uint32_t k_unMaxDistortionFunctionParameters = 8;
   1785 
   1786 typedef uint64_t TrackedCameraHandle_t;
   1787 #define INVALID_TRACKED_CAMERA_HANDLE	((vr::TrackedCameraHandle_t)0)
   1788 
   1789 struct CameraVideoStreamFrameHeader_t
   1790 {
   1791 EVRTrackedCameraFrameType eFrameType;
   1792 
   1793 uint32_t nWidth;
   1794 uint32_t nHeight;
   1795 uint32_t nBytesPerPixel;
   1796 
   1797 uint32_t nFrameSequence;
   1798 
   1799 TrackedDevicePose_t trackedDevicePose;
   1800 
   1801 uint64_t ulFrameExposureTime;						// mid-point of the exposure of the image in host system ticks
   1802 };
   1803 
   1804 // Screenshot types
   1805 typedef uint32_t ScreenshotHandle_t;
   1806 
   1807 static const uint32_t k_unScreenshotHandleInvalid = 0;
   1808 
   1809 /** Compositor frame timing reprojection flags. */
   1810 const uint32_t VRCompositor_ReprojectionReason_Cpu = 0x01;
   1811 const uint32_t VRCompositor_ReprojectionReason_Gpu = 0x02;
   1812 const uint32_t VRCompositor_ReprojectionAsync = 0x04;	// This flag indicates the async reprojection mode is active,
   1813 														// but does not indicate if reprojection actually happened or not.
   1814 														// Use the ReprojectionReason flags above to check if reprojection
   1815 														// was actually applied (i.e. scene texture was reused).
   1816 														// NumFramePresents > 1 also indicates the scene texture was reused,
   1817 														// and also the number of times that it was presented in total.
   1818 
   1819 const uint32_t VRCompositor_ReprojectionMotion = 0x08;	// This flag indicates whether or not motion smoothing was triggered for this frame
   1820 
   1821 const uint32_t VRCompositor_PredictionMask = 0x30;	// The runtime may predict more than one frame (up to four) ahead if
   1822 														// it detects the application is taking too long to render. These two
   1823 														// bits will contain the count of additional frames (normally zero).
   1824 														// Use the VR_COMPOSITOR_ADDITIONAL_PREDICTED_FRAMES macro to read from
   1825 														// the latest frame timing entry.
   1826 
   1827 const uint32_t VRCompositor_ThrottleMask = 0xC0;	// Number of frames the compositor is throttling the application.
   1828 														// Use the VR_COMPOSITOR_NUMBER_OF_THROTTLED_FRAMES macro to read from
   1829 														// the latest frame timing entry.
   1830 
   1831 #define VR_COMPOSITOR_ADDITIONAL_PREDICTED_FRAMES( timing ) ( ( ( timing ).m_nReprojectionFlags & vr::VRCompositor_PredictionMask ) >> 4 )
   1832 #define VR_COMPOSITOR_NUMBER_OF_THROTTLED_FRAMES( timing ) ( ( ( timing ).m_nReprojectionFlags & vr::VRCompositor_ThrottleMask ) >> 6 )
   1833 
   1834 /** Provides a single frame's timing information to the app */
   1835 struct Compositor_FrameTiming
   1836 {
   1837 uint32_t m_nSize; // Set to sizeof( Compositor_FrameTiming )
   1838 uint32_t m_nFrameIndex;
   1839 uint32_t m_nNumFramePresents; // number of times this frame was presented
   1840 uint32_t m_nNumMisPresented; // number of times this frame was presented on a vsync other than it was originally predicted to
   1841 uint32_t m_nNumDroppedFrames; // number of additional times previous frame was scanned out
   1842 uint32_t m_nReprojectionFlags;
   1843 
   1844 /** Absolute time reference for comparing frames.  This aligns with the vsync that running start is relative to. */
   1845 double m_flSystemTimeInSeconds;
   1846 
   1847 /** These times may include work from other processes due to OS scheduling.
   1848 * The fewer packets of work these are broken up into, the less likely this will happen.
   1849 * GPU work can be broken up by calling Flush.  This can sometimes be useful to get the GPU started
   1850 * processing that work earlier in the frame. */
   1851 float m_flPreSubmitGpuMs; // time spent rendering the scene (gpu work submitted between WaitGetPoses and second Submit)
   1852 float m_flPostSubmitGpuMs; // additional time spent rendering by application (e.g. companion window)
   1853 float m_flTotalRenderGpuMs; // time between work submitted immediately after present (ideally vsync) until the end of compositor submitted work
   1854 float m_flCompositorRenderGpuMs; // time spend performing distortion correction, rendering chaperone, overlays, etc.
   1855 float m_flCompositorRenderCpuMs; // time spent on cpu submitting the above work for this frame
   1856 float m_flCompositorIdleCpuMs; // time spent waiting for running start (application could have used this much more time)
   1857 
   1858 /** Miscellaneous measured intervals. */
   1859 float m_flClientFrameIntervalMs; // time between calls to WaitGetPoses
   1860 float m_flPresentCallCpuMs; // time blocked on call to present (usually 0.0, but can go long)
   1861 float m_flWaitForPresentCpuMs; // time spent spin-waiting for frame index to change (not near-zero indicates wait object failure)
   1862 float m_flSubmitFrameMs; // time spent in IVRCompositor::Submit (not near-zero indicates driver issue)
   1863 
   1864 /** The following are all relative to this frame's SystemTimeInSeconds */
   1865 float m_flWaitGetPosesCalledMs;
   1866 float m_flNewPosesReadyMs;
   1867 float m_flNewFrameReadyMs; // second call to IVRCompositor::Submit
   1868 float m_flCompositorUpdateStartMs;
   1869 float m_flCompositorUpdateEndMs;
   1870 float m_flCompositorRenderStartMs;
   1871 
   1872 vr::TrackedDevicePose_t m_HmdPose; // pose used by app to render this frame
   1873 
   1874 uint32_t m_nNumVSyncsReadyForUse;
   1875 uint32_t m_nNumVSyncsToFirstView;
   1876 };
   1877 
   1878 /** Provides compositor benchmark results to the app */
   1879 struct Compositor_BenchmarkResults
   1880 {
   1881 float m_flMegaPixelsPerSecond; // Measurement of GPU MP/s performed by compositor benchmark
   1882 float m_flHmdRecommendedMegaPixelsPerSecond; // Recommended default MP/s given the HMD resolution, refresh, and panel mask.
   1883 };
   1884 
   1885 /** Frame timing data provided by direct mode drivers. */
   1886 struct DriverDirectMode_FrameTiming
   1887 {
   1888 uint32_t m_nSize; // Set to sizeof( DriverDirectMode_FrameTiming )
   1889 uint32_t m_nNumFramePresents; // number of times frame was presented
   1890 uint32_t m_nNumMisPresented; // number of times frame was presented on a vsync other than it was originally predicted to
   1891 uint32_t m_nNumDroppedFrames; // number of additional times previous frame was scanned out (i.e. compositor missed vsync)
   1892 uint32_t m_nReprojectionFlags;
   1893 };
   1894 
   1895 /** These flags will be set on DriverDirectMode_FrameTiming::m_nReprojectionFlags when IVRDriverDirectModeComponent::GetFrameTiming is called for drivers to optionally respond to. */
   1896 const uint32_t VRCompositor_ReprojectionMotion_Enabled = 0x100; // Motion Smoothing is enabled in the UI for the currently running application
   1897 const uint32_t VRCompositor_ReprojectionMotion_ForcedOn = 0x200; // Motion Smoothing is forced on in the UI for the currently running application
   1898 const uint32_t VRCompositor_ReprojectionMotion_AppThrottled = 0x400; // Application is requesting throttling via ForceInterleavedReprojectionOn
   1899 
   1900 
   1901 enum EVSync
   1902 {
   1903 VSync_None,
   1904 VSync_WaitRender,	// block following render work until vsync
   1905 VSync_NoWaitRender,	// do not block following render work (allow to get started early)
   1906 };
   1907 
   1908 enum EVRMuraCorrectionMode
   1909 {
   1910 EVRMuraCorrectionMode_Default = 0,
   1911 EVRMuraCorrectionMode_NoCorrection
   1912 };
   1913 
   1914 /** raw IMU data provided by IVRIOBuffer from paths to tracked devices with IMUs */
   1915 enum Imu_OffScaleFlags
   1916 {
   1917 OffScale_AccelX	= 0x01,
   1918 OffScale_AccelY	= 0x02,
   1919 OffScale_AccelZ	= 0x04,
   1920 OffScale_GyroX	= 0x08,
   1921 OffScale_GyroY	= 0x10,
   1922 OffScale_GyroZ	= 0x20,
   1923 };
   1924 
   1925 struct ImuSample_t
   1926 {
   1927 double fSampleTime;
   1928 HmdVector3d_t vAccel;
   1929 HmdVector3d_t vGyro;
   1930 uint32_t unOffScaleFlags;
   1931 };
   1932 
   1933 #pragma pack( pop )
   1934 
   1935 #define VR_INTERFACE
   1936 
   1937 // Mozilla: see mozilla.patch for more details
   1938 // figure out how to import from the VR API dll
   1939 // #if defined(_WIN32)
   1940 
   1941 //   #if !defined(OPENVR_BUILD_STATIC)
   1942 //     #ifdef VR_API_EXPORT
   1943 //       #define VR_INTERFACE extern "C" __declspec( dllexport )
   1944 //     #else
   1945 //       #define VR_INTERFACE extern "C" __declspec( dllimport )
   1946 //     #endif
   1947 //   #else
   1948 //     #define VR_INTERFACE extern "C"
   1949 //   #endif
   1950 
   1951 // #elif defined(__GNUC__) || defined(COMPILER_GCC) || defined(__APPLE__)
   1952 
   1953 // #ifdef VR_API_EXPORT
   1954 //   #define VR_INTERFACE extern "C" __attribute__((visibility("default")))
   1955 // #else
   1956 //   #define VR_INTERFACE extern "C" 
   1957 // #endif
   1958 
   1959 // #else
   1960 //   #error "Unsupported Platform."
   1961 // #endif
   1962 
   1963 
   1964 #if defined( _WIN32 )
   1965  #define VR_CALLTYPE __cdecl
   1966 #else
   1967  #define VR_CALLTYPE 
   1968 #endif
   1969 
   1970 } // namespace vr
   1971 
   1972 #endif // _INCLUDE_VRTYPES_H
   1973 
   1974 
   1975 // vrannotation.h
   1976 #ifdef API_GEN
   1977 # define VR_CLANG_ATTR(ATTR) __attribute__((annotate( ATTR )))
   1978 #else
   1979 # define VR_CLANG_ATTR(ATTR)
   1980 #endif
   1981 
   1982 #define VR_METHOD_DESC(DESC) VR_CLANG_ATTR( "desc:" #DESC ";" )
   1983 #define VR_IGNOREATTR() VR_CLANG_ATTR( "ignore" )
   1984 #define VR_OUT_STRUCT() VR_CLANG_ATTR( "out_struct: ;" )
   1985 #define VR_OUT_STRING() VR_CLANG_ATTR( "out_string: ;" )
   1986 #define VR_OUT_ARRAY_CALL(COUNTER,FUNCTION,PARAMS) VR_CLANG_ATTR( "out_array_call:" #COUNTER "," #FUNCTION "," #PARAMS ";" )
   1987 #define VR_OUT_ARRAY_COUNT(COUNTER) VR_CLANG_ATTR( "out_array_count:" #COUNTER ";" )
   1988 #define VR_ARRAY_COUNT(COUNTER) VR_CLANG_ATTR( "array_count:" #COUNTER ";" )
   1989 #define VR_ARRAY_COUNT_D(COUNTER, DESC) VR_CLANG_ATTR( "array_count:" #COUNTER ";desc:" #DESC )
   1990 #define VR_BUFFER_COUNT(COUNTER) VR_CLANG_ATTR( "buffer_count:" #COUNTER ";" )
   1991 #define VR_OUT_BUFFER_COUNT(COUNTER) VR_CLANG_ATTR( "out_buffer_count:" #COUNTER ";" )
   1992 #define VR_OUT_STRING_COUNT(COUNTER) VR_CLANG_ATTR( "out_string_count:" #COUNTER ";" )
   1993 
   1994 // ivrsystem.h
   1995 namespace vr
   1996 {
   1997 
   1998 class IVRSystem
   1999 {
   2000 public:
   2001 
   2002 
   2003 // ------------------------------------
   2004 // Display Methods
   2005 // ------------------------------------
   2006 
   2007 /** Suggested size for the intermediate render target that the distortion pulls from. */
   2008 virtual void GetRecommendedRenderTargetSize( uint32_t *pnWidth, uint32_t *pnHeight ) = 0;
   2009 
   2010 /** The projection matrix for the specified eye */
   2011 virtual HmdMatrix44_t GetProjectionMatrix( EVREye eEye, float fNearZ, float fFarZ ) = 0;
   2012 
   2013 /** The components necessary to build your own projection matrix in case your
   2014 * application is doing something fancy like infinite Z */
   2015 virtual void GetProjectionRaw( EVREye eEye, float *pfLeft, float *pfRight, float *pfTop, float *pfBottom ) = 0;
   2016 
   2017 /** Gets the result of the distortion function for the specified eye and input UVs. UVs go from 0,0 in 
   2018 * the upper left of that eye's viewport and 1,1 in the lower right of that eye's viewport.
   2019 * Returns true for success. Otherwise, returns false, and distortion coordinates are not suitable. */
   2020 virtual bool ComputeDistortion( EVREye eEye, float fU, float fV, DistortionCoordinates_t *pDistortionCoordinates ) = 0;
   2021 
   2022 /** Returns the transform from eye space to the head space. Eye space is the per-eye flavor of head
   2023 * space that provides stereo disparity. Instead of Model * View * Projection the sequence is Model * View * Eye^-1 * Projection. 
   2024 * Normally View and Eye^-1 will be multiplied together and treated as View in your application. 
   2025 */
   2026 virtual HmdMatrix34_t GetEyeToHeadTransform( EVREye eEye ) = 0;
   2027 
   2028 /** Returns the number of elapsed seconds since the last recorded vsync event. This 
   2029 *	will come from a vsync timer event in the timer if possible or from the application-reported
   2030 *   time if that is not available. If no vsync times are available the function will 
   2031 *   return zero for vsync time and frame counter and return false from the method. */
   2032 virtual bool GetTimeSinceLastVsync( float *pfSecondsSinceLastVsync, uint64_t *pulFrameCounter ) = 0;
   2033 
   2034 /** [D3D9 Only]
   2035 * Returns the adapter index that the user should pass into CreateDevice to set up D3D9 in such
   2036 * a way that it can go full screen exclusive on the HMD. Returns -1 if there was an error.
   2037 */
   2038 virtual int32_t GetD3D9AdapterIndex() = 0;
   2039 
   2040 /** [D3D10/11 Only]
   2041 * Returns the adapter index that the user should pass into EnumAdapters to create the device 
   2042 * and swap chain in DX10 and DX11. If an error occurs the index will be set to -1.
   2043 */
   2044 virtual void GetDXGIOutputInfo( int32_t *pnAdapterIndex ) = 0;
   2045 
   2046 /**
   2047  * Returns platform- and texture-type specific adapter identification so that applications and the
   2048  * compositor are creating textures and swap chains on the same GPU. If an error occurs the device
   2049  * will be set to 0.
   2050  * pInstance is an optional parameter that is required only when textureType is TextureType_Vulkan.
   2051  * [D3D10/11/12 Only (D3D9 Not Supported)]
   2052  *  Returns the adapter LUID that identifies the GPU attached to the HMD. The user should
   2053  *  enumerate all adapters using IDXGIFactory::EnumAdapters and IDXGIAdapter::GetDesc to find
   2054  *  the adapter with the matching LUID, or use IDXGIFactory4::EnumAdapterByLuid.
   2055  *  The discovered IDXGIAdapter should be used to create the device and swap chain.
   2056  * [Vulkan Only]
   2057  *  Returns the VkPhysicalDevice that should be used by the application.
   2058  *  pInstance must be the instance the application will use to query for the VkPhysicalDevice.  The application
   2059  *  must create the VkInstance with extensions returned by IVRCompositor::GetVulkanInstanceExtensionsRequired enabled.
   2060  * [macOS Only]
   2061  *  For TextureType_IOSurface returns the id<MTLDevice> that should be used by the application.
   2062  *  On 10.13+ for TextureType_OpenGL returns the 'registryId' of the renderer which should be used
   2063  *   by the application. See Apple Technical Q&A QA1168 for information on enumerating GL Renderers, and the
   2064  *   new kCGLRPRegistryIDLow and kCGLRPRegistryIDHigh CGLRendererProperty values in the 10.13 SDK.
   2065  *  Pre 10.13 for TextureType_OpenGL returns 0, as there is no dependable way to correlate the HMDs MTLDevice
   2066  *   with a GL Renderer.
   2067  */
   2068 virtual void GetOutputDevice( uint64_t *pnDevice, ETextureType textureType, VkInstance_T *pInstance = nullptr ) = 0;
   2069 
   2070 // ------------------------------------
   2071 // Display Mode methods
   2072 // ------------------------------------
   2073 
   2074 /** Use to determine if the headset display is part of the desktop (i.e. extended) or hidden (i.e. direct mode). */
   2075 virtual bool IsDisplayOnDesktop() = 0;
   2076 
   2077 /** Set the display visibility (true = extended, false = direct mode).  Return value of true indicates that the change was successful. */
   2078 virtual bool SetDisplayVisibility( bool bIsVisibleOnDesktop ) = 0;
   2079 
   2080 // ------------------------------------
   2081 // Tracking Methods
   2082 // ------------------------------------
   2083 
   2084 /** The pose that the tracker thinks that the HMD will be in at the specified number of seconds into the 
   2085 * future. Pass 0 to get the state at the instant the method is called. Most of the time the application should
   2086 * calculate the time until the photons will be emitted from the display and pass that time into the method.
   2087 *
   2088 * This is roughly analogous to the inverse of the view matrix in most applications, though 
   2089 * many games will need to do some additional rotation or translation on top of the rotation
   2090 * and translation provided by the head pose.
   2091 *
   2092 * For devices where bPoseIsValid is true the application can use the pose to position the device
   2093 * in question. The provided array can be any size up to k_unMaxTrackedDeviceCount. 
   2094 *
   2095 * Seated experiences should call this method with TrackingUniverseSeated and receive poses relative
   2096 * to the seated zero pose. Standing experiences should call this method with TrackingUniverseStanding 
   2097 * and receive poses relative to the Chaperone Play Area. TrackingUniverseRawAndUncalibrated should 
   2098 * probably not be used unless the application is the Chaperone calibration tool itself, but will provide
   2099 * poses relative to the hardware-specific coordinate system in the driver.
   2100 */
   2101 virtual void GetDeviceToAbsoluteTrackingPose( ETrackingUniverseOrigin eOrigin, float fPredictedSecondsToPhotonsFromNow, VR_ARRAY_COUNT(unTrackedDevicePoseArrayCount) TrackedDevicePose_t *pTrackedDevicePoseArray, uint32_t unTrackedDevicePoseArrayCount ) = 0;
   2102 
   2103 /** Sets the zero pose for the seated tracker coordinate system to the current position and yaw of the HMD. After 
   2104 * ResetSeatedZeroPose all GetDeviceToAbsoluteTrackingPose calls that pass TrackingUniverseSeated as the origin 
   2105 * will be relative to this new zero pose. The new zero coordinate system will not change the fact that the Y axis 
   2106 * is up in the real world, so the next pose returned from GetDeviceToAbsoluteTrackingPose after a call to 
   2107 * ResetSeatedZeroPose may not be exactly an identity matrix.
   2108 *
   2109 * NOTE: This function overrides the user's previously saved seated zero pose and should only be called as the result of a user action. 
   2110 * Users are also able to set their seated zero pose via the OpenVR Dashboard.
   2111 **/
   2112 virtual void ResetSeatedZeroPose() = 0;
   2113 
   2114 /** Returns the transform from the seated zero pose to the standing absolute tracking system. This allows 
   2115 * applications to represent the seated origin to used or transform object positions from one coordinate
   2116 * system to the other. 
   2117 *
   2118 * The seated origin may or may not be inside the Play Area or Collision Bounds returned by IVRChaperone. Its position 
   2119 * depends on what the user has set from the Dashboard settings and previous calls to ResetSeatedZeroPose. */
   2120 virtual HmdMatrix34_t GetSeatedZeroPoseToStandingAbsoluteTrackingPose() = 0;
   2121 
   2122 /** Returns the transform from the tracking origin to the standing absolute tracking system. This allows
   2123 * applications to convert from raw tracking space to the calibrated standing coordinate system. */
   2124 virtual HmdMatrix34_t GetRawZeroPoseToStandingAbsoluteTrackingPose() = 0;
   2125 
   2126 /** Get a sorted array of device indices of a given class of tracked devices (e.g. controllers).  Devices are sorted right to left
   2127 * relative to the specified tracked device (default: hmd -- pass in -1 for absolute tracking space).  Returns the number of devices
   2128 * in the list, or the size of the array needed if not large enough. */
   2129 virtual uint32_t GetSortedTrackedDeviceIndicesOfClass( ETrackedDeviceClass eTrackedDeviceClass, VR_ARRAY_COUNT(unTrackedDeviceIndexArrayCount) vr::TrackedDeviceIndex_t *punTrackedDeviceIndexArray, uint32_t unTrackedDeviceIndexArrayCount, vr::TrackedDeviceIndex_t unRelativeToTrackedDeviceIndex = k_unTrackedDeviceIndex_Hmd ) = 0;
   2130 
   2131 /** Returns the level of activity on the device. */
   2132 virtual EDeviceActivityLevel GetTrackedDeviceActivityLevel( vr::TrackedDeviceIndex_t unDeviceId ) = 0;
   2133 
   2134 /** Convenience utility to apply the specified transform to the specified pose.
   2135 *   This properly transforms all pose components, including velocity and angular velocity
   2136 */
   2137 virtual void ApplyTransform( TrackedDevicePose_t *pOutputPose, const TrackedDevicePose_t *pTrackedDevicePose, const HmdMatrix34_t *pTransform ) = 0;
   2138 
   2139 /** Returns the device index associated with a specific role, for example the left hand or the right hand. This function is deprecated in favor of the new IVRInput system. */
   2140 virtual vr::TrackedDeviceIndex_t GetTrackedDeviceIndexForControllerRole( vr::ETrackedControllerRole unDeviceType ) = 0;
   2141 
   2142 /** Returns the controller type associated with a device index. This function is deprecated in favor of the new IVRInput system. */
   2143 virtual vr::ETrackedControllerRole GetControllerRoleForTrackedDeviceIndex( vr::TrackedDeviceIndex_t unDeviceIndex ) = 0;
   2144 
   2145 // ------------------------------------
   2146 // Property methods
   2147 // ------------------------------------
   2148 
   2149 /** Returns the device class of a tracked device. If there has not been a device connected in this slot
   2150 * since the application started this function will return TrackedDevice_Invalid. For previous detected
   2151 * devices the function will return the previously observed device class. 
   2152 *
   2153 * To determine which devices exist on the system, just loop from 0 to k_unMaxTrackedDeviceCount and check
   2154 * the device class. Every device with something other than TrackedDevice_Invalid is associated with an 
   2155 * actual tracked device. */
   2156 virtual ETrackedDeviceClass GetTrackedDeviceClass( vr::TrackedDeviceIndex_t unDeviceIndex ) = 0;
   2157 
   2158 /** Returns true if there is a device connected in this slot. */
   2159 virtual bool IsTrackedDeviceConnected( vr::TrackedDeviceIndex_t unDeviceIndex ) = 0;
   2160 
   2161 /** Returns a bool property. If the device index is not valid or the property is not a bool type this function will return false. */
   2162 virtual bool GetBoolTrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0;
   2163 
   2164 /** Returns a float property. If the device index is not valid or the property is not a float type this function will return 0. */
   2165 virtual float GetFloatTrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0;
   2166 
   2167 /** Returns an int property. If the device index is not valid or the property is not a int type this function will return 0. */
   2168 virtual int32_t GetInt32TrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0;
   2169 
   2170 /** Returns a uint64 property. If the device index is not valid or the property is not a uint64 type this function will return 0. */
   2171 virtual uint64_t GetUint64TrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0;
   2172 
   2173 /** Returns a matrix property. If the device index is not valid or the property is not a matrix type, this function will return identity. */
   2174 virtual HmdMatrix34_t GetMatrix34TrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0;
   2175 
   2176 /** Returns an array of one type of property. If the device index is not valid or the property is not a single value or an array of the specified type,
   2177 * this function will return 0. Otherwise it returns the number of bytes necessary to hold the array of properties. If unBufferSize is
   2178 * greater than the returned size and pBuffer is non-NULL, pBuffer is filled with the contents of array of properties. */
   2179 virtual uint32_t GetArrayTrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, PropertyTypeTag_t propType, void *pBuffer, uint32_t unBufferSize, ETrackedPropertyError *pError = 0L ) = 0;
   2180 
   2181 /** Returns a string property. If the device index is not valid or the property is not a string type this function will 
   2182 * return 0. Otherwise it returns the length of the number of bytes necessary to hold this string including the trailing
   2183 * null. Strings will always fit in buffers of k_unMaxPropertyStringSize characters. */
   2184 virtual uint32_t GetStringTrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize, ETrackedPropertyError *pError = 0L ) = 0;
   2185 
   2186 /** returns a string that corresponds with the specified property error. The string will be the name 
   2187 * of the error enum value for all valid error codes */
   2188 virtual const char *GetPropErrorNameFromEnum( ETrackedPropertyError error ) = 0;
   2189 
   2190 // ------------------------------------
   2191 // Event methods
   2192 // ------------------------------------
   2193 
   2194 /** Returns true and fills the event with the next event on the queue if there is one. If there are no events
   2195 * this method returns false. uncbVREvent should be the size in bytes of the VREvent_t struct */
   2196 virtual bool PollNextEvent( VREvent_t *pEvent, uint32_t uncbVREvent ) = 0;
   2197 
   2198 /** Returns true and fills the event with the next event on the queue if there is one. If there are no events
   2199 * this method returns false. Fills in the pose of the associated tracked device in the provided pose struct. 
   2200 * This pose will always be older than the call to this function and should not be used to render the device. 
   2201 uncbVREvent should be the size in bytes of the VREvent_t struct */
   2202 virtual bool PollNextEventWithPose( ETrackingUniverseOrigin eOrigin, VREvent_t *pEvent, uint32_t uncbVREvent, vr::TrackedDevicePose_t *pTrackedDevicePose ) = 0;
   2203 
   2204 /** returns the name of an EVREvent enum value */
   2205 virtual const char *GetEventTypeNameFromEnum( EVREventType eType ) = 0;
   2206 
   2207 // ------------------------------------
   2208 // Rendering helper methods
   2209 // ------------------------------------
   2210 
   2211 /** Returns the hidden area mesh for the current HMD. The pixels covered by this mesh will never be seen by the user after the lens distortion is
   2212 * applied based on visibility to the panels. If this HMD does not have a hidden area mesh, the vertex data and count will be NULL and 0 respectively.
   2213 * This mesh is meant to be rendered into the stencil buffer (or into the depth buffer setting nearz) before rendering each eye's view. 
   2214 * This will improve performance by letting the GPU early-reject pixels the user will never see before running the pixel shader.
   2215 * NOTE: Render this mesh with backface culling disabled since the winding order of the vertices can be different per-HMD or per-eye.
   2216 * Setting the bInverse argument to true will produce the visible area mesh that is commonly used in place of full-screen quads. The visible area mesh covers all of the pixels the hidden area mesh does not cover.
   2217 * Setting the bLineLoop argument will return a line loop of vertices in HiddenAreaMesh_t->pVertexData with HiddenAreaMesh_t->unTriangleCount set to the number of vertices.
   2218 */
   2219 virtual HiddenAreaMesh_t GetHiddenAreaMesh( EVREye eEye, EHiddenAreaMeshType type = k_eHiddenAreaMesh_Standard ) = 0;
   2220 
   2221 // ------------------------------------
   2222 // Controller methods
   2223 // ------------------------------------
   2224 
   2225 /** Fills the supplied struct with the current state of the controller. Returns false if the controller index
   2226 * is invalid. This function is deprecated in favor of the new IVRInput system. */
   2227 virtual bool GetControllerState( vr::TrackedDeviceIndex_t unControllerDeviceIndex, vr::VRControllerState_t *pControllerState, uint32_t unControllerStateSize ) = 0;
   2228 
   2229 /** fills the supplied struct with the current state of the controller and the provided pose with the pose of 
   2230 * the controller when the controller state was updated most recently. Use this form if you need a precise controller
   2231 * pose as input to your application when the user presses or releases a button. This function is deprecated in favor of the new IVRInput system. */
   2232 virtual bool GetControllerStateWithPose( ETrackingUniverseOrigin eOrigin, vr::TrackedDeviceIndex_t unControllerDeviceIndex, vr::VRControllerState_t *pControllerState, uint32_t unControllerStateSize, TrackedDevicePose_t *pTrackedDevicePose ) = 0;
   2233 
   2234 /** Trigger a single haptic pulse on a controller. After this call the application may not trigger another haptic pulse on this controller
   2235 * and axis combination for 5ms. This function is deprecated in favor of the new IVRInput system. */
   2236 virtual void TriggerHapticPulse( vr::TrackedDeviceIndex_t unControllerDeviceIndex, uint32_t unAxisId, unsigned short usDurationMicroSec ) = 0;
   2237 
   2238 /** returns the name of an EVRButtonId enum value. This function is deprecated in favor of the new IVRInput system.  */
   2239 virtual const char *GetButtonIdNameFromEnum( EVRButtonId eButtonId ) = 0;
   2240 
   2241 /** returns the name of an EVRControllerAxisType enum value. This function is deprecated in favor of the new IVRInput system. */
   2242 virtual const char *GetControllerAxisTypeNameFromEnum( EVRControllerAxisType eAxisType ) = 0;
   2243 
   2244 /** Returns true if this application is receiving input from the system. This would return false if 
   2245 * system-related functionality is consuming the input stream. */
   2246 virtual bool IsInputAvailable() = 0;
   2247 
   2248 /** Returns true SteamVR is drawing controllers on top of the application. Applications should consider
   2249 * not drawing anything attached to the user's hands in this case. */
   2250 virtual bool IsSteamVRDrawingControllers() = 0;
   2251 
   2252 /** Returns true if the user has put SteamVR into a mode that is distracting them from the application.
   2253 * For applications where this is appropriate, the application should pause ongoing activity. */
   2254 virtual bool ShouldApplicationPause() = 0;
   2255 
   2256 /** Returns true if SteamVR is doing significant rendering work and the game should do what it can to reduce
   2257 * its own workload. One common way to do this is to reduce the size of the render target provided for each eye. */
   2258 virtual bool ShouldApplicationReduceRenderingWork() = 0;
   2259 
   2260 // ------------------------------------
   2261 // Firmware methods
   2262 // ------------------------------------
   2263 
   2264 /** Performs the actual firmware update if applicable. 
   2265  * The following events will be sent, if VRFirmwareError_None was returned: VREvent_FirmwareUpdateStarted, VREvent_FirmwareUpdateFinished 
   2266  * Use the properties Prop_Firmware_UpdateAvailable_Bool, Prop_Firmware_ManualUpdate_Bool, and Prop_Firmware_ManualUpdateURL_String
   2267  * to figure our whether a firmware update is available, and to figure out whether its a manual update 
   2268  * Prop_Firmware_ManualUpdateURL_String should point to an URL describing the manual update process */
   2269 virtual vr::EVRFirmwareError PerformFirmwareUpdate( vr::TrackedDeviceIndex_t unDeviceIndex ) = 0;
   2270 
   2271 // ------------------------------------
   2272 // Application life cycle methods
   2273 // ------------------------------------
   2274 
   2275 /** Call this to acknowledge to the system that VREvent_Quit has been received and that the process is exiting.
   2276 * This extends the timeout until the process is killed. */
   2277 virtual void AcknowledgeQuit_Exiting() = 0;
   2278 
   2279 // -------------------------------------
   2280 // App container sandbox methods
   2281 // -------------------------------------
   2282 
   2283 /** Retrieves a null-terminated, semicolon-delimited list of UTF8 file paths that an application 
   2284 * must have read access to when running inside of an app container. Returns the number of bytes
   2285 * needed to hold the list. */
   2286 virtual uint32_t GetAppContainerFilePaths( VR_OUT_STRING() char *pchBuffer, uint32_t unBufferSize ) = 0;
   2287 
   2288 // -------------------------------------
   2289 // System methods
   2290 // -------------------------------------
   2291 
   2292 /** Returns the current version of the SteamVR runtime. The returned string will remain valid until VR_Shutdown is called.
   2293 *
   2294 * NOTE: Is it not appropriate to use this version to test for the presence of any SteamVR feature. Only use this version
   2295 * number for logging or showing to a user, and not to try to detect anything at runtime. When appropriate, feature-specific
   2296 * presence information is provided by other APIs. */
   2297 virtual const char *GetRuntimeVersion() = 0;
   2298 
   2299 };
   2300 
   2301 static const char * const IVRSystem_Version = "IVRSystem_021";
   2302 
   2303 }
   2304 
   2305 
   2306 // ivrapplications.h
   2307 namespace vr
   2308 {
   2309 
   2310 /** Used for all errors reported by the IVRApplications interface */
   2311 enum EVRApplicationError
   2312 {
   2313 	VRApplicationError_None = 0,
   2314 
   2315 	VRApplicationError_AppKeyAlreadyExists = 100,	// Only one application can use any given key
   2316 	VRApplicationError_NoManifest = 101,			// the running application does not have a manifest
   2317 	VRApplicationError_NoApplication = 102,			// No application is running
   2318 	VRApplicationError_InvalidIndex = 103,
   2319 	VRApplicationError_UnknownApplication = 104,	// the application could not be found
   2320 	VRApplicationError_IPCFailed = 105,				// An IPC failure caused the request to fail
   2321 	VRApplicationError_ApplicationAlreadyRunning = 106, 
   2322 	VRApplicationError_InvalidManifest = 107,
   2323 	VRApplicationError_InvalidApplication = 108,
   2324 	VRApplicationError_LaunchFailed = 109,			// the process didn't start
   2325 	VRApplicationError_ApplicationAlreadyStarting = 110, // the system was already starting the same application
   2326 	VRApplicationError_LaunchInProgress = 111,		// The system was already starting a different application
   2327 	VRApplicationError_OldApplicationQuitting = 112, 
   2328 	VRApplicationError_TransitionAborted = 113,
   2329 	VRApplicationError_IsTemplate = 114, // error when you try to call LaunchApplication() on a template type app (use LaunchTemplateApplication)
   2330 	VRApplicationError_SteamVRIsExiting = 115,
   2331 
   2332 	VRApplicationError_BufferTooSmall = 200,		// The provided buffer was too small to fit the requested data
   2333 	VRApplicationError_PropertyNotSet = 201,		// The requested property was not set
   2334 	VRApplicationError_UnknownProperty = 202,
   2335 	VRApplicationError_InvalidParameter = 203,
   2336 };
   2337 
   2338 /** The maximum length of an application key */
   2339 static const uint32_t k_unMaxApplicationKeyLength = 128;
   2340 
   2341 /** these are the properties available on applications. */
   2342 enum EVRApplicationProperty
   2343 {
   2344 	VRApplicationProperty_Name_String				= 0,
   2345 
   2346 	VRApplicationProperty_LaunchType_String			= 11,
   2347 	VRApplicationProperty_WorkingDirectory_String	= 12,
   2348 	VRApplicationProperty_BinaryPath_String			= 13,
   2349 	VRApplicationProperty_Arguments_String			= 14,
   2350 	VRApplicationProperty_URL_String				= 15,
   2351 
   2352 	VRApplicationProperty_Description_String		= 50,
   2353 	VRApplicationProperty_NewsURL_String			= 51,
   2354 	VRApplicationProperty_ImagePath_String			= 52,
   2355 	VRApplicationProperty_Source_String				= 53,
   2356 	VRApplicationProperty_ActionManifestURL_String	= 54,
   2357 
   2358 	VRApplicationProperty_IsDashboardOverlay_Bool	= 60,
   2359 	VRApplicationProperty_IsTemplate_Bool			= 61,
   2360 	VRApplicationProperty_IsInstanced_Bool			= 62,
   2361 	VRApplicationProperty_IsInternal_Bool			= 63,
   2362 	VRApplicationProperty_WantsCompositorPauseInStandby_Bool = 64,
   2363 	VRApplicationProperty_IsHidden_Bool				= 65,
   2364 
   2365 	VRApplicationProperty_LastLaunchTime_Uint64		= 70,
   2366 };
   2367 
   2368 enum EVRSceneApplicationState
   2369 {
   2370 	EVRSceneApplicationState_None						      = 0, // Scene Application is not running
   2371 	EVRSceneApplicationState_Starting					      = 1, // Scene Application is starting
   2372 	EVRSceneApplicationState_Quitting					      = 2, // Scene Application is quitting
   2373 	EVRSceneApplicationState_Running						  = 3, // Scene Application is running, and submitting frames, a custom skybox, or a visible overlay
   2374 	EVRSceneApplicationState_Waiting						  = 4, // Scene Application is running, but not drawing anything
   2375 };
   2376 
   2377 struct AppOverrideKeys_t
   2378 {
   2379 	const char *pchKey;
   2380 	const char *pchValue;
   2381 };
   2382 
   2383 /** Currently recognized mime types */
   2384 static const char * const k_pch_MimeType_HomeApp		= "vr/home";
   2385 static const char * const k_pch_MimeType_GameTheater	= "vr/game_theater";
   2386 
   2387 class IVRApplications
   2388 {
   2389 public:
   2390 
   2391 	// ---------------  Application management  --------------- //
   2392 
   2393 	/** Adds an application manifest to the list to load when building the list of installed applications. 
   2394 	* Temporary manifests are not automatically loaded */
   2395 	virtual EVRApplicationError AddApplicationManifest( const char *pchApplicationManifestFullPath, bool bTemporary = false ) = 0;
   2396 
   2397 	/** Removes an application manifest from the list to load when building the list of installed applications. */
   2398 	virtual EVRApplicationError RemoveApplicationManifest( const char *pchApplicationManifestFullPath ) = 0;
   2399 
   2400 	/** Returns true if an application is installed */
   2401 	virtual bool IsApplicationInstalled( const char *pchAppKey ) = 0;
   2402 
   2403 	/** Returns the number of applications available in the list */
   2404 	virtual uint32_t GetApplicationCount() = 0;
   2405 
   2406 	/** Returns the key of the specified application. The index is at least 0 and is less than the return 
   2407 	* value of GetApplicationCount(). The buffer should be at least k_unMaxApplicationKeyLength in order to 
   2408 	* fit the key. */
   2409 	virtual EVRApplicationError GetApplicationKeyByIndex( uint32_t unApplicationIndex, VR_OUT_STRING() char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0;
   2410 
   2411 	/** Returns the key of the application for the specified Process Id. The buffer should be at least 
   2412 	* k_unMaxApplicationKeyLength in order to fit the key. */
   2413 	virtual EVRApplicationError GetApplicationKeyByProcessId( uint32_t unProcessId, VR_OUT_STRING() char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0;
   2414 
   2415 	/** Launches the application. The existing scene application will exit and then the new application will start.
   2416 	* This call is not valid for dashboard overlay applications. */
   2417 	virtual EVRApplicationError LaunchApplication( const char *pchAppKey ) = 0;
   2418 
   2419 	/** Launches an instance of an application of type template, with its app key being pchNewAppKey (which must be unique) and optionally override sections
   2420 	* from the manifest file via AppOverrideKeys_t
   2421 	*/
   2422 	virtual EVRApplicationError LaunchTemplateApplication( const char *pchTemplateAppKey, const char *pchNewAppKey, VR_ARRAY_COUNT( unKeys ) const AppOverrideKeys_t *pKeys, uint32_t unKeys ) = 0;
   2423 
   2424 	/** launches the application currently associated with this mime type and passes it the option args, typically the filename or object name of the item being launched */
   2425 	virtual vr::EVRApplicationError LaunchApplicationFromMimeType( const char *pchMimeType, const char *pchArgs ) = 0;
   2426 
   2427 	/** Launches the dashboard overlay application if it is not already running. This call is only valid for 
   2428 	* dashboard overlay applications. */
   2429 	virtual EVRApplicationError LaunchDashboardOverlay( const char *pchAppKey ) = 0;
   2430 
   2431 	/** Cancel a pending launch for an application */
   2432 	virtual bool CancelApplicationLaunch( const char *pchAppKey ) = 0;
   2433 
   2434 	/** Identifies a running application. OpenVR can't always tell which process started in response
   2435 	* to a URL. This function allows a URL handler (or the process itself) to identify the app key 
   2436 	* for the now running application. Passing a process ID of 0 identifies the calling process. 
   2437 	* The application must be one that's known to the system via a call to AddApplicationManifest. */
   2438 	virtual EVRApplicationError IdentifyApplication( uint32_t unProcessId, const char *pchAppKey ) = 0;
   2439 
   2440 	/** Returns the process ID for an application. Return 0 if the application was not found or is not running. */
   2441 	virtual uint32_t GetApplicationProcessId( const char *pchAppKey ) = 0;
   2442 
   2443 	/** Returns a string for an applications error */
   2444 	virtual const char *GetApplicationsErrorNameFromEnum( EVRApplicationError error ) = 0;
   2445 
   2446 	// ---------------  Application properties  --------------- //
   2447 
   2448 	/** Returns a value for an application property. The required buffer size to fit this value will be returned. */
   2449 	virtual uint32_t GetApplicationPropertyString( const char *pchAppKey, EVRApplicationProperty eProperty, VR_OUT_STRING() char *pchPropertyValueBuffer, uint32_t unPropertyValueBufferLen, EVRApplicationError *peError = nullptr ) = 0;
   2450 
   2451 	/** Returns a bool value for an application property. Returns false in all error cases. */
   2452 	virtual bool GetApplicationPropertyBool( const char *pchAppKey, EVRApplicationProperty eProperty, EVRApplicationError *peError = nullptr ) = 0;
   2453 
   2454 	/** Returns a uint64 value for an application property. Returns 0 in all error cases. */
   2455 	virtual uint64_t GetApplicationPropertyUint64( const char *pchAppKey, EVRApplicationProperty eProperty, EVRApplicationError *peError = nullptr ) = 0;
   2456 
   2457 	/** Sets the application auto-launch flag. This is only valid for applications which return true for VRApplicationProperty_IsDashboardOverlay_Bool. */
   2458 	virtual EVRApplicationError SetApplicationAutoLaunch( const char *pchAppKey, bool bAutoLaunch ) = 0;
   2459 
   2460 	/** Gets the application auto-launch flag. This is only valid for applications which return true for VRApplicationProperty_IsDashboardOverlay_Bool. */
   2461 	virtual bool GetApplicationAutoLaunch( const char *pchAppKey ) = 0;
   2462 
   2463 	/** Adds this mime-type to the list of supported mime types for this application*/
   2464 	virtual EVRApplicationError SetDefaultApplicationForMimeType( const char *pchAppKey, const char *pchMimeType ) = 0;
   2465 
   2466 	/** return the app key that will open this mime type */
   2467 	virtual bool GetDefaultApplicationForMimeType( const char *pchMimeType, VR_OUT_STRING() char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0;
   2468 
   2469 	/** Get the list of supported mime types for this application, comma-delimited */
   2470 	virtual bool GetApplicationSupportedMimeTypes( const char *pchAppKey, VR_OUT_STRING() char *pchMimeTypesBuffer, uint32_t unMimeTypesBuffer ) = 0;
   2471 
   2472 	/** Get the list of app-keys that support this mime type, comma-delimited, the return value is number of bytes you need to return the full string */
   2473 	virtual uint32_t GetApplicationsThatSupportMimeType( const char *pchMimeType, VR_OUT_STRING() char *pchAppKeysThatSupportBuffer, uint32_t unAppKeysThatSupportBuffer ) = 0;
   2474 
   2475 	/** Get the args list from an app launch that had the process already running, you call this when you get a VREvent_ApplicationMimeTypeLoad */
   2476 	virtual uint32_t GetApplicationLaunchArguments( uint32_t unHandle, VR_OUT_STRING() char *pchArgs, uint32_t unArgs ) = 0;
   2477 
   2478 	// ---------------  Transition methods --------------- //
   2479 
   2480 	/** Returns the app key for the application that is starting up */
   2481 	virtual EVRApplicationError GetStartingApplication( VR_OUT_STRING() char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0;
   2482 
   2483 	/** Returns the application transition state */
   2484 	virtual EVRSceneApplicationState GetSceneApplicationState() = 0;
   2485 
   2486 	/** Returns errors that would prevent the specified application from launching immediately. Calling this function will
   2487 	* cause the current scene application to quit, so only call it when you are actually about to launch something else.
   2488 	* What the caller should do about these failures depends on the failure:
   2489 	*   VRApplicationError_OldApplicationQuitting - An existing application has been told to quit. Wait for a VREvent_ProcessQuit
   2490 	*                                               and try again.
   2491 	*   VRApplicationError_ApplicationAlreadyStarting - This application is already starting. This is a permanent failure.
   2492 	*   VRApplicationError_LaunchInProgress	      - A different application is already starting. This is a permanent failure.
   2493 	*   VRApplicationError_None                   - Go ahead and launch. Everything is clear.
   2494 	*/
   2495 	virtual EVRApplicationError PerformApplicationPrelaunchCheck( const char *pchAppKey ) = 0;
   2496 
   2497 	/** Returns a string for an application transition state */
   2498 	virtual const char *GetSceneApplicationStateNameFromEnum( EVRSceneApplicationState state ) = 0;
   2499 
   2500 	/** Starts a subprocess within the calling application. This
   2501 	* suppresses all application transition UI and automatically identifies the new executable 
   2502 	* as part of the same application. On success the calling process should exit immediately. 
   2503 	* If working directory is NULL or "" the directory portion of the binary path will be 
   2504 	* the working directory. */
   2505 	virtual EVRApplicationError LaunchInternalProcess( const char *pchBinaryPath, const char *pchArguments, const char *pchWorkingDirectory ) = 0;
   2506 
   2507 	/** Returns the current scene process ID according to the application system. A scene process will get scene
   2508 	* focus once it starts rendering, but it will appear here once it calls VR_Init with the Scene application
   2509 	* type. */
   2510 	virtual uint32_t GetCurrentSceneProcessId() = 0;
   2511 };
   2512 
   2513 static const char * const IVRApplications_Version = "IVRApplications_007";
   2514 
   2515 } // namespace vr
   2516 
   2517 // ivrsettings.h
   2518 #include <string>
   2519 
   2520 namespace vr
   2521 {
   2522 enum EVRSettingsError
   2523 {
   2524 	VRSettingsError_None = 0,
   2525 	VRSettingsError_IPCFailed = 1,
   2526 	VRSettingsError_WriteFailed = 2,
   2527 	VRSettingsError_ReadFailed = 3,
   2528 	VRSettingsError_JsonParseFailed = 4,
   2529 	VRSettingsError_UnsetSettingHasNoDefault = 5, // This will be returned if the setting does not appear in the appropriate default file and has not been set
   2530 };
   2531 
   2532 // The maximum length of a settings key
   2533 static const uint32_t k_unMaxSettingsKeyLength = 128;
   2534 
   2535 class IVRSettings
   2536 {
   2537 public:
   2538 	virtual const char *GetSettingsErrorNameFromEnum( EVRSettingsError eError ) = 0;
   2539 
   2540 	virtual void SetBool( const char *pchSection, const char *pchSettingsKey, bool bValue, EVRSettingsError *peError = nullptr ) = 0;
   2541 	virtual void SetInt32( const char *pchSection, const char *pchSettingsKey, int32_t nValue, EVRSettingsError *peError = nullptr ) = 0;
   2542 	virtual void SetFloat( const char *pchSection, const char *pchSettingsKey, float flValue, EVRSettingsError *peError = nullptr ) = 0;
   2543 	virtual void SetString( const char *pchSection, const char *pchSettingsKey, const char *pchValue, EVRSettingsError *peError = nullptr ) = 0;
   2544 
   2545 	// Users of the system need to provide a proper default in default.vrsettings in the resources/settings/ directory
   2546 	// of either the runtime or the driver_xxx directory. Otherwise the default will be false, 0, 0.0 or ""
   2547 	virtual bool GetBool( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) = 0;
   2548 	virtual int32_t GetInt32( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) = 0;
   2549 	virtual float GetFloat( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) = 0;
   2550 	virtual void GetString( const char *pchSection, const char *pchSettingsKey, VR_OUT_STRING() char *pchValue, uint32_t unValueLen, EVRSettingsError *peError = nullptr ) = 0;
   2551 
   2552 	virtual void RemoveSection( const char *pchSection, EVRSettingsError *peError = nullptr ) = 0;
   2553 	virtual void RemoveKeyInSection( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) = 0;
   2554 };
   2555 
   2556 //-----------------------------------------------------------------------------
   2557 static const char * const IVRSettings_Version = "IVRSettings_003";
   2558 
   2559 class CVRSettingHelper
   2560 {
   2561 	IVRSettings *m_pSettings;
   2562 public:
   2563   // Mozilla: see mozilla.patch for more details
   2564 	explicit CVRSettingHelper( IVRSettings *pSettings ) 
   2565 	{ 
   2566 		m_pSettings = pSettings; 
   2567 	}
   2568 
   2569 	const char *GetSettingsErrorNameFromEnum( EVRSettingsError eError ) 
   2570 	{ 
   2571 		return m_pSettings->GetSettingsErrorNameFromEnum( eError ); 
   2572 	}
   2573 
   2574 	void SetBool( const char *pchSection, const char *pchSettingsKey, bool bValue, EVRSettingsError *peError = nullptr )
   2575 	{
   2576 		m_pSettings->SetBool( pchSection, pchSettingsKey, bValue, peError );
   2577 	}
   2578 
   2579 	void SetInt32( const char *pchSection, const char *pchSettingsKey, int32_t nValue, EVRSettingsError *peError = nullptr )
   2580 	{
   2581 		m_pSettings->SetInt32( pchSection, pchSettingsKey, nValue, peError );
   2582 	}
   2583 	void SetFloat( const char *pchSection, const char *pchSettingsKey, float flValue, EVRSettingsError *peError = nullptr )
   2584 	{
   2585 		m_pSettings->SetFloat( pchSection, pchSettingsKey, flValue, peError );
   2586 	}
   2587 	void SetString( const char *pchSection, const char *pchSettingsKey, const char *pchValue, EVRSettingsError *peError = nullptr )
   2588 	{
   2589 		m_pSettings->SetString( pchSection, pchSettingsKey, pchValue, peError );
   2590 	}
   2591 	void SetString( const std::string & sSection, const std::string &  sSettingsKey, const std::string & sValue, EVRSettingsError *peError = nullptr )
   2592 	{
   2593 		m_pSettings->SetString( sSection.c_str(), sSettingsKey.c_str(), sValue.c_str(), peError );
   2594 	}
   2595 
   2596 	bool GetBool( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr )
   2597 	{
   2598 		return m_pSettings->GetBool( pchSection, pchSettingsKey, peError );
   2599 	}
   2600 	int32_t GetInt32( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr )
   2601 	{
   2602 		return m_pSettings->GetInt32( pchSection, pchSettingsKey, peError );
   2603 	}
   2604 	float GetFloat( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr )
   2605 	{
   2606 		return m_pSettings->GetFloat( pchSection, pchSettingsKey, peError );
   2607 	}
   2608 	void GetString( const char *pchSection, const char *pchSettingsKey, VR_OUT_STRING() char *pchValue, uint32_t unValueLen, EVRSettingsError *peError = nullptr )
   2609 	{
   2610 		m_pSettings->GetString( pchSection, pchSettingsKey, pchValue, unValueLen, peError );
   2611 	}
   2612 	std::string GetString( const std::string & sSection, const std::string & sSettingsKey, EVRSettingsError *peError = nullptr )
   2613 	{
   2614 		char buf[4096];
   2615 		vr::EVRSettingsError eError;
   2616 		m_pSettings->GetString( sSection.c_str(), sSettingsKey.c_str(), buf, sizeof( buf ), &eError );
   2617 		if ( peError )
   2618 			*peError = eError;
   2619 		if ( eError == vr::VRSettingsError_None )
   2620 			return buf;
   2621 		else
   2622 			return "";
   2623 	}
   2624 
   2625 	void RemoveSection( const char *pchSection, EVRSettingsError *peError = nullptr )
   2626 	{
   2627 		m_pSettings->RemoveSection( pchSection, peError );
   2628 	}
   2629 	void RemoveKeyInSection( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr )
   2630 	{
   2631 		m_pSettings->RemoveKeyInSection( pchSection, pchSettingsKey, peError );
   2632 	}
   2633 };
   2634 
   2635 
   2636 //-----------------------------------------------------------------------------
   2637 // steamvr keys
   2638 static const char * const k_pch_SteamVR_Section = "steamvr";
   2639 static const char * const k_pch_SteamVR_RequireHmd_String = "requireHmd";
   2640 static const char * const k_pch_SteamVR_ForcedDriverKey_String = "forcedDriver";
   2641 static const char * const k_pch_SteamVR_ForcedHmdKey_String = "forcedHmd";
   2642 static const char * const k_pch_SteamVR_DisplayDebug_Bool = "displayDebug";
   2643 static const char * const k_pch_SteamVR_DebugProcessPipe_String = "debugProcessPipe";
   2644 static const char * const k_pch_SteamVR_DisplayDebugX_Int32 = "displayDebugX";
   2645 static const char * const k_pch_SteamVR_DisplayDebugY_Int32 = "displayDebugY";
   2646 static const char * const k_pch_SteamVR_SendSystemButtonToAllApps_Bool= "sendSystemButtonToAllApps";
   2647 static const char * const k_pch_SteamVR_LogLevel_Int32 = "loglevel";
   2648 static const char * const k_pch_SteamVR_IPD_Float = "ipd";
   2649 static const char * const k_pch_SteamVR_Background_String = "background";
   2650 static const char * const k_pch_SteamVR_BackgroundUseDomeProjection_Bool = "backgroundUseDomeProjection";
   2651 static const char * const k_pch_SteamVR_BackgroundCameraHeight_Float = "backgroundCameraHeight";
   2652 static const char * const k_pch_SteamVR_BackgroundDomeRadius_Float = "backgroundDomeRadius";
   2653 static const char * const k_pch_SteamVR_GridColor_String = "gridColor";
   2654 static const char * const k_pch_SteamVR_PlayAreaColor_String = "playAreaColor";
   2655 static const char * const k_pch_SteamVR_TrackingLossColor_String = "trackingLossColor";
   2656 static const char * const k_pch_SteamVR_ShowStage_Bool = "showStage";
   2657 static const char * const k_pch_SteamVR_ActivateMultipleDrivers_Bool = "activateMultipleDrivers";
   2658 static const char * const k_pch_SteamVR_UsingSpeakers_Bool = "usingSpeakers";
   2659 static const char * const k_pch_SteamVR_SpeakersForwardYawOffsetDegrees_Float = "speakersForwardYawOffsetDegrees";
   2660 static const char * const k_pch_SteamVR_BaseStationPowerManagement_Int32 = "basestationPowerManagement";
   2661 static const char * const k_pch_SteamVR_ShowBaseStationPowerManagementTip_Int32 = "ShowBaseStationPowerManagementTip";
   2662 static const char * const k_pch_SteamVR_NeverKillProcesses_Bool = "neverKillProcesses";
   2663 static const char * const k_pch_SteamVR_SupersampleScale_Float = "supersampleScale";
   2664 static const char * const k_pch_SteamVR_MaxRecommendedResolution_Int32 = "maxRecommendedResolution";
   2665 static const char * const k_pch_SteamVR_MotionSmoothing_Bool = "motionSmoothing";
   2666 static const char * const k_pch_SteamVR_MotionSmoothingOverride_Int32 = "motionSmoothingOverride";
   2667 static const char * const k_pch_SteamVR_DisableAsyncReprojection_Bool = "disableAsync";
   2668 static const char * const k_pch_SteamVR_ForceFadeOnBadTracking_Bool = "forceFadeOnBadTracking";
   2669 static const char * const k_pch_SteamVR_DefaultMirrorView_Int32 = "mirrorView";
   2670 static const char * const k_pch_SteamVR_ShowLegacyMirrorView_Bool = "showLegacyMirrorView";
   2671 static const char * const k_pch_SteamVR_MirrorViewVisibility_Bool = "showMirrorView";
   2672 static const char * const k_pch_SteamVR_MirrorViewDisplayMode_Int32 = "mirrorViewDisplayMode";
   2673 static const char * const k_pch_SteamVR_MirrorViewEye_Int32 = "mirrorViewEye";
   2674 static const char * const k_pch_SteamVR_MirrorViewGeometry_String = "mirrorViewGeometry";
   2675 static const char * const k_pch_SteamVR_MirrorViewGeometryMaximized_String = "mirrorViewGeometryMaximized";
   2676 static const char * const k_pch_SteamVR_PerfGraphVisibility_Bool = "showPerfGraph";
   2677 static const char * const k_pch_SteamVR_StartMonitorFromAppLaunch = "startMonitorFromAppLaunch";
   2678 static const char * const k_pch_SteamVR_StartCompositorFromAppLaunch_Bool = "startCompositorFromAppLaunch";
   2679 static const char * const k_pch_SteamVR_StartDashboardFromAppLaunch_Bool = "startDashboardFromAppLaunch";
   2680 static const char * const k_pch_SteamVR_StartOverlayAppsFromDashboard_Bool = "startOverlayAppsFromDashboard";
   2681 static const char * const k_pch_SteamVR_EnableHomeApp = "enableHomeApp";
   2682 static const char * const k_pch_SteamVR_CycleBackgroundImageTimeSec_Int32 = "CycleBackgroundImageTimeSec";
   2683 static const char * const k_pch_SteamVR_RetailDemo_Bool = "retailDemo";
   2684 static const char * const k_pch_SteamVR_IpdOffset_Float = "ipdOffset";
   2685 static const char * const k_pch_SteamVR_AllowSupersampleFiltering_Bool = "allowSupersampleFiltering";
   2686 static const char * const k_pch_SteamVR_SupersampleManualOverride_Bool = "supersampleManualOverride";
   2687 static const char * const k_pch_SteamVR_EnableLinuxVulkanAsync_Bool = "enableLinuxVulkanAsync";
   2688 static const char * const k_pch_SteamVR_AllowDisplayLockedMode_Bool = "allowDisplayLockedMode";
   2689 static const char * const k_pch_SteamVR_HaveStartedTutorialForNativeChaperoneDriver_Bool = "haveStartedTutorialForNativeChaperoneDriver";
   2690 static const char * const k_pch_SteamVR_ForceWindows32bitVRMonitor = "forceWindows32BitVRMonitor";
   2691 static const char * const k_pch_SteamVR_DebugInputBinding = "debugInputBinding";
   2692 static const char * const k_pch_SteamVR_DoNotFadeToGrid = "doNotFadeToGrid";
   2693 static const char * const k_pch_SteamVR_RenderCameraMode = "renderCameraMode";
   2694 static const char * const k_pch_SteamVR_EnableSharedResourceJournaling = "enableSharedResourceJournaling";
   2695 static const char * const k_pch_SteamVR_EnableSafeMode = "enableSafeMode";
   2696 static const char * const k_pch_SteamVR_PreferredRefreshRate = "preferredRefreshRate";
   2697 static const char * const k_pch_SteamVR_LastVersionNotice = "lastVersionNotice";
   2698 static const char * const k_pch_SteamVR_LastVersionNoticeDate = "lastVersionNoticeDate";
   2699 static const char * const k_pch_SteamVR_HmdDisplayColorGainR_Float = "hmdDisplayColorGainR";
   2700 static const char * const k_pch_SteamVR_HmdDisplayColorGainG_Float = "hmdDisplayColorGainG";
   2701 static const char * const k_pch_SteamVR_HmdDisplayColorGainB_Float = "hmdDisplayColorGainB";
   2702 static const char * const k_pch_SteamVR_CustomIconStyle_String = "customIconStyle";
   2703 static const char * const k_pch_SteamVR_CustomOffIconStyle_String = "customOffIconStyle";
   2704 static const char * const k_pch_SteamVR_CustomIconForceUpdate_String = "customIconForceUpdate";
   2705 static const char * const k_pch_SteamVR_AllowGlobalActionSetPriority = "globalActionSetPriority";
   2706 static const char * const k_pch_SteamVR_OverlayRenderQuality = "overlayRenderQuality_2";
   2707 
   2708 //-----------------------------------------------------------------------------
   2709 // direct mode keys
   2710 static const char * const k_pch_DirectMode_Section = "direct_mode";
   2711 static const char * const k_pch_DirectMode_Enable_Bool = "enable";
   2712 static const char * const k_pch_DirectMode_Count_Int32 = "count";
   2713 static const char * const k_pch_DirectMode_EdidVid_Int32 = "edidVid";
   2714 static const char * const k_pch_DirectMode_EdidPid_Int32 = "edidPid";
   2715 
   2716 //-----------------------------------------------------------------------------
   2717 // lighthouse keys
   2718 static const char * const k_pch_Lighthouse_Section = "driver_lighthouse";
   2719 static const char * const k_pch_Lighthouse_DisableIMU_Bool = "disableimu";
   2720 static const char * const k_pch_Lighthouse_DisableIMUExceptHMD_Bool = "disableimuexcepthmd";
   2721 static const char * const k_pch_Lighthouse_UseDisambiguation_String = "usedisambiguation";
   2722 static const char * const k_pch_Lighthouse_DisambiguationDebug_Int32 = "disambiguationdebug";
   2723 static const char * const k_pch_Lighthouse_PrimaryBasestation_Int32 = "primarybasestation";
   2724 static const char * const k_pch_Lighthouse_DBHistory_Bool = "dbhistory";
   2725 static const char * const k_pch_Lighthouse_EnableBluetooth_Bool = "enableBluetooth";
   2726 static const char * const k_pch_Lighthouse_PowerManagedBaseStations_String = "PowerManagedBaseStations";
   2727 static const char * const k_pch_Lighthouse_PowerManagedBaseStations2_String = "PowerManagedBaseStations2";
   2728 static const char * const k_pch_Lighthouse_InactivityTimeoutForBaseStations_Int32 = "InactivityTimeoutForBaseStations";
   2729 static const char * const k_pch_Lighthouse_EnableImuFallback_Bool = "enableImuFallback";
   2730 
   2731 //-----------------------------------------------------------------------------
   2732 // null keys
   2733 static const char * const k_pch_Null_Section = "driver_null";
   2734 static const char * const k_pch_Null_SerialNumber_String = "serialNumber";
   2735 static const char * const k_pch_Null_ModelNumber_String = "modelNumber";
   2736 static const char * const k_pch_Null_WindowX_Int32 = "windowX";
   2737 static const char * const k_pch_Null_WindowY_Int32 = "windowY";
   2738 static const char * const k_pch_Null_WindowWidth_Int32 = "windowWidth";
   2739 static const char * const k_pch_Null_WindowHeight_Int32 = "windowHeight";
   2740 static const char * const k_pch_Null_RenderWidth_Int32 = "renderWidth";
   2741 static const char * const k_pch_Null_RenderHeight_Int32 = "renderHeight";
   2742 static const char * const k_pch_Null_SecondsFromVsyncToPhotons_Float = "secondsFromVsyncToPhotons";
   2743 static const char * const k_pch_Null_DisplayFrequency_Float = "displayFrequency";
   2744 
   2745 //-----------------------------------------------------------------------------
   2746 // Windows MR keys
   2747 static const char * const k_pch_WindowsMR_Section = "driver_holographic";
   2748 
   2749 //-----------------------------------------------------------------------------
   2750 // user interface keys
   2751 static const char * const k_pch_UserInterface_Section = "userinterface";
   2752 static const char * const k_pch_UserInterface_StatusAlwaysOnTop_Bool = "StatusAlwaysOnTop";
   2753 static const char * const k_pch_UserInterface_MinimizeToTray_Bool = "MinimizeToTray";
   2754 static const char * const k_pch_UserInterface_HidePopupsWhenStatusMinimized_Bool = "HidePopupsWhenStatusMinimized";
   2755 static const char * const k_pch_UserInterface_Screenshots_Bool = "screenshots";
   2756 static const char * const k_pch_UserInterface_ScreenshotType_Int = "screenshotType";
   2757 
   2758 //-----------------------------------------------------------------------------
   2759 // notification keys
   2760 static const char * const k_pch_Notifications_Section = "notifications";
   2761 static const char * const k_pch_Notifications_DoNotDisturb_Bool = "DoNotDisturb";
   2762 
   2763 //-----------------------------------------------------------------------------
   2764 // keyboard keys
   2765 static const char * const k_pch_Keyboard_Section = "keyboard";
   2766 static const char * const k_pch_Keyboard_TutorialCompletions = "TutorialCompletions";
   2767 static const char * const k_pch_Keyboard_ScaleX = "ScaleX";
   2768 static const char * const k_pch_Keyboard_ScaleY = "ScaleY";
   2769 static const char * const k_pch_Keyboard_OffsetLeftX = "OffsetLeftX";
   2770 static const char * const k_pch_Keyboard_OffsetRightX = "OffsetRightX";
   2771 static const char * const k_pch_Keyboard_OffsetY = "OffsetY";
   2772 static const char * const k_pch_Keyboard_Smoothing = "Smoothing";
   2773 
   2774 //-----------------------------------------------------------------------------
   2775 // perf keys
   2776 static const char * const k_pch_Perf_Section = "perfcheck";
   2777 static const char * const k_pch_Perf_PerfGraphInHMD_Bool = "perfGraphInHMD";
   2778 static const char * const k_pch_Perf_AllowTimingStore_Bool = "allowTimingStore";
   2779 static const char * const k_pch_Perf_SaveTimingsOnExit_Bool = "saveTimingsOnExit";
   2780 static const char * const k_pch_Perf_TestData_Float = "perfTestData";
   2781 static const char * const k_pch_Perf_GPUProfiling_Bool = "GPUProfiling";
   2782 
   2783 //-----------------------------------------------------------------------------
   2784 // collision bounds keys
   2785 static const char * const k_pch_CollisionBounds_Section = "collisionBounds";
   2786 static const char * const k_pch_CollisionBounds_Style_Int32 = "CollisionBoundsStyle";
   2787 static const char * const k_pch_CollisionBounds_GroundPerimeterOn_Bool = "CollisionBoundsGroundPerimeterOn";
   2788 static const char * const k_pch_CollisionBounds_CenterMarkerOn_Bool = "CollisionBoundsCenterMarkerOn";
   2789 static const char * const k_pch_CollisionBounds_PlaySpaceOn_Bool = "CollisionBoundsPlaySpaceOn";
   2790 static const char * const k_pch_CollisionBounds_FadeDistance_Float = "CollisionBoundsFadeDistance";
   2791 static const char * const k_pch_CollisionBounds_WallHeight_Float = "CollisionBoundsWallHeight";
   2792 static const char * const k_pch_CollisionBounds_ColorGammaR_Int32 = "CollisionBoundsColorGammaR";
   2793 static const char * const k_pch_CollisionBounds_ColorGammaG_Int32 = "CollisionBoundsColorGammaG";
   2794 static const char * const k_pch_CollisionBounds_ColorGammaB_Int32 = "CollisionBoundsColorGammaB";
   2795 static const char * const k_pch_CollisionBounds_ColorGammaA_Int32 = "CollisionBoundsColorGammaA";
   2796 static const char * const k_pch_CollisionBounds_EnableDriverImport = "enableDriverBoundsImport";
   2797 
   2798 //-----------------------------------------------------------------------------
   2799 // camera keys
   2800 static const char * const k_pch_Camera_Section = "camera";
   2801 static const char * const k_pch_Camera_EnableCamera_Bool = "enableCamera";
   2802 static const char * const k_pch_Camera_EnableCameraInDashboard_Bool = "enableCameraInDashboard";
   2803 static const char * const k_pch_Camera_EnableCameraForCollisionBounds_Bool = "enableCameraForCollisionBounds";
   2804 static const char * const k_pch_Camera_EnableCameraForRoomView_Bool = "enableCameraForRoomView";
   2805 static const char * const k_pch_Camera_BoundsColorGammaR_Int32 = "cameraBoundsColorGammaR";
   2806 static const char * const k_pch_Camera_BoundsColorGammaG_Int32 = "cameraBoundsColorGammaG";
   2807 static const char * const k_pch_Camera_BoundsColorGammaB_Int32 = "cameraBoundsColorGammaB";
   2808 static const char * const k_pch_Camera_BoundsColorGammaA_Int32 = "cameraBoundsColorGammaA";
   2809 static const char * const k_pch_Camera_BoundsStrength_Int32 = "cameraBoundsStrength";
   2810 static const char * const k_pch_Camera_RoomViewMode_Int32 = "cameraRoomViewMode";
   2811 
   2812 //-----------------------------------------------------------------------------
   2813 // audio keys
   2814 static const char * const k_pch_audio_Section = "audio";
   2815 static const char * const k_pch_audio_SetOsDefaultPlaybackDevice_Bool = "setOsDefaultPlaybackDevice";
   2816 static const char * const k_pch_audio_EnablePlaybackDeviceOverride_Bool = "enablePlaybackDeviceOverride";
   2817 static const char * const k_pch_audio_PlaybackDeviceOverride_String = "playbackDeviceOverride";
   2818 static const char * const k_pch_audio_PlaybackDeviceOverrideName_String = "playbackDeviceOverrideName";
   2819 static const char * const k_pch_audio_SetOsDefaultRecordingDevice_Bool = "setOsDefaultRecordingDevice";
   2820 static const char * const k_pch_audio_EnableRecordingDeviceOverride_Bool = "enableRecordingDeviceOverride";
   2821 static const char * const k_pch_audio_RecordingDeviceOverride_String = "recordingDeviceOverride";
   2822 static const char * const k_pch_audio_RecordingDeviceOverrideName_String = "recordingDeviceOverrideName";
   2823 static const char * const k_pch_audio_EnablePlaybackMirror_Bool = "enablePlaybackMirror";
   2824 static const char * const k_pch_audio_PlaybackMirrorDevice_String = "playbackMirrorDevice";
   2825 static const char * const k_pch_audio_PlaybackMirrorDeviceName_String = "playbackMirrorDeviceName";
   2826 static const char * const k_pch_audio_OldPlaybackMirrorDevice_String = "onPlaybackMirrorDevice";
   2827 static const char * const k_pch_audio_ActiveMirrorDevice_String = "activePlaybackMirrorDevice";
   2828 static const char * const k_pch_audio_EnablePlaybackMirrorIndependentVolume_Bool = "enablePlaybackMirrorIndependentVolume";
   2829 static const char * const k_pch_audio_LastHmdPlaybackDeviceId_String = "lastHmdPlaybackDeviceId";
   2830 static const char * const k_pch_audio_VIVEHDMIGain = "viveHDMIGain";
   2831 
   2832 //-----------------------------------------------------------------------------
   2833 // power management keys
   2834 static const char * const k_pch_Power_Section = "power";
   2835 static const char * const k_pch_Power_PowerOffOnExit_Bool = "powerOffOnExit";
   2836 static const char * const k_pch_Power_TurnOffScreensTimeout_Float = "turnOffScreensTimeout";
   2837 static const char * const k_pch_Power_TurnOffControllersTimeout_Float = "turnOffControllersTimeout";
   2838 static const char * const k_pch_Power_ReturnToWatchdogTimeout_Float = "returnToWatchdogTimeout";
   2839 static const char * const k_pch_Power_AutoLaunchSteamVROnButtonPress = "autoLaunchSteamVROnButtonPress";
   2840 static const char * const k_pch_Power_PauseCompositorOnStandby_Bool = "pauseCompositorOnStandby";
   2841 
   2842 //-----------------------------------------------------------------------------
   2843 // dashboard keys
   2844 static const char * const k_pch_Dashboard_Section = "dashboard";
   2845 static const char * const k_pch_Dashboard_EnableDashboard_Bool = "enableDashboard";
   2846 static const char * const k_pch_Dashboard_ArcadeMode_Bool = "arcadeMode";
   2847 static const char * const k_pch_Dashboard_Position = "position";
   2848 static const char * const k_pch_Dashboard_DesktopScale = "desktopScale";
   2849 static const char * const k_pch_Dashboard_DashboardScale = "dashboardScale";
   2850 
   2851 //-----------------------------------------------------------------------------
   2852 // model skin keys
   2853 static const char * const k_pch_modelskin_Section = "modelskins";
   2854 
   2855 //-----------------------------------------------------------------------------
   2856 // driver keys - These could be checked in any driver_<name> section
   2857 static const char * const k_pch_Driver_Enable_Bool = "enable";
   2858 static const char * const k_pch_Driver_BlockedBySafemode_Bool = "blocked_by_safe_mode";
   2859 static const char * const k_pch_Driver_LoadPriority_Int32 = "loadPriority";
   2860 
   2861 //-----------------------------------------------------------------------------
   2862 // web interface keys
   2863 static const char* const k_pch_WebInterface_Section = "WebInterface";
   2864 
   2865 //-----------------------------------------------------------------------------
   2866 // vrwebhelper keys
   2867 static const char* const k_pch_VRWebHelper_Section = "VRWebHelper";
   2868 static const char* const k_pch_VRWebHelper_DebuggerEnabled_Bool = "DebuggerEnabled";
   2869 static const char* const k_pch_VRWebHelper_DebuggerPort_Int32 = "DebuggerPort";
   2870 
   2871 //-----------------------------------------------------------------------------
   2872 // tracking overrides - keys are device paths, values are the device paths their
   2873 //  tracking/pose information overrides
   2874 static const char* const k_pch_TrackingOverride_Section = "TrackingOverrides";
   2875 
   2876 //-----------------------------------------------------------------------------
   2877 // per-app keys - the section name for these is the app key itself. Some of these are prefixed by the controller type
   2878 static const char* const k_pch_App_BindingAutosaveURLSuffix_String = "AutosaveURL";
   2879 static const char* const k_pch_App_BindingLegacyAPISuffix_String = "_legacy";
   2880 static const char* const k_pch_App_BindingSteamVRInputAPISuffix_String = "_steamvrinput";
   2881 static const char* const k_pch_App_BindingCurrentURLSuffix_String = "CurrentURL";
   2882 static const char* const k_pch_App_BindingPreviousURLSuffix_String = "PreviousURL";
   2883 static const char* const k_pch_App_NeedToUpdateAutosaveSuffix_Bool = "NeedToUpdateAutosave";
   2884 static const char* const k_pch_App_DominantHand_Int32 = "DominantHand";
   2885 
   2886 //-----------------------------------------------------------------------------
   2887 // configuration for trackers
   2888 static const char * const k_pch_Trackers_Section = "trackers";
   2889 
   2890 //-----------------------------------------------------------------------------
   2891 // configuration for desktop UI windows
   2892 static const char * const k_pch_DesktopUI_Section = "DesktopUI";
   2893 
   2894 //-----------------------------------------------------------------------------
   2895 // Last known keys for righting recovery
   2896 static const char * const k_pch_LastKnown_Section = "LastKnown";
   2897 static const char* const k_pch_LastKnown_HMDManufacturer_String = "HMDManufacturer";
   2898 static const char* const k_pch_LastKnown_HMDModel_String = "HMDModel";
   2899 
   2900 //-----------------------------------------------------------------------------
   2901 // Dismissed warnings
   2902 static const char * const k_pch_DismissedWarnings_Section = "DismissedWarnings";
   2903 
   2904 //-----------------------------------------------------------------------------
   2905 // Input Settings
   2906 static const char * const k_pch_Input_Section = "input";
   2907 static const char* const k_pch_Input_LeftThumbstickRotation_Float = "leftThumbstickRotation";
   2908 static const char* const k_pch_Input_RightThumbstickRotation_Float = "rightThumbstickRotation";
   2909 static const char* const k_pch_Input_ThumbstickDeadzone_Float = "thumbstickDeadzone";
   2910 
   2911 //-----------------------------------------------------------------------------
   2912 // Log of GPU performance
   2913 static const char * const k_pch_GpuSpeed_Section = "GpuSpeed";
   2914 
   2915 } // namespace vr
   2916 
   2917 // ivrchaperone.h
   2918 namespace vr
   2919 {
   2920 
   2921 #pragma pack( push, 8 )
   2922 
   2923 enum ChaperoneCalibrationState
   2924 {
   2925 // OK!
   2926 ChaperoneCalibrationState_OK = 1,									// Chaperone is fully calibrated and working correctly
   2927 
   2928 // Warnings
   2929 ChaperoneCalibrationState_Warning = 100,
   2930 ChaperoneCalibrationState_Warning_BaseStationMayHaveMoved = 101,	// A base station thinks that it might have moved
   2931 ChaperoneCalibrationState_Warning_BaseStationRemoved = 102,			// There are less base stations than when calibrated
   2932 ChaperoneCalibrationState_Warning_SeatedBoundsInvalid = 103,		// Seated bounds haven't been calibrated for the current tracking center
   2933 
   2934 // Errors
   2935 ChaperoneCalibrationState_Error = 200,								// The UniverseID is invalid
   2936 ChaperoneCalibrationState_Error_BaseStationUninitialized = 201,		// Tracking center hasn't be calibrated for at least one of the base stations
   2937 ChaperoneCalibrationState_Error_BaseStationConflict = 202,			// Tracking center is calibrated, but base stations disagree on the tracking space
   2938 ChaperoneCalibrationState_Error_PlayAreaInvalid = 203,				// Play Area hasn't been calibrated for the current tracking center
   2939 ChaperoneCalibrationState_Error_CollisionBoundsInvalid = 204,		// Collision Bounds haven't been calibrated for the current tracking center
   2940 };
   2941 
   2942 
   2943 /** HIGH LEVEL TRACKING SPACE ASSUMPTIONS:
   2944 * 0,0,0 is the preferred standing area center.
   2945 * 0Y is the floor height.
   2946 * -Z is the preferred forward facing direction. */
   2947 class IVRChaperone
   2948 {
   2949 public:
   2950 
   2951 /** Get the current state of Chaperone calibration. This state can change at any time during a session due to physical base station changes. **/
   2952 virtual ChaperoneCalibrationState GetCalibrationState() = 0;
   2953 
   2954 /** Returns the width and depth of the Play Area (formerly named Soft Bounds) in X and Z. 
   2955 * Tracking space center (0,0,0) is the center of the Play Area. **/
   2956 virtual bool GetPlayAreaSize( float *pSizeX, float *pSizeZ ) = 0;
   2957 
   2958 /** Returns the 4 corner positions of the Play Area (formerly named Soft Bounds).
   2959 * Corners are in counter-clockwise order.
   2960 * Standing center (0,0,0) is the center of the Play Area.
   2961 * It's a rectangle.
   2962 * 2 sides are parallel to the X axis and 2 sides are parallel to the Z axis.
   2963 * Height of every corner is 0Y (on the floor). **/
   2964 virtual bool GetPlayAreaRect( HmdQuad_t *rect ) = 0;
   2965 
   2966 /** Reload Chaperone data from the .vrchap file on disk. */
   2967 virtual void ReloadInfo( void ) = 0;
   2968 
   2969 /** Optionally give the chaperone system a hit about the color and brightness in the scene **/
   2970 virtual void SetSceneColor( HmdColor_t color ) = 0;
   2971 
   2972 /** Get the current chaperone bounds draw color and brightness **/
   2973 virtual void GetBoundsColor( HmdColor_t *pOutputColorArray, int nNumOutputColors, float flCollisionBoundsFadeDistance, HmdColor_t *pOutputCameraColor ) = 0;
   2974 
   2975 /** Determine whether the bounds are showing right now **/
   2976 virtual bool AreBoundsVisible() = 0;
   2977 
   2978 /** Force the bounds to show, mostly for utilities **/
   2979 virtual void ForceBoundsVisible( bool bForce ) = 0;
   2980 };
   2981 
   2982 static const char * const IVRChaperone_Version = "IVRChaperone_003";
   2983 
   2984 #pragma pack( pop )
   2985 
   2986 }
   2987 
   2988 // ivrchaperonesetup.h
   2989 namespace vr
   2990 {
   2991 
   2992 enum EChaperoneConfigFile
   2993 {
   2994 EChaperoneConfigFile_Live = 1,		// The live chaperone config, used by most applications and games
   2995 EChaperoneConfigFile_Temp = 2,		// The temporary chaperone config, used to live-preview collision bounds in room setup
   2996 };
   2997 
   2998 enum EChaperoneImportFlags
   2999 {
   3000 EChaperoneImport_BoundsOnly = 0x0001,
   3001 };
   3002 
   3003 /** Manages the working copy of the chaperone info. By default this will be the same as the 
   3004 * live copy. Any changes made with this interface will stay in the working copy until 
   3005 * CommitWorkingCopy() is called, at which point the working copy and the live copy will be 
   3006 * the same again. */
   3007 class IVRChaperoneSetup
   3008 {
   3009 public:
   3010 
   3011 /** Saves the current working copy to disk */
   3012 virtual bool CommitWorkingCopy( EChaperoneConfigFile configFile ) = 0;
   3013 
   3014 /** Reverts the working copy to match the live chaperone calibration.
   3015 * To modify existing data this MUST be do WHILE getting a non-error ChaperoneCalibrationStatus.
   3016 * Only after this should you do gets and sets on the existing data. */
   3017 virtual void RevertWorkingCopy() = 0;
   3018 
   3019 /** Returns the width and depth of the Play Area (formerly named Soft Bounds) in X and Z from the working copy.
   3020 * Tracking space center (0,0,0) is the center of the Play Area. */
   3021 virtual bool GetWorkingPlayAreaSize( float *pSizeX, float *pSizeZ ) = 0;
   3022 
   3023 /** Returns the 4 corner positions of the Play Area (formerly named Soft Bounds) from the working copy.
   3024 * Corners are in clockwise order.
   3025 * Tracking space center (0,0,0) is the center of the Play Area.
   3026 * It's a rectangle.
   3027 * 2 sides are parallel to the X axis and 2 sides are parallel to the Z axis.
   3028 * Height of every corner is 0Y (on the floor). **/
   3029 virtual bool GetWorkingPlayAreaRect( HmdQuad_t *rect ) = 0;
   3030 
   3031 /** Returns the number of Quads if the buffer points to null. Otherwise it returns Quads 
   3032 * into the buffer up to the max specified from the working copy. */
   3033 virtual bool GetWorkingCollisionBoundsInfo( VR_OUT_ARRAY_COUNT(punQuadsCount) HmdQuad_t *pQuadsBuffer, uint32_t* punQuadsCount ) = 0;
   3034 
   3035 /** Returns the number of Quads if the buffer points to null. Otherwise it returns Quads 
   3036 * into the buffer up to the max specified. */
   3037 virtual bool GetLiveCollisionBoundsInfo( VR_OUT_ARRAY_COUNT(punQuadsCount) HmdQuad_t *pQuadsBuffer, uint32_t* punQuadsCount ) = 0;
   3038 
   3039 /** Returns the preferred seated position from the working copy. */
   3040 virtual bool GetWorkingSeatedZeroPoseToRawTrackingPose( HmdMatrix34_t *pmatSeatedZeroPoseToRawTrackingPose ) = 0;
   3041 
   3042 /** Returns the standing origin from the working copy. */
   3043 virtual bool GetWorkingStandingZeroPoseToRawTrackingPose( HmdMatrix34_t *pmatStandingZeroPoseToRawTrackingPose ) = 0;
   3044 
   3045 /** Sets the Play Area in the working copy. */
   3046 virtual void SetWorkingPlayAreaSize( float sizeX, float sizeZ ) = 0;
   3047 
   3048 /** Sets the Collision Bounds in the working copy. Note: ceiling height is ignored. */
   3049 virtual void SetWorkingCollisionBoundsInfo( VR_ARRAY_COUNT(unQuadsCount) HmdQuad_t *pQuadsBuffer, uint32_t unQuadsCount ) = 0;
   3050 
   3051 /** Sets the Collision Bounds in the working copy. */
   3052 virtual void SetWorkingPerimeter( VR_ARRAY_COUNT( unPointCount ) HmdVector2_t *pPointBuffer, uint32_t unPointCount ) = 0;
   3053 
   3054 /** Sets the preferred seated position in the working copy. */
   3055 virtual void SetWorkingSeatedZeroPoseToRawTrackingPose( const HmdMatrix34_t *pMatSeatedZeroPoseToRawTrackingPose ) = 0;
   3056 
   3057 /** Sets the preferred standing position in the working copy. */
   3058 virtual void SetWorkingStandingZeroPoseToRawTrackingPose( const HmdMatrix34_t *pMatStandingZeroPoseToRawTrackingPose ) = 0;
   3059 
   3060 /** Tear everything down and reload it from the file on disk */
   3061 virtual void ReloadFromDisk( EChaperoneConfigFile configFile ) = 0;
   3062 
   3063 /** Returns the preferred seated position. */
   3064 virtual bool GetLiveSeatedZeroPoseToRawTrackingPose( HmdMatrix34_t *pmatSeatedZeroPoseToRawTrackingPose ) = 0;
   3065 
   3066 virtual bool ExportLiveToBuffer( VR_OUT_STRING() char *pBuffer, uint32_t *pnBufferLength ) = 0;
   3067 virtual bool ImportFromBufferToWorking( const char *pBuffer, uint32_t nImportFlags ) = 0;
   3068 
   3069 /** Shows the chaperone data in the working set to preview in the compositor.*/
   3070 virtual void ShowWorkingSetPreview() = 0;
   3071 
   3072 /** Hides the chaperone data in the working set to preview in the compositor (if it was visible).*/
   3073 virtual void HideWorkingSetPreview() = 0;
   3074 
   3075 /** Fire an event that the tracking system can use to know room setup is about to begin. This lets the tracking
   3076  * system make any last minute adjustments that should be incorporated into the new setup.  If the user is adjusting
   3077  * live in HMD using a tweak tool, keep in mind that calling this might cause the user to see the room jump. */
   3078 virtual void RoomSetupStarting() = 0;
   3079 };
   3080 
   3081 static const char * const IVRChaperoneSetup_Version = "IVRChaperoneSetup_006";
   3082 
   3083 
   3084 }
   3085 
   3086 // ivrcompositor.h
   3087 namespace vr
   3088 {
   3089 
   3090 #pragma pack( push, 8 )
   3091 
   3092 /** Errors that can occur with the VR compositor */
   3093 enum EVRCompositorError
   3094 {
   3095 VRCompositorError_None						= 0,
   3096 VRCompositorError_RequestFailed				= 1,
   3097 VRCompositorError_IncompatibleVersion		= 100,
   3098 VRCompositorError_DoNotHaveFocus			= 101,
   3099 VRCompositorError_InvalidTexture			= 102,
   3100 VRCompositorError_IsNotSceneApplication		= 103,
   3101 VRCompositorError_TextureIsOnWrongDevice	= 104,
   3102 VRCompositorError_TextureUsesUnsupportedFormat = 105,
   3103 VRCompositorError_SharedTexturesNotSupported = 106,
   3104 VRCompositorError_IndexOutOfRange			= 107,
   3105 VRCompositorError_AlreadySubmitted			= 108,
   3106 VRCompositorError_InvalidBounds				= 109,
   3107 VRCompositorError_AlreadySet				= 110,
   3108 };
   3109 
   3110 /** Timing mode passed to SetExplicitTimingMode(); see that function for documentation */
   3111 enum EVRCompositorTimingMode
   3112 {
   3113 VRCompositorTimingMode_Implicit											= 0,
   3114 VRCompositorTimingMode_Explicit_RuntimePerformsPostPresentHandoff		= 1,
   3115 VRCompositorTimingMode_Explicit_ApplicationPerformsPostPresentHandoff	= 2,
   3116 };
   3117 
   3118 /** Cumulative stats for current application.  These are not cleared until a new app connects,
   3119 * but they do stop accumulating once the associated app disconnects. */
   3120 struct Compositor_CumulativeStats
   3121 {
   3122 uint32_t m_nPid; // Process id associated with these stats (may no longer be running).
   3123 uint32_t m_nNumFramePresents; // total number of times we called present (includes reprojected frames)
   3124 uint32_t m_nNumDroppedFrames; // total number of times an old frame was re-scanned out (without reprojection)
   3125 uint32_t m_nNumReprojectedFrames; // total number of times a frame was scanned out a second time (with reprojection)
   3126 
   3127 /** Values recorded at startup before application has fully faded in the first time. */
   3128 uint32_t m_nNumFramePresentsOnStartup;
   3129 uint32_t m_nNumDroppedFramesOnStartup;
   3130 uint32_t m_nNumReprojectedFramesOnStartup;
   3131 
   3132 /** Applications may explicitly fade to the compositor.  This is usually to handle level transitions, and loading often causes
   3133 * system wide hitches.  The following stats are collected during this period.  Does not include values recorded during startup. */
   3134 uint32_t m_nNumLoading;
   3135 uint32_t m_nNumFramePresentsLoading;
   3136 uint32_t m_nNumDroppedFramesLoading;
   3137 uint32_t m_nNumReprojectedFramesLoading;
   3138 
   3139 /** If we don't get a new frame from the app in less than 2.5 frames, then we assume the app has hung and start
   3140 * fading back to the compositor.  The following stats are a result of this, and are a subset of those recorded above.
   3141 * Does not include values recorded during start up or loading. */
   3142 uint32_t m_nNumTimedOut;
   3143 uint32_t m_nNumFramePresentsTimedOut;
   3144 uint32_t m_nNumDroppedFramesTimedOut;
   3145 uint32_t m_nNumReprojectedFramesTimedOut;
   3146 };
   3147 
   3148 struct Compositor_StageRenderSettings
   3149 {
   3150 /** Primary color is applied as a tint to (i.e. multiplied with) the model's texture */
   3151 HmdColor_t m_PrimaryColor;
   3152 HmdColor_t m_SecondaryColor;
   3153 
   3154 /** Vignette radius is in meters and is used to fade to the specified secondary solid color over
   3155 * that 3D distance from the origin of the playspace. */
   3156 float m_flVignetteInnerRadius;
   3157 float m_flVignetteOuterRadius;
   3158 
   3159 /** Fades to the secondary color based on view incidence.  This variable controls the linearity
   3160 * of the effect.  It is mutually exclusive with vignette.  Additionally, it treats the mesh as faceted. */
   3161 float m_flFresnelStrength;
   3162 
   3163 /** Controls backface culling. */
   3164 bool m_bBackfaceCulling;
   3165 
   3166 /** Converts the render model's texture to luma and applies to rgb equally.  This is useful to
   3167 * combat compression artifacts that can occur on desaturated source material. */
   3168 bool m_bGreyscale;
   3169 
   3170 /** Renders mesh as a wireframe. */
   3171 bool m_bWireframe;
   3172 };
   3173 
   3174 static inline Compositor_StageRenderSettings DefaultStageRenderSettings()
   3175 {
   3176 Compositor_StageRenderSettings settings;
   3177 settings.m_PrimaryColor.r = 1.0f;
   3178 settings.m_PrimaryColor.g = 1.0f;
   3179 settings.m_PrimaryColor.b = 1.0f;
   3180 settings.m_PrimaryColor.a = 1.0f;
   3181 settings.m_SecondaryColor.r = 1.0f;
   3182 settings.m_SecondaryColor.g = 1.0f;
   3183 settings.m_SecondaryColor.b = 1.0f;
   3184 settings.m_SecondaryColor.a = 1.0f;
   3185 settings.m_flVignetteInnerRadius = 0.0f;
   3186 settings.m_flVignetteOuterRadius = 0.0f;
   3187 settings.m_flFresnelStrength = 0.0f;
   3188 settings.m_bBackfaceCulling = false;
   3189 settings.m_bGreyscale = false;
   3190 settings.m_bWireframe = false;
   3191 return settings;
   3192 }
   3193 
   3194 #pragma pack( pop )
   3195 
   3196 /** Allows the application to interact with the compositor */
   3197 class IVRCompositor
   3198 {
   3199 public:
   3200 /** Sets tracking space returned by WaitGetPoses */
   3201 virtual void SetTrackingSpace( ETrackingUniverseOrigin eOrigin ) = 0;
   3202 
   3203 /** Gets current tracking space returned by WaitGetPoses */
   3204 virtual ETrackingUniverseOrigin GetTrackingSpace() = 0;
   3205 
   3206 /** Scene applications should call this function to get poses to render with (and optionally poses predicted an additional frame out to use for gameplay).
   3207 * This function will block until "running start" milliseconds before the start of the frame, and should be called at the last moment before needing to
   3208 * start rendering.
   3209 *
   3210 * Return codes:
   3211 *	- IsNotSceneApplication (make sure to call VR_Init with VRApplicaiton_Scene)
   3212 *	- DoNotHaveFocus (some other app has taken focus - this will throttle the call to 10hz to reduce the impact on that app)
   3213 */
   3214 virtual EVRCompositorError WaitGetPoses( VR_ARRAY_COUNT( unRenderPoseArrayCount ) TrackedDevicePose_t* pRenderPoseArray, uint32_t unRenderPoseArrayCount,
   3215 	VR_ARRAY_COUNT( unGamePoseArrayCount ) TrackedDevicePose_t* pGamePoseArray, uint32_t unGamePoseArrayCount ) = 0;
   3216 
   3217 /** Get the last set of poses returned by WaitGetPoses. */
   3218 virtual EVRCompositorError GetLastPoses( VR_ARRAY_COUNT( unRenderPoseArrayCount ) TrackedDevicePose_t* pRenderPoseArray, uint32_t unRenderPoseArrayCount,
   3219 	VR_ARRAY_COUNT( unGamePoseArrayCount ) TrackedDevicePose_t* pGamePoseArray, uint32_t unGamePoseArrayCount ) = 0;
   3220 
   3221 /** Interface for accessing last set of poses returned by WaitGetPoses one at a time.
   3222 * Returns VRCompositorError_IndexOutOfRange if unDeviceIndex not less than k_unMaxTrackedDeviceCount otherwise VRCompositorError_None.
   3223 * It is okay to pass NULL for either pose if you only want one of the values. */
   3224 virtual EVRCompositorError GetLastPoseForTrackedDeviceIndex( TrackedDeviceIndex_t unDeviceIndex, TrackedDevicePose_t *pOutputPose, TrackedDevicePose_t *pOutputGamePose ) = 0;
   3225 
   3226 /** Updated scene texture to display. If pBounds is NULL the entire texture will be used.  If called from an OpenGL app, consider adding a glFlush after
   3227 * Submitting both frames to signal the driver to start processing, otherwise it may wait until the command buffer fills up, causing the app to miss frames.
   3228 *
   3229 * OpenGL dirty state:
   3230 *	glBindTexture
   3231 *
   3232 * Return codes:
   3233 *	- IsNotSceneApplication (make sure to call VR_Init with VRApplicaiton_Scene)
   3234 *	- DoNotHaveFocus (some other app has taken focus)
   3235 *	- TextureIsOnWrongDevice (application did not use proper AdapterIndex - see IVRSystem.GetDXGIOutputInfo)
   3236 *	- SharedTexturesNotSupported (application needs to call CreateDXGIFactory1 or later before creating DX device)
   3237 *	- TextureUsesUnsupportedFormat (scene textures must be compatible with DXGI sharing rules - e.g. uncompressed, no mips, etc.)
   3238 *	- InvalidTexture (usually means bad arguments passed in)
   3239 *	- AlreadySubmitted (app has submitted two left textures or two right textures in a single frame - i.e. before calling WaitGetPoses again)
   3240 */
   3241 virtual EVRCompositorError Submit( EVREye eEye, const Texture_t *pTexture, const VRTextureBounds_t* pBounds = 0, EVRSubmitFlags nSubmitFlags = Submit_Default ) = 0;
   3242 
   3243 /** Clears the frame that was sent with the last call to Submit. This will cause the 
   3244 * compositor to show the grid until Submit is called again. */
   3245 virtual void ClearLastSubmittedFrame() = 0;
   3246 
   3247 /** Call immediately after presenting your app's window (i.e. companion window) to unblock the compositor.
   3248 * This is an optional call, which only needs to be used if you can't instead call WaitGetPoses immediately after Present.
   3249 * For example, if your engine's render and game loop are not on separate threads, or blocking the render thread until 3ms before the next vsync would
   3250 * introduce a deadlock of some sort.  This function tells the compositor that you have finished all rendering after having Submitted buffers for both
   3251 * eyes, and it is free to start its rendering work.  This should only be called from the same thread you are rendering on. */
   3252 virtual void PostPresentHandoff() = 0;
   3253 
   3254 /** Returns true if timing data is filled it.  Sets oldest timing info if nFramesAgo is larger than the stored history.
   3255 * Be sure to set timing.size = sizeof(Compositor_FrameTiming) on struct passed in before calling this function. */
   3256 virtual bool GetFrameTiming( Compositor_FrameTiming *pTiming, uint32_t unFramesAgo = 0 ) = 0;
   3257 
   3258 /** Interface for copying a range of timing data.  Frames are returned in ascending order (oldest to newest) with the last being the most recent frame.
   3259 * Only the first entry's m_nSize needs to be set, as the rest will be inferred from that.  Returns total number of entries filled out. */
   3260 virtual uint32_t GetFrameTimings( VR_ARRAY_COUNT( nFrames ) Compositor_FrameTiming *pTiming, uint32_t nFrames ) = 0;
   3261 
   3262 /** Returns the time in seconds left in the current (as identified by FrameTiming's frameIndex) frame.
   3263 * Due to "running start", this value may roll over to the next frame before ever reaching 0.0. */
   3264 virtual float GetFrameTimeRemaining() = 0;
   3265 
   3266 /** Fills out stats accumulated for the last connected application.  Pass in sizeof( Compositor_CumulativeStats ) as second parameter. */
   3267 virtual void GetCumulativeStats( Compositor_CumulativeStats *pStats, uint32_t nStatsSizeInBytes ) = 0;
   3268 
   3269 /** Fades the view on the HMD to the specified color. The fade will take fSeconds, and the color values are between
   3270 * 0.0 and 1.0. This color is faded on top of the scene based on the alpha parameter. Removing the fade color instantly 
   3271 * would be FadeToColor( 0.0, 0.0, 0.0, 0.0, 0.0 ).  Values are in un-premultiplied alpha space. */
   3272 virtual void FadeToColor( float fSeconds, float fRed, float fGreen, float fBlue, float fAlpha, bool bBackground = false ) = 0;
   3273 
   3274 /** Get current fade color value. */
   3275 virtual HmdColor_t GetCurrentFadeColor( bool bBackground = false ) = 0;
   3276 
   3277 /** Fading the Grid in or out in fSeconds */
   3278 virtual void FadeGrid( float fSeconds, bool bFadeIn ) = 0;
   3279 
   3280 /** Get current alpha value of grid. */
   3281 virtual float GetCurrentGridAlpha() = 0;
   3282 
   3283 /** Override the skybox used in the compositor (e.g. for during level loads when the app can't feed scene images fast enough)
   3284 * Order is Front, Back, Left, Right, Top, Bottom.  If only a single texture is passed, it is assumed in lat-long format.
   3285 * If two are passed, it is assumed a lat-long stereo pair. */
   3286 virtual EVRCompositorError SetSkyboxOverride( VR_ARRAY_COUNT( unTextureCount ) const Texture_t *pTextures, uint32_t unTextureCount ) = 0;
   3287 
   3288 /** Resets compositor skybox back to defaults. */
   3289 virtual void ClearSkyboxOverride() = 0;
   3290 
   3291 /** Brings the compositor window to the front. This is useful for covering any other window that may be on the HMD
   3292 * and is obscuring the compositor window. */
   3293 virtual void CompositorBringToFront() = 0;
   3294 
   3295 /** Pushes the compositor window to the back. This is useful for allowing other applications to draw directly to the HMD. */
   3296 virtual void CompositorGoToBack() = 0;
   3297 
   3298 /** Tells the compositor process to clean up and exit. You do not need to call this function at shutdown. Under normal 
   3299 * circumstances the compositor will manage its own life cycle based on what applications are running. */
   3300 virtual void CompositorQuit() = 0;
   3301 
   3302 /** Return whether the compositor is fullscreen */
   3303 virtual bool IsFullscreen() = 0;
   3304 
   3305 /** Returns the process ID of the process that is currently rendering the scene */
   3306 virtual uint32_t GetCurrentSceneFocusProcess() = 0;
   3307 
   3308 /** Returns the process ID of the process that rendered the last frame (or 0 if the compositor itself rendered the frame.)
   3309 * Returns 0 when fading out from an app and the app's process Id when fading into an app. */
   3310 virtual uint32_t GetLastFrameRenderer() = 0;
   3311 
   3312 /** Returns true if the current process has the scene focus */
   3313 virtual bool CanRenderScene() = 0;
   3314 
   3315 /** DEPRECATED: Opens the headset view (as either a window or docked widget depending on user's preferences) that displays what the user
   3316 * sees in the headset. */
   3317 virtual void ShowMirrorWindow() = 0;
   3318 
   3319 /** DEPRECATED: Closes the headset view, either as a window or docked widget. */
   3320 virtual void HideMirrorWindow() = 0;
   3321 
   3322 /** DEPRECATED: Returns true if the headset view (either as a window or docked widget) is shown. */
   3323 virtual bool IsMirrorWindowVisible() = 0;
   3324 
   3325 /** Writes back buffer and stereo left/right pair from the application to a 'screenshots' folder in the SteamVR runtime root. */
   3326 virtual void CompositorDumpImages() = 0;
   3327 
   3328 /** Let an app know it should be rendering with low resources. */
   3329 virtual bool ShouldAppRenderWithLowResources() = 0;
   3330 
   3331 /** Override interleaved reprojection logic to force on. */
   3332 virtual void ForceInterleavedReprojectionOn( bool bOverride ) = 0;
   3333 
   3334 /** Force reconnecting to the compositor process. */
   3335 virtual void ForceReconnectProcess() = 0;
   3336 
   3337 /** Temporarily suspends rendering (useful for finer control over scene transitions). */
   3338 virtual void SuspendRendering( bool bSuspend ) = 0;
   3339 
   3340 /** Opens a shared D3D11 texture with the undistorted composited image for each eye.  Use ReleaseMirrorTextureD3D11 when finished
   3341 * instead of calling Release on the resource itself. */
   3342 virtual vr::EVRCompositorError GetMirrorTextureD3D11( vr::EVREye eEye, void *pD3D11DeviceOrResource, void **ppD3D11ShaderResourceView ) = 0;
   3343 virtual void ReleaseMirrorTextureD3D11( void *pD3D11ShaderResourceView ) = 0;
   3344 
   3345 /** Access to mirror textures from OpenGL. */
   3346 virtual vr::EVRCompositorError GetMirrorTextureGL( vr::EVREye eEye, vr::glUInt_t *pglTextureId, vr::glSharedTextureHandle_t *pglSharedTextureHandle ) = 0;
   3347 virtual bool ReleaseSharedGLTexture( vr::glUInt_t glTextureId, vr::glSharedTextureHandle_t glSharedTextureHandle ) = 0;
   3348 virtual void LockGLSharedTextureForAccess( vr::glSharedTextureHandle_t glSharedTextureHandle ) = 0;
   3349 virtual void UnlockGLSharedTextureForAccess( vr::glSharedTextureHandle_t glSharedTextureHandle ) = 0;
   3350 
   3351 /** [Vulkan Only]
   3352 * return 0. Otherwise it returns the length of the number of bytes necessary to hold this string including the trailing
   3353 * null.  The string will be a space separated list of-required instance extensions to enable in VkCreateInstance */
   3354 virtual uint32_t GetVulkanInstanceExtensionsRequired( VR_OUT_STRING() char *pchValue, uint32_t unBufferSize ) = 0;
   3355 
   3356 /** [Vulkan only]
   3357 * return 0. Otherwise it returns the length of the number of bytes necessary to hold this string including the trailing
   3358 * null.  The string will be a space separated list of required device extensions to enable in VkCreateDevice */
   3359 virtual uint32_t GetVulkanDeviceExtensionsRequired( VkPhysicalDevice_T *pPhysicalDevice, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize ) = 0;
   3360 
   3361 /** [ Vulkan/D3D12 Only ]
   3362 * There are two purposes for SetExplicitTimingMode:
   3363 *	1. To get a more accurate GPU timestamp for when the frame begins in Vulkan/D3D12 applications.
   3364 *	2. (Optional) To avoid having WaitGetPoses access the Vulkan queue so that the queue can be accessed from
   3365 *	another thread while WaitGetPoses is executing.
   3366 *
   3367 * More accurate GPU timestamp for the start of the frame is achieved by the application calling
   3368 * SubmitExplicitTimingData immediately before its first submission to the Vulkan/D3D12 queue.
   3369 * This is more accurate because normally this GPU timestamp is recorded during WaitGetPoses.  In D3D11, 
   3370 * WaitGetPoses queues a GPU timestamp write, but it does not actually get submitted to the GPU until the 
   3371 * application flushes.  By using SubmitExplicitTimingData, the timestamp is recorded at the same place for 
   3372 * Vulkan/D3D12 as it is for D3D11, resulting in a more accurate GPU time measurement for the frame.
   3373 *
   3374 * Avoiding WaitGetPoses accessing the Vulkan queue can be achieved using SetExplicitTimingMode as well.  If this is desired,
   3375 * the application should set the timing mode to Explicit_ApplicationPerformsPostPresentHandoff and *MUST* call PostPresentHandoff
   3376 * itself. If these conditions are met, then WaitGetPoses is guaranteed not to access the queue.  Note that PostPresentHandoff
   3377 * and SubmitExplicitTimingData will access the queue, so only WaitGetPoses becomes safe for accessing the queue from another
   3378 * thread. */
   3379 virtual void SetExplicitTimingMode( EVRCompositorTimingMode eTimingMode ) = 0;
   3380 
   3381 /** [ Vulkan/D3D12 Only ]
   3382 * Submit explicit timing data.  When SetExplicitTimingMode is true, this must be called immediately before
   3383 * the application's first vkQueueSubmit (Vulkan) or ID3D12CommandQueue::ExecuteCommandLists (D3D12) of each frame.
   3384 * This function will insert a GPU timestamp write just before the application starts its rendering.  This function
   3385 * will perform a vkQueueSubmit on Vulkan so must not be done simultaneously with VkQueue operations on another thread.
   3386 * Returns VRCompositorError_RequestFailed if SetExplicitTimingMode is not enabled. */
   3387 virtual EVRCompositorError SubmitExplicitTimingData() = 0;
   3388 
   3389 /** Indicates whether or not motion smoothing is enabled by the user settings.
   3390 * If you want to know if motion smoothing actually triggered due to a late frame, check Compositor_FrameTiming
   3391 * m_nReprojectionFlags & VRCompositor_ReprojectionMotion instead. */
   3392 virtual bool IsMotionSmoothingEnabled() = 0;
   3393 
   3394 /** Indicates whether or not motion smoothing is supported by the current hardware. */
   3395 virtual bool IsMotionSmoothingSupported() = 0;
   3396 
   3397 /** Indicates whether or not the current scene focus app is currently loading.  This is inferred from its use of FadeGrid to
   3398 * explicitly fade to the compositor to cover up the fact that it cannot render at a sustained full framerate during this time. */
   3399 virtual bool IsCurrentSceneFocusAppLoading() = 0;
   3400 
   3401 /** Override the stage model used in the compositor to replace the grid.  RenderModelPath is a full path the an OBJ file to load.
   3402 * This file will be loaded asynchronously from disk and uploaded to the gpu by the runtime.  Once ready for rendering, the
   3403 * VREvent StageOverrideReady will be sent.  Use FadeToGrid to reveal.  Call ClearStageOverride to free the associated resources when finished. */
   3404 virtual EVRCompositorError SetStageOverride_Async( const char *pchRenderModelPath, const HmdMatrix34_t *pTransform = 0,
   3405 	const Compositor_StageRenderSettings *pRenderSettings = 0, uint32_t nSizeOfRenderSettings = 0 ) = 0;
   3406 
   3407 /** Resets the stage to its default user specified setting. */
   3408 virtual void ClearStageOverride() = 0;
   3409 
   3410 /** Returns true if pBenchmarkResults is filled it.  Sets pBenchmarkResults with the result of the compositor benchmark.
   3411 * nSizeOfBenchmarkResults should be set to sizeof(Compositor_BenchmarkResults) */
   3412 virtual bool GetCompositorBenchmarkResults( Compositor_BenchmarkResults *pBenchmarkResults, uint32_t nSizeOfBenchmarkResults ) = 0;
   3413 
   3414 /** Returns the frame id associated with the poses last returned by WaitGetPoses.  Deltas between IDs correspond to number of headset vsync intervals. */
   3415 virtual EVRCompositorError GetLastPosePredictionIDs( uint32_t *pRenderPosePredictionID, uint32_t *pGamePosePredictionID ) = 0;
   3416 
   3417 /** Get the most up-to-date predicted (or recorded - up to 100ms old) set of poses for a given frame id. */
   3418 virtual EVRCompositorError GetPosesForFrame( uint32_t unPosePredictionID, VR_ARRAY_COUNT( unPoseArrayCount ) TrackedDevicePose_t* pPoseArray, uint32_t unPoseArrayCount ) = 0;
   3419 };
   3420 
   3421 static const char * const IVRCompositor_Version = "IVRCompositor_026";
   3422 
   3423 } // namespace vr
   3424 
   3425 
   3426 
   3427 // ivrheadsetview.h
   3428 namespace vr
   3429 {
   3430 enum HeadsetViewMode_t
   3431 {
   3432 	HeadsetViewMode_Left = 0,
   3433 	HeadsetViewMode_Right,
   3434 	HeadsetViewMode_Both
   3435 };
   3436 
   3437 class IVRHeadsetView
   3438 {
   3439 public:
   3440 	/** Sets the resolution in pixels to render the headset view. These values are clamped to k_unHeadsetViewMaxWidth
   3441 	* and k_unHeadsetViewMaxHeight respectively. For cropped views, the rendered output will be fit to aspect ratio
   3442 	* defined by the the specified dimensions. For uncropped views, the caller should use GetHeadsetViewAspectRation
   3443 	* to adjust the requested render size to avoid squashing or stretching, and then apply letterboxing to compensate
   3444 	* when displaying the results. */
   3445 	virtual void SetHeadsetViewSize( uint32_t nWidth, uint32_t nHeight ) = 0;
   3446 
   3447 	/** Gets the current resolution used to render the headset view. */
   3448 	virtual void GetHeadsetViewSize( uint32_t *pnWidth, uint32_t *pnHeight ) = 0;
   3449 
   3450 	/** Set the mode used to render the headset view. */
   3451 	virtual void SetHeadsetViewMode( HeadsetViewMode_t eHeadsetViewMode ) = 0;
   3452 
   3453 	/** Get the current mode used to render the headset view. */
   3454 	virtual HeadsetViewMode_t GetHeadsetViewMode() = 0;
   3455 
   3456 	/** Set whether or not the headset view should be rendered cropped to hide the hidden area mesh or not. */
   3457 	virtual void SetHeadsetViewCropped( bool bCropped ) = 0;
   3458 
   3459 	/** Get the current cropping status of the headset view. */
   3460 	virtual bool GetHeadsetViewCropped() = 0;
   3461 
   3462 	/** Get the aspect ratio (width:height) of the uncropped headset view (accounting for the current set mode). */
   3463 	virtual float GetHeadsetViewAspectRatio() = 0;
   3464 
   3465 	/** Set the range [0..1] that the headset view blends across the stereo overlapped area in cropped both mode. */
   3466 	virtual void SetHeadsetViewBlendRange( float flStartPct, float flEndPct ) = 0;
   3467 
   3468 	/** Get the current range [0..1] that the headset view blends across the stereo overlapped area in cropped both mode. */
   3469 	virtual void GetHeadsetViewBlendRange( float *pStartPct, float *pEndPct ) = 0;
   3470 };
   3471 
   3472 static const uint32_t k_unHeadsetViewMaxWidth = 3840;
   3473 static const uint32_t k_unHeadsetViewMaxHeight = 2160;
   3474 static const char * const k_pchHeadsetViewOverlayKey = "system.HeadsetView";
   3475 
   3476 static const char * const IVRHeadsetView_Version = "IVRHeadsetView_001";
   3477 
   3478 /** Returns the current IVRHeadsetView pointer or NULL the interface could not be found. */
   3479 VR_INTERFACE vr::IVRHeadsetView *VR_CALLTYPE VRHeadsetView();
   3480 
   3481 } // namespace vr
   3482 
   3483 
   3484 // ivrnotifications.h
   3485 namespace vr
   3486 {
   3487 
   3488 #pragma pack( push, 8 )
   3489 
   3490 // Used for passing graphic data
   3491 struct NotificationBitmap_t
   3492 {
   3493 NotificationBitmap_t()
   3494 	: m_pImageData( nullptr )
   3495 	, m_nWidth( 0 )
   3496 	, m_nHeight( 0 )
   3497 	, m_nBytesPerPixel( 0 )
   3498 {
   3499 }
   3500 
   3501 void *m_pImageData;
   3502 int32_t m_nWidth;
   3503 int32_t m_nHeight;
   3504 int32_t m_nBytesPerPixel;
   3505 };
   3506 
   3507 
   3508 /** Be aware that the notification type is used as 'priority' to pick the next notification */
   3509 enum EVRNotificationType
   3510 {
   3511 /** Transient notifications are automatically hidden after a period of time set by the user. 
   3512 * They are used for things like information and chat messages that do not require user interaction. */
   3513 EVRNotificationType_Transient = 0,
   3514 
   3515 /** Persistent notifications are shown to the user until they are hidden by calling RemoveNotification().
   3516 * They are used for things like phone calls and alarms that require user interaction. */
   3517 EVRNotificationType_Persistent = 1,
   3518 
   3519 /** System notifications are shown no matter what. It is expected, that the ulUserValue is used as ID.
   3520  * If there is already a system notification in the queue with that ID it is not accepted into the queue
   3521  * to prevent spamming with system notification */
   3522 EVRNotificationType_Transient_SystemWithUserValue = 2,
   3523 };
   3524 
   3525 enum EVRNotificationStyle
   3526 {
   3527 /** Creates a notification with minimal external styling. */
   3528 EVRNotificationStyle_None = 0,
   3529 
   3530 /** Used for notifications about overlay-level status. In Steam this is used for events like downloads completing. */
   3531 EVRNotificationStyle_Application = 100,
   3532 
   3533 /** Used for notifications about contacts that are unknown or not available. In Steam this is used for friend invitations and offline friends. */
   3534 EVRNotificationStyle_Contact_Disabled = 200,
   3535 
   3536 /** Used for notifications about contacts that are available but inactive. In Steam this is used for friends that are online but not playing a game. */
   3537 EVRNotificationStyle_Contact_Enabled = 201,
   3538 
   3539 /** Used for notifications about contacts that are available and active. In Steam this is used for friends that are online and currently running a game. */
   3540 EVRNotificationStyle_Contact_Active = 202,
   3541 };
   3542 
   3543 static const uint32_t k_unNotificationTextMaxSize = 256;
   3544 
   3545 typedef uint32_t VRNotificationId;
   3546 
   3547 
   3548 
   3549 #pragma pack( pop )
   3550 
   3551 /** Allows notification sources to interact with the VR system
   3552 This current interface is not yet implemented. Do not use yet. */
   3553 class IVRNotifications
   3554 {
   3555 public:
   3556 /** Create a notification and enqueue it to be shown to the user.
   3557 * An overlay handle is required to create a notification, as otherwise it would be impossible for a user to act on it.
   3558 * To create a two-line notification, use a line break ('\n') to split the text into two lines.
   3559 * The pImage argument may be NULL, in which case the specified overlay's icon will be used instead. */
   3560 virtual EVRNotificationError CreateNotification( VROverlayHandle_t ulOverlayHandle, uint64_t ulUserValue, EVRNotificationType type, const char *pchText, EVRNotificationStyle style, const NotificationBitmap_t *pImage, /* out */ VRNotificationId *pNotificationId ) = 0;
   3561 
   3562 /** Destroy a notification, hiding it first if it currently shown to the user. */
   3563 virtual EVRNotificationError RemoveNotification( VRNotificationId notificationId ) = 0;
   3564 
   3565 };
   3566 
   3567 static const char * const IVRNotifications_Version = "IVRNotifications_002";
   3568 
   3569 } // namespace vr
   3570 
   3571 
   3572 
   3573 // ivroverlay.h
   3574 namespace vr
   3575 {
   3576 
   3577 /** The maximum length of an overlay key in bytes, counting the terminating null character. */
   3578 static const uint32_t k_unVROverlayMaxKeyLength = 128;
   3579 
   3580 /** The maximum length of an overlay name in bytes, counting the terminating null character. */
   3581 static const uint32_t k_unVROverlayMaxNameLength = 128;
   3582 
   3583 /** The maximum number of overlays that can exist in the system at one time. */
   3584 static const uint32_t k_unMaxOverlayCount = 128;
   3585 
   3586 /** The maximum number of overlay intersection mask primitives per overlay */
   3587 static const uint32_t k_unMaxOverlayIntersectionMaskPrimitivesCount = 32;
   3588 
   3589 /** Types of input supported by VR Overlays */
   3590 enum VROverlayInputMethod
   3591 {
   3592 	VROverlayInputMethod_None		= 0, // No input events will be generated automatically for this overlay
   3593 	VROverlayInputMethod_Mouse		= 1, // Tracked controllers will get mouse events automatically
   3594 	// VROverlayInputMethod_DualAnalog = 2, // No longer supported
   3595 };
   3596 
   3597 /** Allows the caller to figure out which overlay transform getter to call. */
   3598 enum VROverlayTransformType
   3599 {
   3600 	VROverlayTransform_Invalid					= -1,
   3601 	VROverlayTransform_Absolute					= 0,
   3602 	VROverlayTransform_TrackedDeviceRelative	= 1,
   3603 	VROverlayTransform_SystemOverlay			= 2,
   3604 	VROverlayTransform_TrackedComponent 		= 3,
   3605 	VROverlayTransform_Cursor					= 4,
   3606 	VROverlayTransform_DashboardTab				= 5,
   3607 	VROverlayTransform_DashboardThumb			= 6,
   3608 	VROverlayTransform_Mountable				= 7,
   3609 };
   3610 
   3611 /** Overlay control settings */
   3612 enum VROverlayFlags
   3613 {
   3614 	// Set this flag on a dashboard overlay to prevent a tab from showing up for that overlay
   3615 	VROverlayFlags_NoDashboardTab = 1 << 3,
   3616 
   3617 	// When this is set the overlay will receive VREvent_ScrollDiscrete events like a mouse wheel. 
   3618 	// Requires mouse input mode.
   3619 	VROverlayFlags_SendVRDiscreteScrollEvents = 1 << 6,
   3620 
   3621 	// Indicates that the overlay would like to receive
   3622 	VROverlayFlags_SendVRTouchpadEvents = 1 << 7,
   3623 
   3624 	// If set this will render a vertical scroll wheel on the primary controller, 
   3625 	//  only needed if not using VROverlayFlags_SendVRScrollEvents but you still want to represent a scroll wheel
   3626 	VROverlayFlags_ShowTouchPadScrollWheel = 1 << 8,
   3627 
   3628 	// If this is set ownership and render access to the overlay are transferred 
   3629 	// to the new scene process on a call to IVRApplications::LaunchInternalProcess
   3630 	VROverlayFlags_TransferOwnershipToInternalProcess = 1 << 9,
   3631 
   3632 	// If set, renders 50% of the texture in each eye, side by side
   3633 	VROverlayFlags_SideBySide_Parallel = 1 << 10, // Texture is left/right
   3634 	VROverlayFlags_SideBySide_Crossed = 1 << 11, // Texture is crossed and right/left
   3635 
   3636 	VROverlayFlags_Panorama = 1 << 12, // Texture is a panorama
   3637 	VROverlayFlags_StereoPanorama = 1 << 13, // Texture is a stereo panorama
   3638 
   3639 	// If this is set on an overlay owned by the scene application that overlay
   3640 	// will be sorted with the "Other" overlays on top of all other scene overlays
   3641 	VROverlayFlags_SortWithNonSceneOverlays = 1 << 14,
   3642 
   3643 	// If set, the overlay will be shown in the dashboard, otherwise it will be hidden.
   3644 	VROverlayFlags_VisibleInDashboard = 1 << 15,
   3645 
   3646 	// If this is set and the overlay's input method is not none, the system-wide laser mouse
   3647 	// mode will be activated whenever this overlay is visible.
   3648 	VROverlayFlags_MakeOverlaysInteractiveIfVisible = 1 << 16,
   3649 
   3650 	// If this is set the overlay will receive smooth VREvent_ScrollSmooth that emulate trackpad scrolling.
   3651 	// Requires mouse input mode.
   3652 	VROverlayFlags_SendVRSmoothScrollEvents = 1 << 17,
   3653 
   3654 	// If this is set, the overlay texture will be protected content, preventing unauthorized reads.
   3655 	VROverlayFlags_ProtectedContent = 1 << 18,
   3656 
   3657 	// If this is set, the laser mouse splat will not be drawn over this overlay. The overlay will
   3658 	// be responsible for drawing its own "cursor".
   3659 	VROverlayFlags_HideLaserIntersection = 1 << 19,
   3660 
   3661 	// If this is set, clicking away from the overlay will cause it to receive a VREvent_Modal_Cancel event.
   3662 	// This is ignored for dashboard overlays.
   3663 	VROverlayFlags_WantsModalBehavior = 1 << 20,
   3664 
   3665 	// If this is set, alpha composition assumes the texture is pre-multiplied
   3666 	VROverlayFlags_IsPremultiplied = 1 << 21,
   3667 };
   3668 
   3669 enum VRMessageOverlayResponse
   3670 {
   3671 	VRMessageOverlayResponse_ButtonPress_0 = 0,
   3672 	VRMessageOverlayResponse_ButtonPress_1 = 1,
   3673 	VRMessageOverlayResponse_ButtonPress_2 = 2,
   3674 	VRMessageOverlayResponse_ButtonPress_3 = 3,
   3675 	VRMessageOverlayResponse_CouldntFindSystemOverlay = 4,
   3676 	VRMessageOverlayResponse_CouldntFindOrCreateClientOverlay= 5,
   3677 	VRMessageOverlayResponse_ApplicationQuit = 6
   3678 };
   3679 
   3680 struct VROverlayIntersectionParams_t
   3681 {
   3682 	HmdVector3_t vSource;
   3683 	HmdVector3_t vDirection;
   3684 	ETrackingUniverseOrigin eOrigin;
   3685 };
   3686 
   3687 struct VROverlayIntersectionResults_t
   3688 {
   3689 	HmdVector3_t vPoint;
   3690 	HmdVector3_t vNormal;
   3691 	HmdVector2_t vUVs;
   3692 	float fDistance;
   3693 };
   3694 
   3695 // Input modes for the Big Picture gamepad text entry
   3696 enum EGamepadTextInputMode
   3697 {
   3698 	k_EGamepadTextInputModeNormal = 0,
   3699 	k_EGamepadTextInputModePassword = 1,
   3700 	k_EGamepadTextInputModeSubmit = 2,
   3701 };
   3702 
   3703 // Controls number of allowed lines for the Big Picture gamepad text entry
   3704 enum EGamepadTextInputLineMode
   3705 {
   3706 	k_EGamepadTextInputLineModeSingleLine = 0,
   3707 	k_EGamepadTextInputLineModeMultipleLines = 1
   3708 };
   3709 
   3710 enum EVROverlayIntersectionMaskPrimitiveType
   3711 {
   3712 	OverlayIntersectionPrimitiveType_Rectangle,
   3713 	OverlayIntersectionPrimitiveType_Circle,
   3714 };
   3715 
   3716 struct IntersectionMaskRectangle_t
   3717 {
   3718 	float m_flTopLeftX;
   3719 	float m_flTopLeftY;
   3720 	float m_flWidth;
   3721 	float m_flHeight;
   3722 };
   3723 
   3724 struct IntersectionMaskCircle_t
   3725 {
   3726 	float m_flCenterX;
   3727 	float m_flCenterY;
   3728 	float m_flRadius;
   3729 };
   3730 
   3731 /** NOTE!!! If you change this you MUST manually update openvr_interop.cs.py and openvr_api_flat.h.py */
   3732 typedef union
   3733 {
   3734 	IntersectionMaskRectangle_t m_Rectangle;
   3735 	IntersectionMaskCircle_t m_Circle;
   3736 } VROverlayIntersectionMaskPrimitive_Data_t;
   3737 
   3738 struct VROverlayIntersectionMaskPrimitive_t
   3739 {
   3740 	EVROverlayIntersectionMaskPrimitiveType m_nPrimitiveType;
   3741 	VROverlayIntersectionMaskPrimitive_Data_t m_Primitive;
   3742 };
   3743 
   3744 enum EKeyboardFlags
   3745 {
   3746 	KeyboardFlag_Minimal		= 1 << 0, // makes the keyboard send key events immediately instead of accumulating a buffer
   3747 	KeyboardFlag_Modal			= 2 << 0, // makes the keyboard take all focus and dismiss when clicking off the panel
   3748 };
   3749 
   3750 
   3751 class IVROverlay
   3752 {
   3753 public:
   3754 
   3755 	// ---------------------------------------------
   3756 	// Overlay management methods
   3757 	// ---------------------------------------------
   3758 
   3759 	/** Finds an existing overlay with the specified key. */
   3760 	virtual EVROverlayError FindOverlay( const char *pchOverlayKey, VROverlayHandle_t * pOverlayHandle ) = 0;
   3761 
   3762 	/** Creates a new named overlay. All overlays start hidden and with default settings. */
   3763 	virtual EVROverlayError CreateOverlay( const char *pchOverlayKey, const char *pchOverlayName, VROverlayHandle_t * pOverlayHandle ) = 0;
   3764 
   3765 	/** Destroys the specified overlay. When an application calls VR_Shutdown all overlays created by that app are
   3766 	* automatically destroyed. */
   3767 	virtual EVROverlayError DestroyOverlay( VROverlayHandle_t ulOverlayHandle ) = 0;
   3768 
   3769 	/** Fills the provided buffer with the string key of the overlay. Returns the size of buffer required to store the key, including
   3770 	* the terminating null character. k_unVROverlayMaxKeyLength will be enough bytes to fit the string. */
   3771 	virtual uint32_t GetOverlayKey( VROverlayHandle_t ulOverlayHandle, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize, EVROverlayError *pError = 0L ) = 0;
   3772 
   3773 	/** Fills the provided buffer with the friendly name of the overlay. Returns the size of buffer required to store the key, including
   3774 	* the terminating null character. k_unVROverlayMaxNameLength will be enough bytes to fit the string. */
   3775 	virtual uint32_t GetOverlayName( VROverlayHandle_t ulOverlayHandle, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize, EVROverlayError *pError = 0L ) = 0;
   3776 
   3777 	/** set the name to use for this overlay */
   3778 	virtual EVROverlayError SetOverlayName( VROverlayHandle_t ulOverlayHandle, const char *pchName ) = 0;
   3779 
   3780 	/** Gets the raw image data from an overlay. Overlay image data is always returned as RGBA data, 4 bytes per pixel. If the buffer is not large enough, width and height 
   3781 	* will be set and VROverlayError_ArrayTooSmall is returned. */
   3782 	virtual EVROverlayError GetOverlayImageData( VROverlayHandle_t ulOverlayHandle, void *pvBuffer, uint32_t unBufferSize, uint32_t *punWidth, uint32_t *punHeight ) = 0;
   3783 
   3784 	/** returns a string that corresponds with the specified overlay error. The string will be the name 
   3785 	* of the error enum value for all valid error codes */
   3786 	virtual const char *GetOverlayErrorNameFromEnum( EVROverlayError error ) = 0;
   3787 
   3788 	// ---------------------------------------------
   3789 	// Overlay rendering methods
   3790 	// ---------------------------------------------
   3791 
   3792 	/** Sets the pid that is allowed to render to this overlay (the creator pid is always allow to render),
   3793 	*	by default this is the pid of the process that made the overlay */
   3794 	virtual EVROverlayError SetOverlayRenderingPid( VROverlayHandle_t ulOverlayHandle, uint32_t unPID ) = 0;
   3795 
   3796 	/** Gets the pid that is allowed to render to this overlay */
   3797 	virtual uint32_t GetOverlayRenderingPid( VROverlayHandle_t ulOverlayHandle ) = 0;
   3798 
   3799 	/** Specify flag setting for a given overlay */
   3800 	virtual EVROverlayError SetOverlayFlag( VROverlayHandle_t ulOverlayHandle, VROverlayFlags eOverlayFlag, bool bEnabled ) = 0;
   3801 
   3802 	/** Sets flag setting for a given overlay */
   3803 	virtual EVROverlayError GetOverlayFlag( VROverlayHandle_t ulOverlayHandle, VROverlayFlags eOverlayFlag, bool *pbEnabled ) = 0;
   3804 
   3805 	/** Gets all the flags for a given overlay */
   3806 	virtual EVROverlayError GetOverlayFlags( VROverlayHandle_t ulOverlayHandle, uint32_t *pFlags ) = 0;
   3807 
   3808 	/** Sets the color tint of the overlay quad. Use 0.0 to 1.0 per channel. */
   3809 	virtual EVROverlayError SetOverlayColor( VROverlayHandle_t ulOverlayHandle, float fRed, float fGreen, float fBlue ) = 0;
   3810 
   3811 	/** Gets the color tint of the overlay quad. */
   3812 	virtual EVROverlayError GetOverlayColor( VROverlayHandle_t ulOverlayHandle, float *pfRed, float *pfGreen, float *pfBlue ) = 0;
   3813 
   3814 	/** Sets the alpha of the overlay quad. Use 1.0 for 100 percent opacity to 0.0 for 0 percent opacity. */
   3815 	virtual EVROverlayError SetOverlayAlpha( VROverlayHandle_t ulOverlayHandle, float fAlpha ) = 0;
   3816 
   3817 	/** Gets the alpha of the overlay quad. By default overlays are rendering at 100 percent alpha (1.0). */
   3818 	virtual EVROverlayError GetOverlayAlpha( VROverlayHandle_t ulOverlayHandle, float *pfAlpha ) = 0;
   3819 
   3820 	/** Sets the aspect ratio of the texels in the overlay. 1.0 means the texels are square. 2.0 means the texels
   3821 	* are twice as wide as they are tall. Defaults to 1.0. */
   3822 	virtual EVROverlayError SetOverlayTexelAspect( VROverlayHandle_t ulOverlayHandle, float fTexelAspect ) = 0;
   3823 
   3824 	/** Gets the aspect ratio of the texels in the overlay. Defaults to 1.0 */
   3825 	virtual EVROverlayError GetOverlayTexelAspect( VROverlayHandle_t ulOverlayHandle, float *pfTexelAspect ) = 0;
   3826 
   3827 	/** Sets the rendering sort order for the overlay. Overlays are rendered this order:
   3828 	*      Overlays owned by the scene application
   3829 	*      Overlays owned by some other application
   3830 	*
   3831 	*	Within a category overlays are rendered lowest sort order to highest sort order. Overlays with the same 
   3832 	*	sort order are rendered back to front base on distance from the HMD.
   3833 	*
   3834 	*	Sort order defaults to 0. */
   3835 	virtual EVROverlayError SetOverlaySortOrder( VROverlayHandle_t ulOverlayHandle, uint32_t unSortOrder ) = 0;
   3836 
   3837 	/** Gets the sort order of the overlay. See SetOverlaySortOrder for how this works. */
   3838 	virtual EVROverlayError GetOverlaySortOrder( VROverlayHandle_t ulOverlayHandle, uint32_t *punSortOrder ) = 0;
   3839 
   3840 	/** Sets the width of the overlay quad in meters. By default overlays are rendered on a quad that is 1 meter across */
   3841 	virtual EVROverlayError SetOverlayWidthInMeters( VROverlayHandle_t ulOverlayHandle, float fWidthInMeters ) = 0;
   3842 
   3843 	/** Returns the width of the overlay quad in meters. By default overlays are rendered on a quad that is 1 meter across */
   3844 	virtual EVROverlayError GetOverlayWidthInMeters( VROverlayHandle_t ulOverlayHandle, float *pfWidthInMeters ) = 0;
   3845 
   3846 	/** Use to draw overlay as a curved surface. Curvature is a percentage from (0..1] where 1 is a fully closed cylinder.
   3847 	* For a specific radius, curvature can be computed as: overlay.width / (2 PI r). */
   3848 	virtual EVROverlayError SetOverlayCurvature( VROverlayHandle_t ulOverlayHandle, float fCurvature ) = 0;
   3849 
   3850 	/** Returns the curvature of the overlay as a percentage from (0..1] where 1 is a fully closed cylinder. */
   3851 	virtual EVROverlayError GetOverlayCurvature( VROverlayHandle_t ulOverlayHandle, float *pfCurvature ) = 0;
   3852 
   3853 	/** Sets the colorspace the overlay texture's data is in.  Defaults to 'auto'.
   3854 	* If the texture needs to be resolved, you should call SetOverlayTexture with the appropriate colorspace instead. */
   3855 	virtual EVROverlayError SetOverlayTextureColorSpace( VROverlayHandle_t ulOverlayHandle, EColorSpace eTextureColorSpace ) = 0;
   3856 
   3857 	/** Gets the overlay's current colorspace setting. */
   3858 	virtual EVROverlayError GetOverlayTextureColorSpace( VROverlayHandle_t ulOverlayHandle, EColorSpace *peTextureColorSpace ) = 0;
   3859 
   3860 	/** Sets the part of the texture to use for the overlay. UV Min is the upper left corner and UV Max is the lower right corner. */
   3861 	virtual EVROverlayError SetOverlayTextureBounds( VROverlayHandle_t ulOverlayHandle, const VRTextureBounds_t *pOverlayTextureBounds ) = 0;
   3862 
   3863 	/** Gets the part of the texture to use for the overlay. UV Min is the upper left corner and UV Max is the lower right corner. */
   3864 	virtual EVROverlayError GetOverlayTextureBounds( VROverlayHandle_t ulOverlayHandle, VRTextureBounds_t *pOverlayTextureBounds ) = 0;
   3865 
   3866 	/** Returns the transform type of this overlay. */
   3867 	virtual EVROverlayError GetOverlayTransformType( VROverlayHandle_t ulOverlayHandle, VROverlayTransformType *peTransformType ) = 0;
   3868 
   3869 	/** Sets the transform to absolute tracking origin. */
   3870 	virtual EVROverlayError SetOverlayTransformAbsolute( VROverlayHandle_t ulOverlayHandle, ETrackingUniverseOrigin eTrackingOrigin, const HmdMatrix34_t *pmatTrackingOriginToOverlayTransform ) = 0;
   3871 
   3872 	/** Gets the transform if it is absolute. Returns an error if the transform is some other type. */
   3873 	virtual EVROverlayError GetOverlayTransformAbsolute( VROverlayHandle_t ulOverlayHandle, ETrackingUniverseOrigin *peTrackingOrigin, HmdMatrix34_t *pmatTrackingOriginToOverlayTransform ) = 0;
   3874 
   3875 	/** Sets the transform to relative to the transform of the specified tracked device. */
   3876 	virtual EVROverlayError SetOverlayTransformTrackedDeviceRelative( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t unTrackedDevice, const HmdMatrix34_t *pmatTrackedDeviceToOverlayTransform ) = 0;
   3877 
   3878 	/** Gets the transform if it is relative to a tracked device. Returns an error if the transform is some other type. */
   3879 	virtual EVROverlayError GetOverlayTransformTrackedDeviceRelative( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t *punTrackedDevice, HmdMatrix34_t *pmatTrackedDeviceToOverlayTransform ) = 0;
   3880 
   3881 	/** Sets the transform to draw the overlay on a rendermodel component mesh instead of a quad. This will only draw when the system is
   3882 	* drawing the device. Overlays with this transform type cannot receive mouse events. */
   3883 	virtual EVROverlayError SetOverlayTransformTrackedDeviceComponent( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t unDeviceIndex, const char *pchComponentName ) = 0;
   3884 
   3885 	/** Gets the transform information when the overlay is rendering on a component. */
   3886 	virtual EVROverlayError GetOverlayTransformTrackedDeviceComponent( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t *punDeviceIndex, VR_OUT_STRING() char *pchComponentName, uint32_t unComponentNameSize ) = 0;
   3887 
   3888 	/** Gets the transform if it is relative to another overlay. Returns an error if the transform is some other type. */
   3889 	virtual vr::EVROverlayError GetOverlayTransformOverlayRelative( VROverlayHandle_t ulOverlayHandle, VROverlayHandle_t *ulOverlayHandleParent, HmdMatrix34_t *pmatParentOverlayToOverlayTransform ) = 0;
   3890 	
   3891 	/** Sets the transform to relative to the transform of the specified overlay. This overlays visibility will also track the parents visibility */
   3892 	virtual vr::EVROverlayError SetOverlayTransformOverlayRelative( VROverlayHandle_t ulOverlayHandle, VROverlayHandle_t ulOverlayHandleParent, const HmdMatrix34_t *pmatParentOverlayToOverlayTransform ) = 0;
   3893 
   3894 	/** Sets the hotspot for the specified overlay when that overlay is used as a cursor. These are in texture space with 0,0 in the upper left corner of
   3895 	* the texture and 1,1 in the lower right corner of the texture. */
   3896 	virtual EVROverlayError SetOverlayTransformCursor( VROverlayHandle_t ulCursorOverlayHandle, const HmdVector2_t *pvHotspot ) = 0;
   3897 
   3898 	/** Gets cursor hotspot/transform for the specified overlay */
   3899 	virtual vr::EVROverlayError GetOverlayTransformCursor( VROverlayHandle_t ulOverlayHandle, HmdVector2_t *pvHotspot ) = 0;
   3900 
   3901 	/** Shows the VR overlay.  For dashboard overlays, only the Dashboard Manager is allowed to call this. */
   3902 	virtual EVROverlayError ShowOverlay( VROverlayHandle_t ulOverlayHandle ) = 0;
   3903 
   3904 	/** Hides the VR overlay.  For dashboard overlays, only the Dashboard Manager is allowed to call this. */
   3905 	virtual EVROverlayError HideOverlay( VROverlayHandle_t ulOverlayHandle ) = 0;
   3906 
   3907 	/** Returns true if the overlay is visible. */
   3908 	virtual bool IsOverlayVisible( VROverlayHandle_t ulOverlayHandle ) = 0;
   3909 
   3910 	/** Get the transform in 3d space associated with a specific 2d point in the overlay's coordinate space (where 0,0 is the lower left). -Z points out of the overlay */
   3911 	virtual EVROverlayError GetTransformForOverlayCoordinates( VROverlayHandle_t ulOverlayHandle, ETrackingUniverseOrigin eTrackingOrigin, HmdVector2_t coordinatesInOverlay, HmdMatrix34_t *pmatTransform ) = 0;
   3912 
   3913 	// ---------------------------------------------
   3914 	// Overlay input methods
   3915 	// ---------------------------------------------
   3916 
   3917 	/** Returns true and fills the event with the next event on the overlay's event queue, if there is one. 
   3918 	* If there are no events this method returns false. uncbVREvent should be the size in bytes of the VREvent_t struct */
   3919 	virtual bool PollNextOverlayEvent( VROverlayHandle_t ulOverlayHandle, VREvent_t *pEvent, uint32_t uncbVREvent ) = 0;
   3920 
   3921 	/** Returns the current input settings for the specified overlay. */
   3922 	virtual EVROverlayError GetOverlayInputMethod( VROverlayHandle_t ulOverlayHandle, VROverlayInputMethod *peInputMethod ) = 0;
   3923 
   3924 	/** Sets the input settings for the specified overlay. */
   3925 	virtual EVROverlayError SetOverlayInputMethod( VROverlayHandle_t ulOverlayHandle, VROverlayInputMethod eInputMethod ) = 0;
   3926 
   3927 	/** Gets the mouse scaling factor that is used for mouse events. The actual texture may be a different size, but this is
   3928 	* typically the size of the underlying UI in pixels. */
   3929 	virtual EVROverlayError GetOverlayMouseScale( VROverlayHandle_t ulOverlayHandle, HmdVector2_t *pvecMouseScale ) = 0;
   3930 
   3931 	/** Sets the mouse scaling factor that is used for mouse events. The actual texture may be a different size, but this is
   3932 	* typically the size of the underlying UI in pixels (not in world space). */
   3933 	virtual EVROverlayError SetOverlayMouseScale( VROverlayHandle_t ulOverlayHandle, const HmdVector2_t *pvecMouseScale ) = 0;
   3934 
   3935 	/** Computes the overlay-space pixel coordinates of where the ray intersects the overlay with the
   3936 	* specified settings. Returns false if there is no intersection. */
   3937 	virtual bool ComputeOverlayIntersection( VROverlayHandle_t ulOverlayHandle, const VROverlayIntersectionParams_t *pParams, VROverlayIntersectionResults_t *pResults ) = 0;
   3938 
   3939 	/** Returns true if the specified overlay is the hover target. An overlay is the hover target when it is the last overlay "moused over" 
   3940 	* by the virtual mouse pointer */
   3941 	virtual bool IsHoverTargetOverlay( VROverlayHandle_t ulOverlayHandle ) = 0;
   3942 
   3943 	/** Sets a list of primitives to be used for controller ray intersection
   3944 	* typically the size of the underlying UI in pixels (not in world space). */
   3945 	virtual EVROverlayError SetOverlayIntersectionMask( VROverlayHandle_t ulOverlayHandle, VROverlayIntersectionMaskPrimitive_t *pMaskPrimitives, uint32_t unNumMaskPrimitives, uint32_t unPrimitiveSize = sizeof( VROverlayIntersectionMaskPrimitive_t ) ) = 0;
   3946 
   3947 	/** Triggers a haptic event on the laser mouse controller for the specified overlay */
   3948 	virtual EVROverlayError TriggerLaserMouseHapticVibration( VROverlayHandle_t ulOverlayHandle, float fDurationSeconds, float fFrequency, float fAmplitude ) = 0;
   3949 
   3950 	/** Sets the cursor to use for the specified overlay. This will be drawn instead of the generic blob when the laser mouse is pointed at the specified overlay */
   3951 	virtual EVROverlayError SetOverlayCursor( VROverlayHandle_t ulOverlayHandle, VROverlayHandle_t ulCursorHandle ) = 0;
   3952 
   3953 	/** Sets the override cursor position to use for this overlay in overlay mouse coordinates. This position will be used to draw the cursor
   3954 	* instead of whatever the laser mouse cursor position is. */
   3955 	virtual EVROverlayError SetOverlayCursorPositionOverride( VROverlayHandle_t ulOverlayHandle, const HmdVector2_t *pvCursor ) = 0;
   3956 
   3957 	/** Clears the override cursor position for this overlay */
   3958 	virtual EVROverlayError ClearOverlayCursorPositionOverride( VROverlayHandle_t ulOverlayHandle ) = 0;
   3959 
   3960 	// ---------------------------------------------
   3961 	// Overlay texture methods
   3962 	// ---------------------------------------------
   3963 
   3964 	/** Texture to draw for the overlay. This function can only be called by the overlay's creator or renderer process (see SetOverlayRenderingPid) .
   3965 	*
   3966 	* OpenGL dirty state:
   3967 	*	glBindTexture
   3968 	*/
   3969 	virtual EVROverlayError SetOverlayTexture( VROverlayHandle_t ulOverlayHandle, const Texture_t *pTexture ) = 0;
   3970 
   3971 	/** Use this to tell the overlay system to release the texture set for this overlay. */
   3972 	virtual EVROverlayError ClearOverlayTexture( VROverlayHandle_t ulOverlayHandle ) = 0;
   3973 
   3974 	/** Separate interface for providing the data as a stream of bytes, but there is an upper bound on data 
   3975 	* that can be sent. This function can only be called by the overlay's renderer process. */
   3976 	virtual EVROverlayError SetOverlayRaw( VROverlayHandle_t ulOverlayHandle, void *pvBuffer, uint32_t unWidth, uint32_t unHeight, uint32_t unBytesPerPixel ) = 0;
   3977 
   3978 	/** Separate interface for providing the image through a filename: can be png or jpg, and should not be bigger than 1920x1080.
   3979 	* This function can only be called by the overlay's renderer process */
   3980 	virtual EVROverlayError SetOverlayFromFile( VROverlayHandle_t ulOverlayHandle, const char *pchFilePath ) = 0;
   3981 
   3982 	/** Get the native texture handle/device for an overlay you have created.
   3983 	* On windows this handle will be a ID3D11ShaderResourceView with a ID3D11Texture2D bound.
   3984 	*
   3985 	* The texture will always be sized to match the backing texture you supplied in SetOverlayTexture above.
   3986 	*
   3987 	* You MUST call ReleaseNativeOverlayHandle() with pNativeTextureHandle once you are done with this texture.
   3988 	*
   3989 	* pNativeTextureHandle is an OUTPUT, it will be a pointer to a ID3D11ShaderResourceView *.
   3990 	* pNativeTextureRef is an INPUT and should be a ID3D11Resource *. The device used by pNativeTextureRef will be used to bind pNativeTextureHandle.
   3991 	*/
   3992 	virtual EVROverlayError GetOverlayTexture( VROverlayHandle_t ulOverlayHandle, void **pNativeTextureHandle, void *pNativeTextureRef, uint32_t *pWidth, uint32_t *pHeight, uint32_t *pNativeFormat, ETextureType *pAPIType, EColorSpace *pColorSpace, VRTextureBounds_t *pTextureBounds ) = 0;
   3993 
   3994 	/** Release the pNativeTextureHandle provided from the GetOverlayTexture call, this allows the system to free the underlying GPU resources for this object,
   3995 	* so only do it once you stop rendering this texture.
   3996 	*/
   3997 	virtual EVROverlayError ReleaseNativeOverlayHandle( VROverlayHandle_t ulOverlayHandle, void *pNativeTextureHandle ) = 0;
   3998 
   3999 	/** Get the size of the overlay texture */
   4000 	virtual EVROverlayError GetOverlayTextureSize( VROverlayHandle_t ulOverlayHandle, uint32_t *pWidth, uint32_t *pHeight ) = 0;
   4001 
   4002 	// ----------------------------------------------
   4003 	// Dashboard Overlay Methods
   4004 	// ----------------------------------------------
   4005 
   4006 	/** Creates a dashboard overlay and returns its handle */
   4007 	virtual EVROverlayError CreateDashboardOverlay( const char *pchOverlayKey, const char *pchOverlayFriendlyName, VROverlayHandle_t * pMainHandle, VROverlayHandle_t *pThumbnailHandle ) = 0;
   4008 
   4009 	/** Returns true if the dashboard is visible */
   4010 	virtual bool IsDashboardVisible() = 0;
   4011 
   4012 	/** returns true if the dashboard is visible and the specified overlay is the active system Overlay */
   4013 	virtual bool IsActiveDashboardOverlay( VROverlayHandle_t ulOverlayHandle ) = 0;
   4014 
   4015 	/** Sets the dashboard overlay to only appear when the specified process ID has scene focus */
   4016 	virtual EVROverlayError SetDashboardOverlaySceneProcess( VROverlayHandle_t ulOverlayHandle, uint32_t unProcessId ) = 0;
   4017 
   4018 	/** Gets the process ID that this dashboard overlay requires to have scene focus */
   4019 	virtual EVROverlayError GetDashboardOverlaySceneProcess( VROverlayHandle_t ulOverlayHandle, uint32_t *punProcessId ) = 0;
   4020 
   4021 	/** Shows the dashboard. */
   4022 	virtual void ShowDashboard( const char *pchOverlayToShow ) = 0;
   4023 
   4024 	/** Returns the tracked device that has the laser pointer in the dashboard */
   4025 	virtual vr::TrackedDeviceIndex_t GetPrimaryDashboardDevice() = 0;
   4026 
   4027 	// ---------------------------------------------
   4028 	// Keyboard methods
   4029 	// ---------------------------------------------
   4030 	
   4031 	/** Show the virtual keyboard to accept input. In most cases, you should pass KeyboardFlag_Modal to enable modal overlay 
   4032 	* behavior on the keyboard itself. See EKeyboardFlags for more. */
   4033 	virtual EVROverlayError ShowKeyboard( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, uint32_t unFlags, 
   4034 		const char *pchDescription, uint32_t unCharMax, const char *pchExistingText, uint64_t uUserValue ) = 0;
   4035 
   4036 	/** Show the virtual keyboard to accept input for an overlay. In most cases, you should pass KeyboardFlag_Modal to enable modal 
   4037 	* overlay behavior on the keyboard itself. See EKeyboardFlags for more. */
   4038 	virtual EVROverlayError ShowKeyboardForOverlay( VROverlayHandle_t ulOverlayHandle, EGamepadTextInputMode eInputMode,
   4039 		EGamepadTextInputLineMode eLineInputMode, uint32_t unFlags, const char *pchDescription, uint32_t unCharMax, 
   4040 		const char *pchExistingText, uint64_t uUserValue ) = 0;
   4041 
   4042 	/** Get the text that was entered into the text input **/
   4043 	virtual uint32_t GetKeyboardText( VR_OUT_STRING() char *pchText, uint32_t cchText ) = 0;
   4044 
   4045 	/** Hide the virtual keyboard **/
   4046 	virtual void HideKeyboard() = 0;
   4047 
   4048 	/** Set the position of the keyboard in world space **/
   4049 	virtual void SetKeyboardTransformAbsolute( ETrackingUniverseOrigin eTrackingOrigin, const HmdMatrix34_t *pmatTrackingOriginToKeyboardTransform ) = 0;
   4050 
   4051 	/** Set the position of the keyboard in overlay space by telling it to avoid a rectangle in the overlay. Rectangle coords have (0,0) in the bottom left **/
   4052 	virtual void SetKeyboardPositionForOverlay( VROverlayHandle_t ulOverlayHandle, HmdRect2_t avoidRect ) = 0;
   4053 
   4054 	// ---------------------------------------------
   4055 	// Message box methods
   4056 	// ---------------------------------------------
   4057 
   4058 	/** Show the message overlay. This will block and return you a result. **/
   4059 	virtual VRMessageOverlayResponse ShowMessageOverlay( const char* pchText, const char* pchCaption, const char* pchButton0Text, const char* pchButton1Text = nullptr, const char* pchButton2Text = nullptr, const char* pchButton3Text = nullptr ) = 0;
   4060 
   4061 	/** If the calling process owns the overlay and it's open, this will close it. **/
   4062 	virtual void CloseMessageOverlay() = 0;
   4063 };
   4064 
   4065 static const char * const IVROverlay_Version = "IVROverlay_024";
   4066 
   4067 } // namespace vr
   4068 
   4069 // ivroverlayview.h
   4070 namespace vr
   4071 {
   4072 struct VROverlayView_t
   4073 {
   4074 	VROverlayHandle_t overlayHandle;
   4075 	Texture_t texture;
   4076 	VRTextureBounds_t textureBounds;
   4077 };
   4078 
   4079 enum EDeviceType
   4080 {
   4081 	DeviceType_Invalid           = -1, // Invalid handle
   4082 	DeviceType_DirectX11         = 0, // Handle is an ID3D11Device
   4083 	DeviceType_Vulkan            = 1, // Handle is a pointer to a VRVulkanDevice_t structure
   4084 };
   4085 
   4086 struct VRVulkanDevice_t
   4087 {
   4088 	VkInstance_T *m_pInstance;
   4089 	VkDevice_T *m_pDevice;
   4090 	VkPhysicalDevice_T *m_pPhysicalDevice;
   4091 	VkQueue_T *m_pQueue;
   4092 	uint32_t m_uQueueFamilyIndex;
   4093 };
   4094 
   4095 struct VRNativeDevice_t
   4096 {
   4097 	void *handle; // See EDeviceType definition above
   4098 	EDeviceType eType;
   4099 };
   4100 
   4101 class IVROverlayView
   4102 {
   4103 public:
   4104 	/** Acquire an OverlayView_t from an overlay handle
   4105 	*
   4106 	* The overlay view can be used to sample the contents directly by a native API. The
   4107 	* contents of the OverlayView_t will remain unchanged through the lifetime of the
   4108 	* OverlayView_t.
   4109 	*
   4110 	* The caller acquires read privileges over the OverlayView_t, but should not
   4111 	* write to it.
   4112 	*
   4113 	* AcquireOverlayView() may be called on the same ulOverlayHandle multiple times to
   4114 	* refresh the image contents. In this case the caller is strongly encouraged to re-use
   4115 	* the same pOverlayView for all re-acquisition calls.
   4116 	*
   4117 	* If the producer has not yet queued an image, AcquireOverlayView will return success,
   4118 	* and the Texture_t will have the expected ETextureType. However, the Texture_t->handle
   4119 	* will be nullptr. Once the producer generates the first overlay frame, Texture_t->handle
   4120 	* will become a valid handle.
   4121 	*/
   4122 	virtual EVROverlayError AcquireOverlayView(VROverlayHandle_t ulOverlayHandle, VRNativeDevice_t *pNativeDevice, VROverlayView_t *pOverlayView, uint32_t unOverlayViewSize ) = 0;
   4123 
   4124 	/** Release an acquired OverlayView_t
   4125 	*
   4126 	* Denotes that pOverlayView will no longer require access to the resources it acquired in
   4127 	* all previous calls to AcquireOverlayView().
   4128 	*
   4129 	* All OverlayView_t*'s provided to AcquireOverlayView() as pOverlayViews must be
   4130 	* passed into ReleaseOverlayView() in order for the underlying GPU resources to be freed.
   4131 	*/
   4132 	virtual EVROverlayError ReleaseOverlayView(VROverlayView_t *pOverlayView) = 0;
   4133 
   4134 	/** Posts an overlay event */
   4135 	virtual void PostOverlayEvent(VROverlayHandle_t ulOverlayHandle, const VREvent_t *pvrEvent) = 0;
   4136 
   4137 	/** Determines whether this process is permitted to view an overlay's content. */
   4138 	virtual bool IsViewingPermitted( VROverlayHandle_t ulOverlayHandle ) = 0;
   4139 
   4140 };
   4141 
   4142 static const char * const IVROverlayView_Version = "IVROverlayView_003";
   4143 
   4144 }
   4145 
   4146 // ivrrendermodels.h
   4147 namespace vr
   4148 {
   4149 
   4150 static const char * const k_pch_Controller_Component_GDC2015 = "gdc2015";   // Canonical coordinate system of the gdc 2015 wired controller, provided for backwards compatibility
   4151 static const char * const k_pch_Controller_Component_Base = "base";         // For controllers with an unambiguous 'base'.
   4152 static const char * const k_pch_Controller_Component_Tip = "tip";           // For controllers with an unambiguous 'tip' (used for 'laser-pointing')
   4153 static const char * const k_pch_Controller_Component_HandGrip = "handgrip"; // Neutral, ambidextrous hand-pose when holding controller. On plane between neutrally posed index finger and thumb
   4154 static const char * const k_pch_Controller_Component_Status = "status";		// 1:1 aspect ratio status area, with canonical [0,1] uv mapping
   4155 
   4156 #pragma pack( push, 8 )
   4157 
   4158 /** Errors that can occur with the VR compositor */
   4159 enum EVRRenderModelError
   4160 {
   4161 VRRenderModelError_None = 0,
   4162 VRRenderModelError_Loading = 100,
   4163 VRRenderModelError_NotSupported = 200,
   4164 VRRenderModelError_InvalidArg = 300,
   4165 VRRenderModelError_InvalidModel = 301,
   4166 VRRenderModelError_NoShapes = 302,
   4167 VRRenderModelError_MultipleShapes = 303,
   4168 VRRenderModelError_TooManyVertices = 304,
   4169 VRRenderModelError_MultipleTextures = 305,
   4170 VRRenderModelError_BufferTooSmall = 306,
   4171 VRRenderModelError_NotEnoughNormals = 307,
   4172 VRRenderModelError_NotEnoughTexCoords = 308,
   4173 
   4174 VRRenderModelError_InvalidTexture = 400,
   4175 };
   4176 
   4177 enum EVRRenderModelTextureFormat
   4178 {
   4179 VRRenderModelTextureFormat_RGBA8_SRGB = 0, // RGBA with 8 bits per channel per pixel. Data size is width * height * 4ub
   4180 VRRenderModelTextureFormat_BC2,
   4181 VRRenderModelTextureFormat_BC4,
   4182 VRRenderModelTextureFormat_BC7,
   4183 VRRenderModelTextureFormat_BC7_SRGB
   4184 };
   4185 
   4186 /** A single vertex in a render model */
   4187 struct RenderModel_Vertex_t
   4188 {
   4189 HmdVector3_t vPosition;		// position in meters in device space
   4190 HmdVector3_t vNormal;
   4191 float rfTextureCoord[2];
   4192 };
   4193 
   4194 /** A texture map for use on a render model */
   4195 #if defined(__linux__) || defined(__APPLE__) 
   4196 // This structure was originally defined mis-packed on Linux, preserved for 
   4197 // compatibility. 
   4198 #pragma pack( push, 4 )
   4199 #endif
   4200 
   4201 struct RenderModel_TextureMap_t
   4202 {
   4203 uint16_t unWidth, unHeight; // width and height of the texture map in pixels
   4204 const uint8_t *rubTextureMapData;	// Map texture data.
   4205 EVRRenderModelTextureFormat format; // Refer to EVRRenderModelTextureFormat
   4206 };
   4207 #if defined(__linux__) || defined(__APPLE__) 
   4208 #pragma pack( pop )
   4209 #endif
   4210 
   4211 /**  Session unique texture identifier. Rendermodels which share the same texture will have the same id.
   4212 IDs <0 denote the texture is not present */
   4213 
   4214 typedef int32_t TextureID_t;
   4215 
   4216 const TextureID_t INVALID_TEXTURE_ID = -1;
   4217 
   4218 #if defined(__linux__) || defined(__APPLE__) 
   4219 // This structure was originally defined mis-packed on Linux, preserved for 
   4220 // compatibility. 
   4221 #pragma pack( push, 4 )
   4222 #endif
   4223 
   4224 struct RenderModel_t
   4225 {
   4226 const RenderModel_Vertex_t *rVertexData;	// Vertex data for the mesh
   4227 uint32_t unVertexCount;						// Number of vertices in the vertex data
   4228 const uint16_t *rIndexData;					// Indices into the vertex data for each triangle
   4229 uint32_t unTriangleCount;					// Number of triangles in the mesh. Index count is 3 * TriangleCount
   4230 TextureID_t diffuseTextureId;				// Session unique texture identifier. Rendermodels which share the same texture will have the same id. <0 == texture not present
   4231 };
   4232 #if defined(__linux__) || defined(__APPLE__) 
   4233 #pragma pack( pop )
   4234 #endif
   4235 
   4236 
   4237 struct RenderModel_ControllerMode_State_t
   4238 {
   4239 bool bScrollWheelVisible; // is this controller currently set to be in a scroll wheel mode
   4240 };
   4241 
   4242 #pragma pack( pop )
   4243 
   4244 class IVRRenderModels
   4245 {
   4246 public:
   4247 
   4248 /** Loads and returns a render model for use in the application. pchRenderModelName should be a render model name
   4249 * from the Prop_RenderModelName_String property or an absolute path name to a render model on disk. 
   4250 *
   4251 * The resulting render model is valid until VR_Shutdown() is called or until FreeRenderModel() is called. When the 
   4252 * application is finished with the render model it should call FreeRenderModel() to free the memory associated
   4253 * with the model.
   4254 *
   4255 * The method returns VRRenderModelError_Loading while the render model is still being loaded.
   4256 * The method returns VRRenderModelError_None once loaded successfully, otherwise will return an error. */
   4257 virtual EVRRenderModelError LoadRenderModel_Async( const char *pchRenderModelName, RenderModel_t **ppRenderModel ) = 0;
   4258 
   4259 /** Frees a previously returned render model
   4260 *   It is safe to call this on a null ptr. */
   4261 virtual void FreeRenderModel( RenderModel_t *pRenderModel ) = 0;
   4262 
   4263 /** Loads and returns a texture for use in the application. */
   4264 virtual EVRRenderModelError LoadTexture_Async( TextureID_t textureId, RenderModel_TextureMap_t **ppTexture ) = 0;
   4265 
   4266 /** Frees a previously returned texture
   4267 *   It is safe to call this on a null ptr. */
   4268 virtual void FreeTexture( RenderModel_TextureMap_t *pTexture ) = 0;
   4269 
   4270 /** Creates a D3D11 texture and loads data into it. */
   4271 virtual EVRRenderModelError LoadTextureD3D11_Async( TextureID_t textureId, void *pD3D11Device, void **ppD3D11Texture2D ) = 0;
   4272 
   4273 /** Helper function to copy the bits into an existing texture. */
   4274 virtual EVRRenderModelError LoadIntoTextureD3D11_Async( TextureID_t textureId, void *pDstTexture ) = 0;
   4275 
   4276 /** Use this to free textures created with LoadTextureD3D11_Async instead of calling Release on them. */
   4277 virtual void FreeTextureD3D11( void *pD3D11Texture2D ) = 0;
   4278 
   4279 /** Use this to get the names of available render models.  Index does not correlate to a tracked device index, but
   4280 * is only used for iterating over all available render models.  If the index is out of range, this function will return 0.
   4281 * Otherwise, it will return the size of the buffer required for the name. */
   4282 virtual uint32_t GetRenderModelName( uint32_t unRenderModelIndex, VR_OUT_STRING() char *pchRenderModelName, uint32_t unRenderModelNameLen ) = 0;
   4283 
   4284 /** Returns the number of available render models. */
   4285 virtual uint32_t GetRenderModelCount() = 0;
   4286 
   4287 
   4288 /** Returns the number of components of the specified render model.
   4289 *  Components are useful when client application wish to draw, label, or otherwise interact with components of tracked objects.
   4290 *  Examples controller components:
   4291 *   renderable things such as triggers, buttons
   4292 *   non-renderable things which include coordinate systems such as 'tip', 'base', a neutral controller agnostic hand-pose
   4293 *   If all controller components are enumerated and rendered, it will be equivalent to drawing the traditional render model
   4294 *   Returns 0 if components not supported, >0 otherwise */
   4295 virtual uint32_t GetComponentCount( const char *pchRenderModelName ) = 0;
   4296 
   4297 /** Use this to get the names of available components.  Index does not correlate to a tracked device index, but
   4298 * is only used for iterating over all available components.  If the index is out of range, this function will return 0.
   4299 * Otherwise, it will return the size of the buffer required for the name. */
   4300 virtual uint32_t GetComponentName( const char *pchRenderModelName, uint32_t unComponentIndex, VR_OUT_STRING( ) char *pchComponentName, uint32_t unComponentNameLen ) = 0;
   4301 
   4302 /** Get the button mask for all buttons associated with this component
   4303 *   If no buttons (or axes) are associated with this component, return 0
   4304 *   Note: multiple components may be associated with the same button. Ex: two grip buttons on a single controller.
   4305 *   Note: A single component may be associated with multiple buttons. Ex: A trackpad which also provides "D-pad" functionality */
   4306 virtual uint64_t GetComponentButtonMask( const char *pchRenderModelName, const char *pchComponentName ) = 0;
   4307 
   4308 /** Use this to get the render model name for the specified rendermode/component combination, to be passed to LoadRenderModel.
   4309 * If the component name is out of range, this function will return 0.
   4310 * Otherwise, it will return the size of the buffer required for the name. */
   4311 virtual uint32_t GetComponentRenderModelName( const char *pchRenderModelName, const char *pchComponentName, VR_OUT_STRING( ) char *pchComponentRenderModelName, uint32_t unComponentRenderModelNameLen ) = 0;
   4312 
   4313 /** Use this to query information about the component, as a function of the controller state.
   4314 *
   4315 * For dynamic controller components (ex: trigger) values will reflect component motions
   4316 * For static components this will return a consistent value independent of the VRControllerState_t
   4317 *
   4318 * If the pchRenderModelName or pchComponentName is invalid, this will return false (and transforms will be set to identity).
   4319 * Otherwise, return true
   4320 * Note: For dynamic objects, visibility may be dynamic. (I.e., true/false will be returned based on controller state and controller mode state ) */
   4321 virtual bool GetComponentStateForDevicePath( const char *pchRenderModelName, const char *pchComponentName, vr::VRInputValueHandle_t devicePath, const vr::RenderModel_ControllerMode_State_t *pState, vr::RenderModel_ComponentState_t *pComponentState ) = 0;
   4322 
   4323 /** This version of GetComponentState takes a controller state block instead of an action origin. This function is deprecated. You should use the new input system and GetComponentStateForDevicePath instead. */
   4324 virtual bool GetComponentState( const char *pchRenderModelName, const char *pchComponentName, const vr::VRControllerState_t *pControllerState, const RenderModel_ControllerMode_State_t *pState, RenderModel_ComponentState_t *pComponentState ) = 0;
   4325 
   4326 /** Returns true if the render model has a component with the specified name */
   4327 virtual bool RenderModelHasComponent( const char *pchRenderModelName, const char *pchComponentName ) = 0;
   4328 
   4329 /** Returns the URL of the thumbnail image for this rendermodel */
   4330 virtual uint32_t GetRenderModelThumbnailURL( const char *pchRenderModelName, VR_OUT_STRING() char *pchThumbnailURL, uint32_t unThumbnailURLLen, vr::EVRRenderModelError *peError ) = 0;
   4331 
   4332 /** Provides a render model path that will load the unskinned model if the model name provided has been replace by the user. If the model
   4333 * hasn't been replaced the path value will still be a valid path to load the model. Pass this to LoadRenderModel_Async, etc. to load the
   4334 * model. */
   4335 virtual uint32_t GetRenderModelOriginalPath( const char *pchRenderModelName, VR_OUT_STRING() char *pchOriginalPath, uint32_t unOriginalPathLen, vr::EVRRenderModelError *peError ) = 0;
   4336 
   4337 /** Returns a string for a render model error */
   4338 virtual const char *GetRenderModelErrorNameFromEnum( vr::EVRRenderModelError error ) = 0;
   4339 };
   4340 
   4341 static const char * const IVRRenderModels_Version = "IVRRenderModels_006";
   4342 
   4343 }
   4344 
   4345 
   4346 // ivrextendeddisplay.h
   4347 namespace vr
   4348 {
   4349 
   4350 /** NOTE: Use of this interface is not recommended in production applications. It will not work for displays which use
   4351 * direct-to-display mode. Creating our own window is also incompatible with the VR compositor and is not available when the compositor is running. */
   4352 class IVRExtendedDisplay
   4353 {
   4354 public:
   4355 
   4356 	/** Size and position that the window needs to be on the VR display. */
   4357 	virtual void GetWindowBounds( int32_t *pnX, int32_t *pnY, uint32_t *pnWidth, uint32_t *pnHeight ) = 0;
   4358 
   4359 	/** Gets the viewport in the frame buffer to draw the output of the distortion into */
   4360 	virtual void GetEyeOutputViewport( EVREye eEye, uint32_t *pnX, uint32_t *pnY, uint32_t *pnWidth, uint32_t *pnHeight ) = 0;
   4361 
   4362 	/** [D3D10/11 Only]
   4363 	* Returns the adapter index and output index that the user should pass into EnumAdapters and EnumOutputs
   4364 	* to create the device and swap chain in DX10 and DX11. If an error occurs both indices will be set to -1.
   4365 	*/
   4366 	virtual void GetDXGIOutputInfo( int32_t *pnAdapterIndex, int32_t *pnAdapterOutputIndex ) = 0;
   4367 
   4368 };
   4369 
   4370 static const char * const IVRExtendedDisplay_Version = "IVRExtendedDisplay_001";
   4371 
   4372 }
   4373 
   4374 
   4375 // ivrtrackedcamera.h
   4376 namespace vr
   4377 {
   4378 
   4379 class IVRTrackedCamera
   4380 {
   4381 public:
   4382 /** Returns a string for an error */
   4383 virtual const char *GetCameraErrorNameFromEnum( vr::EVRTrackedCameraError eCameraError ) = 0;
   4384 
   4385 /** For convenience, same as tracked property request Prop_HasCamera_Bool */
   4386 virtual vr::EVRTrackedCameraError HasCamera( vr::TrackedDeviceIndex_t nDeviceIndex, bool *pHasCamera ) = 0;
   4387 
   4388 /** Gets size of the image frame. */
   4389 virtual vr::EVRTrackedCameraError GetCameraFrameSize( vr::TrackedDeviceIndex_t nDeviceIndex, vr::EVRTrackedCameraFrameType eFrameType, uint32_t *pnWidth, uint32_t *pnHeight, uint32_t *pnFrameBufferSize ) = 0;
   4390 
   4391 virtual vr::EVRTrackedCameraError GetCameraIntrinsics( vr::TrackedDeviceIndex_t nDeviceIndex, uint32_t nCameraIndex, vr::EVRTrackedCameraFrameType eFrameType, vr::HmdVector2_t *pFocalLength, vr::HmdVector2_t *pCenter ) = 0;
   4392 
   4393 virtual vr::EVRTrackedCameraError GetCameraProjection( vr::TrackedDeviceIndex_t nDeviceIndex, uint32_t nCameraIndex, vr::EVRTrackedCameraFrameType eFrameType, float flZNear, float flZFar, vr::HmdMatrix44_t *pProjection ) = 0;
   4394 
   4395 /** Acquiring streaming service permits video streaming for the caller. Releasing hints the system that video services do not need to be maintained for this client.
   4396 * If the camera has not already been activated, a one time spin up may incur some auto exposure as well as initial streaming frame delays.
   4397 * The camera should be considered a global resource accessible for shared consumption but not exclusive to any caller.
   4398 * The camera may go inactive due to lack of active consumers or headset idleness. */
   4399 virtual vr::EVRTrackedCameraError AcquireVideoStreamingService( vr::TrackedDeviceIndex_t nDeviceIndex, vr::TrackedCameraHandle_t *pHandle ) = 0;
   4400 virtual vr::EVRTrackedCameraError ReleaseVideoStreamingService( vr::TrackedCameraHandle_t hTrackedCamera ) = 0;
   4401 
   4402 /** Copies the image frame into a caller's provided buffer. The image data is currently provided as RGBA data, 4 bytes per pixel.
   4403 * A caller can provide null for the framebuffer or frameheader if not desired. Requesting the frame header first, followed by the frame buffer allows
   4404 * the caller to determine if the frame as advanced per the frame header sequence. 
   4405 * If there is no frame available yet, due to initial camera spinup or re-activation, the error will be VRTrackedCameraError_NoFrameAvailable.
   4406 * Ideally a caller should be polling at ~16ms intervals */
   4407 virtual vr::EVRTrackedCameraError GetVideoStreamFrameBuffer( vr::TrackedCameraHandle_t hTrackedCamera, vr::EVRTrackedCameraFrameType eFrameType, void *pFrameBuffer, uint32_t nFrameBufferSize, vr::CameraVideoStreamFrameHeader_t *pFrameHeader, uint32_t nFrameHeaderSize ) = 0;
   4408 
   4409 /** Gets size of the image frame. */
   4410 virtual vr::EVRTrackedCameraError GetVideoStreamTextureSize( vr::TrackedDeviceIndex_t nDeviceIndex, vr::EVRTrackedCameraFrameType eFrameType, vr::VRTextureBounds_t *pTextureBounds, uint32_t *pnWidth, uint32_t *pnHeight ) = 0; 
   4411 
   4412 /** Access a shared D3D11 texture for the specified tracked camera stream.
   4413 * The camera frame type VRTrackedCameraFrameType_Undistorted is not supported directly as a shared texture. It is an interior subregion of the shared texture VRTrackedCameraFrameType_MaximumUndistorted.
   4414 * Instead, use GetVideoStreamTextureSize() with VRTrackedCameraFrameType_Undistorted to determine the proper interior subregion bounds along with GetVideoStreamTextureD3D11() with
   4415 * VRTrackedCameraFrameType_MaximumUndistorted to provide the texture. The VRTrackedCameraFrameType_MaximumUndistorted will yield an image where the invalid regions are decoded
   4416 * by the alpha channel having a zero component. The valid regions all have a non-zero alpha component. The subregion as described by VRTrackedCameraFrameType_Undistorted 
   4417 * guarantees a rectangle where all pixels are valid. */
   4418 virtual vr::EVRTrackedCameraError GetVideoStreamTextureD3D11( vr::TrackedCameraHandle_t hTrackedCamera, vr::EVRTrackedCameraFrameType eFrameType, void *pD3D11DeviceOrResource, void **ppD3D11ShaderResourceView, vr::CameraVideoStreamFrameHeader_t *pFrameHeader, uint32_t nFrameHeaderSize ) = 0;
   4419 
   4420 /** Access a shared GL texture for the specified tracked camera stream */
   4421 virtual vr::EVRTrackedCameraError GetVideoStreamTextureGL( vr::TrackedCameraHandle_t hTrackedCamera, vr::EVRTrackedCameraFrameType eFrameType, vr::glUInt_t *pglTextureId, vr::CameraVideoStreamFrameHeader_t *pFrameHeader, uint32_t nFrameHeaderSize ) = 0;
   4422 virtual vr::EVRTrackedCameraError ReleaseVideoStreamTextureGL( vr::TrackedCameraHandle_t hTrackedCamera, vr::glUInt_t glTextureId ) = 0;
   4423 virtual void SetCameraTrackingSpace( vr::ETrackingUniverseOrigin eUniverse ) = 0;
   4424 virtual vr::ETrackingUniverseOrigin GetCameraTrackingSpace( ) = 0;
   4425 };
   4426 
   4427 static const char * const IVRTrackedCamera_Version = "IVRTrackedCamera_006";
   4428 
   4429 } // namespace vr
   4430 
   4431 
   4432 // ivrscreenshots.h
   4433 namespace vr
   4434 {
   4435 
   4436 /** Errors that can occur with the VR compositor */
   4437 enum EVRScreenshotError
   4438 {
   4439 VRScreenshotError_None							= 0,
   4440 VRScreenshotError_RequestFailed					= 1,
   4441 VRScreenshotError_IncompatibleVersion			= 100,
   4442 VRScreenshotError_NotFound						= 101,
   4443 VRScreenshotError_BufferTooSmall				= 102,
   4444 VRScreenshotError_ScreenshotAlreadyInProgress	= 108,
   4445 };
   4446 
   4447 /** Allows the application to generate screenshots */
   4448 class IVRScreenshots
   4449 {
   4450 public:
   4451 /** Request a screenshot of the requested type.
   4452  *  A request of the VRScreenshotType_Stereo type will always
   4453  *  work. Other types will depend on the underlying application
   4454  *  support.
   4455  *  The first file name is for the preview image and should be a
   4456  *  regular screenshot (ideally from the left eye). The second
   4457  *  is the VR screenshot in the correct format. They should be
   4458  *  in the same aspect ratio.  Formats per type:
   4459  *  VRScreenshotType_Mono: the VR filename is ignored (can be
   4460  *  nullptr), this is a normal flat single shot.
   4461  *  VRScreenshotType_Stereo:  The VR image should be a
   4462  *  side-by-side with the left eye image on the left.
   4463  *  VRScreenshotType_Cubemap: The VR image should be six square
   4464  *  images composited horizontally.
   4465  *  VRScreenshotType_StereoPanorama: above/below with left eye
   4466  *  panorama being the above image.  Image is typically square
   4467  *  with the panorama being 2x horizontal.
   4468  *  
   4469  *  Note that the VR dashboard will call this function when
   4470  *  the user presses the screenshot binding (currently System
   4471  *  Button + Trigger).  If Steam is running, the destination
   4472  *  file names will be in %TEMP% and will be copied into
   4473  *  Steam's screenshot library for the running application
   4474  *  once SubmitScreenshot() is called.
   4475  *  If Steam is not running, the paths will be in the user's
   4476  *  documents folder under Documents\SteamVR\Screenshots.
   4477  *  Other VR applications can call this to initiate a
   4478  *  screenshot outside of user control.
   4479  *  The destination file names do not need an extension,
   4480  *  will be replaced with the correct one for the format
   4481  *  which is currently .png. */
   4482 virtual vr::EVRScreenshotError RequestScreenshot( vr::ScreenshotHandle_t *pOutScreenshotHandle, vr::EVRScreenshotType type, const char *pchPreviewFilename, const char *pchVRFilename ) = 0;
   4483 
   4484 /** Called by the running VR application to indicate that it
   4485  *  wishes to be in charge of screenshots.  If the
   4486  *  application does not call this, the Compositor will only
   4487  *  support VRScreenshotType_Stereo screenshots that will be
   4488  *  captured without notification to the running app.
   4489  *  Once hooked your application will receive a
   4490  *  VREvent_RequestScreenshot event when the user presses the
   4491  *  buttons to take a screenshot. */
   4492 virtual vr::EVRScreenshotError HookScreenshot( VR_ARRAY_COUNT( numTypes ) const vr::EVRScreenshotType *pSupportedTypes, int numTypes ) = 0;
   4493 
   4494 /** When your application receives a
   4495  *  VREvent_RequestScreenshot event, call these functions to get
   4496  *  the details of the screenshot request. */
   4497 virtual vr::EVRScreenshotType GetScreenshotPropertyType( vr::ScreenshotHandle_t screenshotHandle, vr::EVRScreenshotError *pError ) = 0;
   4498 
   4499 /** Get the filename for the preview or vr image (see
   4500  *  vr::EScreenshotPropertyFilenames).  The return value is
   4501  *  the size of the string.   */
   4502 	virtual uint32_t GetScreenshotPropertyFilename( vr::ScreenshotHandle_t screenshotHandle, vr::EVRScreenshotPropertyFilenames filenameType, VR_OUT_STRING() char *pchFilename, uint32_t cchFilename, vr::EVRScreenshotError *pError ) = 0;
   4503 
   4504 /** Call this if the application is taking the screen shot
   4505  *  will take more than a few ms processing. This will result
   4506  *  in an overlay being presented that shows a completion
   4507  *  bar. */
   4508 virtual vr::EVRScreenshotError UpdateScreenshotProgress( vr::ScreenshotHandle_t screenshotHandle, float flProgress ) = 0;
   4509 
   4510 /** Tells the compositor to take an internal screenshot of
   4511  *  type VRScreenshotType_Stereo. It will take the current
   4512  *  submitted scene textures of the running application and
   4513  *  write them into the preview image and a side-by-side file
   4514  *  for the VR image.
   4515  *  This is similar to request screenshot, but doesn't ever
   4516  *  talk to the application, just takes the shot and submits. */
   4517 virtual vr::EVRScreenshotError TakeStereoScreenshot( vr::ScreenshotHandle_t *pOutScreenshotHandle, const char *pchPreviewFilename, const char *pchVRFilename ) = 0;
   4518 
   4519 /** Submit the completed screenshot.  If Steam is running
   4520  *  this will call into the Steam client and upload the
   4521  *  screenshot to the screenshots section of the library for
   4522  *  the running application.  If Steam is not running, this
   4523  *  function will display a notification to the user that the
   4524  *  screenshot was taken. The paths should be full paths with
   4525  *  extensions.
   4526  *  File paths should be absolute including extensions.
   4527  *  screenshotHandle can be k_unScreenshotHandleInvalid if this
   4528  *  was a new shot taking by the app to be saved and not
   4529  *  initiated by a user (achievement earned or something) */
   4530 virtual vr::EVRScreenshotError SubmitScreenshot( vr::ScreenshotHandle_t screenshotHandle, vr::EVRScreenshotType type, const char *pchSourcePreviewFilename, const char *pchSourceVRFilename ) = 0;
   4531 };
   4532 
   4533 static const char * const IVRScreenshots_Version = "IVRScreenshots_001";
   4534 
   4535 } // namespace vr
   4536 
   4537 
   4538 
   4539 // ivrresources.h
   4540 namespace vr
   4541 {
   4542 
   4543 class IVRResources
   4544 {
   4545 public:
   4546 
   4547 // ------------------------------------
   4548 // Shared Resource Methods
   4549 // ------------------------------------
   4550 
   4551 /** Loads the specified resource into the provided buffer if large enough.
   4552 * Returns the size in bytes of the buffer required to hold the specified resource. */
   4553 virtual uint32_t LoadSharedResource( const char *pchResourceName, char *pchBuffer, uint32_t unBufferLen ) = 0;
   4554 
   4555 /** Provides the full path to the specified resource. Resource names can include named directories for
   4556 * drivers and other things, and this resolves all of those and returns the actual physical path. 
   4557 * pchResourceTypeDirectory is the subdirectory of resources to look in. */
   4558 virtual uint32_t GetResourceFullPath( const char *pchResourceName, const char *pchResourceTypeDirectory, VR_OUT_STRING() char *pchPathBuffer, uint32_t unBufferLen ) = 0;
   4559 };
   4560 
   4561 static const char * const IVRResources_Version = "IVRResources_001";
   4562 
   4563 
   4564 }
   4565 // ivrdrivermanager.h
   4566 namespace vr
   4567 {
   4568 
   4569 class IVRDriverManager
   4570 {
   4571 public:
   4572 virtual uint32_t GetDriverCount() const = 0;
   4573 
   4574 /** Returns the length of the number of bytes necessary to hold this string including the trailing null. */
   4575 virtual uint32_t GetDriverName( vr::DriverId_t nDriver, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize ) = 0;
   4576 
   4577 virtual DriverHandle_t GetDriverHandle( const char *pchDriverName ) = 0;
   4578 
   4579 virtual bool IsEnabled( vr::DriverId_t nDriver ) const = 0;
   4580 };
   4581 
   4582 static const char * const IVRDriverManager_Version = "IVRDriverManager_001";
   4583 
   4584 } // namespace vr
   4585 
   4586 
   4587 
   4588 // ivrinput.h
   4589 namespace vr
   4590 {
   4591 // Maximum number of characters in an action name, including the trailing null
   4592 static const uint32_t k_unMaxActionNameLength = 64; 
   4593 
   4594 // Maximum number of characters in an action set name, including the trailing null
   4595 static const uint32_t k_unMaxActionSetNameLength = 64;
   4596 
   4597 // Maximum number of origins for an action
   4598 static const uint32_t k_unMaxActionOriginCount = 16; 
   4599 
   4600 // Maximum number of characters in a bone name, including the trailing null
   4601 static const uint32_t k_unMaxBoneNameLength = 32; 
   4602 
   4603 enum EVRSkeletalTransformSpace
   4604 {
   4605 	VRSkeletalTransformSpace_Model = 0, 
   4606 	VRSkeletalTransformSpace_Parent = 1
   4607 };
   4608 
   4609 enum EVRSkeletalReferencePose
   4610 {
   4611 	VRSkeletalReferencePose_BindPose = 0,
   4612 	VRSkeletalReferencePose_OpenHand,
   4613 	VRSkeletalReferencePose_Fist,
   4614 	VRSkeletalReferencePose_GripLimit
   4615 };
   4616 
   4617 enum EVRFinger
   4618 {
   4619 	VRFinger_Thumb = 0,
   4620 	VRFinger_Index,
   4621 	VRFinger_Middle,
   4622 	VRFinger_Ring,
   4623 	VRFinger_Pinky,
   4624 	VRFinger_Count
   4625 };
   4626 
   4627 enum EVRFingerSplay
   4628 {
   4629 	VRFingerSplay_Thumb_Index = 0,
   4630 	VRFingerSplay_Index_Middle,
   4631 	VRFingerSplay_Middle_Ring,
   4632 	VRFingerSplay_Ring_Pinky,
   4633 	VRFingerSplay_Count
   4634 };
   4635 
   4636 enum EVRSummaryType
   4637 {
   4638 	// The skeletal summary data will match the animated bone transforms for the action.
   4639 	VRSummaryType_FromAnimation = 0,	
   4640 	
   4641 	// The skeletal summary data will include unprocessed data directly from the device when available. 
   4642 	// This data is generally less latent than the data that is computed from the animations.
   4643 	VRSummaryType_FromDevice = 1,		
   4644 };
   4645 
   4646 enum EVRInputFilterCancelType
   4647 {
   4648 	VRInputFilterCancel_Timers = 0,
   4649 	VRInputFilterCancel_Momentum = 1,
   4650 };
   4651 
   4652 enum EVRInputStringBits
   4653 {
   4654 	VRInputString_Hand = 0x01,
   4655 	VRInputString_ControllerType = 0x02,
   4656 	VRInputString_InputSource = 0x04,
   4657 
   4658 	VRInputString_All = 0xFFFFFFFF
   4659 };
   4660 
   4661 struct InputAnalogActionData_t
   4662 {
   4663 	/** Whether or not this action is currently available to be bound in the active action set */
   4664 	bool bActive;
   4665 
   4666 	/** The origin that caused this action's current state */
   4667 	VRInputValueHandle_t activeOrigin;
   4668 
   4669 	/** The current state of this action; will be delta updates for mouse actions */
   4670 	float x, y, z;
   4671 
   4672 	/** Deltas since the previous call to UpdateActionState() */
   4673 	float deltaX, deltaY, deltaZ;
   4674 
   4675 	/** Time relative to now when this event happened. Will be negative to indicate a past time. */
   4676 	float fUpdateTime;
   4677 };
   4678 
   4679 struct InputDigitalActionData_t
   4680 {
   4681 	/** Whether or not this action is currently available to be bound in the active action set */
   4682 	bool bActive;
   4683 
   4684 	/** The origin that caused this action's current state */
   4685 	VRInputValueHandle_t activeOrigin;
   4686 
   4687 	/** The current state of this action; will be true if currently pressed */
   4688 	bool bState;
   4689 
   4690 	/** This is true if the state has changed since the last frame */
   4691 	bool bChanged;
   4692 
   4693 	/** Time relative to now when this event happened. Will be negative to indicate a past time. */
   4694 	float fUpdateTime;
   4695 };
   4696 
   4697 struct InputPoseActionData_t
   4698 {
   4699 	/** Whether or not this action is currently available to be bound in the active action set */
   4700 	bool bActive;
   4701 
   4702 	/** The origin that caused this action's current state */
   4703 	VRInputValueHandle_t activeOrigin;
   4704 
   4705 	/** The current state of this action */
   4706 	TrackedDevicePose_t pose;
   4707 };
   4708 
   4709 struct InputSkeletalActionData_t
   4710 {
   4711 	/** Whether or not this action is currently available to be bound in the active action set */
   4712 	bool bActive;
   4713 
   4714 	/** The origin that caused this action's current state */
   4715 	VRInputValueHandle_t activeOrigin;
   4716 };
   4717 
   4718 struct InputOriginInfo_t
   4719 {
   4720 	VRInputValueHandle_t devicePath;
   4721 	TrackedDeviceIndex_t trackedDeviceIndex;
   4722 	char rchRenderModelComponentName[128];
   4723 };
   4724 
   4725 struct InputBindingInfo_t
   4726 {
   4727 	char rchDevicePathName[128];
   4728 	char rchInputPathName[128];
   4729 	char rchModeName[128];
   4730 	char rchSlotName[128];
   4731 	char rchInputSourceType[ 32 ];
   4732 };
   4733 
   4734 // * Experimental global action set priority *
   4735 // These constants are part of the experimental support in SteamVR for overlay
   4736 // apps selectively overriding input in the base scene application. This may be
   4737 // useful for overlay applications that need to use part or all of a controller
   4738 // without taking away all input to the game. This system must be enabled by the 
   4739 // "Experimental overlay input overrides" setting in the developer section of 
   4740 // SteamVR settings.
   4741 //
   4742 // To use this system, set the nPriority field of an action set to any number in
   4743 // this range. 
   4744 static const int32_t k_nActionSetOverlayGlobalPriorityMin	= 0x01000000;
   4745 static const int32_t k_nActionSetOverlayGlobalPriorityMax	= 0x01FFFFFF;
   4746 
   4747 static const int32_t k_nActionSetPriorityReservedMin		= 0x02000000;
   4748 
   4749 struct VRActiveActionSet_t
   4750 {
   4751 	/** This is the handle of the action set to activate for this frame. */
   4752 	VRActionSetHandle_t ulActionSet;
   4753 
   4754 	/** This is the handle of a device path that this action set should be active for. To
   4755 	* activate for all devices, set this to k_ulInvalidInputValueHandle. */
   4756 	VRInputValueHandle_t ulRestrictedToDevice;
   4757 
   4758 	/** The action set to activate for all devices other than ulRestrictedDevice. If 
   4759 	* ulRestrictedToDevice is set to k_ulInvalidInputValueHandle, this parameter is 
   4760 	* ignored. */
   4761 	VRActionSetHandle_t ulSecondaryActionSet;
   4762 
   4763 	// This field is ignored
   4764 	uint32_t unPadding;
   4765 
   4766 	/** The priority of this action set relative to other action sets. Any inputs
   4767 	* bound to a source (e.g. trackpad, joystick, trigger) will disable bindings in
   4768 	* other active action sets with a smaller priority. 
   4769 	*
   4770 	* Overlay applications (i.e. ApplicationType_Overlay) may set their action set priority 
   4771 	* to a value between k_nActionSetOverlayGlobalPriorityMin and k_nActionSetOverlayGlobalPriorityMax
   4772 	* to cause any inputs bound to a source used by that action set to be disabled in scene applications.
   4773 	*
   4774 	* No action set priority may value may be larger than k_nActionSetPriorityReservedMin
   4775 	*/
   4776 	int32_t nPriority;
   4777 };
   4778 
   4779 /** Contains summary information about the current skeletal pose */
   4780 struct VRSkeletalSummaryData_t
   4781 {
   4782 	/** The amount that each finger is 'curled' inwards towards the palm.  In the case of the thumb,
   4783 	* this represents how much the thumb is wrapped around the fist.  
   4784 	* 0 means straight, 1 means fully curled */
   4785 	float	flFingerCurl[ VRFinger_Count ];
   4786 
   4787 	/** The amount that each pair of adjacent fingers are separated.  
   4788 	* 0 means the digits are touching, 1 means they are fully separated.
   4789 	*/
   4790 	float	flFingerSplay[ VRFingerSplay_Count ];
   4791 };
   4792 
   4793 
   4794 class IVRInput
   4795 {
   4796 public:
   4797 
   4798 	// ---------------  Handle management   --------------- //
   4799 
   4800 	/** Sets the path to the action manifest JSON file that is used by this application. If this information
   4801 	* was set on the Steam partner site, calls to this function are ignored. If the Steam partner site
   4802 	* setting and the path provided by this call are different, VRInputError_MismatchedActionManifest is returned. 
   4803 	* This call must be made before the first call to UpdateActionState or IVRSystem::PollNextEvent. */
   4804 	virtual EVRInputError SetActionManifestPath( const char *pchActionManifestPath ) = 0;
   4805 
   4806 	/** Returns a handle for an action set. This handle is used for all performance-sensitive calls. */
   4807 	virtual EVRInputError GetActionSetHandle( const char *pchActionSetName, VRActionSetHandle_t *pHandle ) = 0;
   4808 
   4809 	/** Returns a handle for an action. This handle is used for all performance-sensitive calls. */
   4810 	virtual EVRInputError GetActionHandle( const char *pchActionName, VRActionHandle_t *pHandle ) = 0;
   4811 
   4812 	/** Returns a handle for any path in the input system. E.g. /user/hand/right */
   4813 	virtual EVRInputError GetInputSourceHandle( const char *pchInputSourcePath, VRInputValueHandle_t *pHandle ) = 0;
   4814 
   4815 
   4816 
   4817 	// --------------- Reading action state ------------------- //
   4818 
   4819 	/** Reads the current state into all actions. After this call, the results of Get*Action calls 
   4820 	* will be the same until the next call to UpdateActionState. */
   4821 	virtual EVRInputError UpdateActionState( VR_ARRAY_COUNT( unSetCount ) VRActiveActionSet_t *pSets, uint32_t unSizeOfVRSelectedActionSet_t, uint32_t unSetCount ) = 0;
   4822 
   4823 	/** Reads the state of a digital action given its handle. This will return VRInputError_WrongType if the type of
   4824 	* action is something other than digital */
   4825 	virtual EVRInputError GetDigitalActionData( VRActionHandle_t action, InputDigitalActionData_t *pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice ) = 0;
   4826 
   4827 	/** Reads the state of an analog action given its handle. This will return VRInputError_WrongType if the type of
   4828 	* action is something other than analog */
   4829 	virtual EVRInputError GetAnalogActionData( VRActionHandle_t action, InputAnalogActionData_t *pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice ) = 0;
   4830 
   4831 	/** Reads the state of a pose action given its handle for the number of seconds relative to now. This
   4832 	* will generally be called with negative times from the fUpdateTime fields in other actions. */
   4833 	virtual EVRInputError GetPoseActionDataRelativeToNow( VRActionHandle_t action, ETrackingUniverseOrigin eOrigin, float fPredictedSecondsFromNow, InputPoseActionData_t *pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice ) = 0;
   4834 
   4835 	/** Reads the state of a pose action given its handle. The returned values will match the values returned
   4836 	* by the last call to IVRCompositor::WaitGetPoses(). */
   4837 	virtual EVRInputError GetPoseActionDataForNextFrame( VRActionHandle_t action, ETrackingUniverseOrigin eOrigin, InputPoseActionData_t *pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice ) = 0;
   4838 
   4839 	/** Reads the state of a skeletal action given its handle. */
   4840 	virtual EVRInputError GetSkeletalActionData( VRActionHandle_t action, InputSkeletalActionData_t *pActionData, uint32_t unActionDataSize ) = 0;
   4841 
   4842 	/** Returns the current dominant hand for the user for this application. This function will only return success for applications
   4843 	* which include "supports_dominant_hand_setting": true in their action manifests. The dominant hand will only change after
   4844 	* a call to UpdateActionState, and the action data returned after that point will use the new dominant hand. */
   4845 	virtual EVRInputError GetDominantHand( ETrackedControllerRole *peDominantHand ) = 0;
   4846 
   4847 	/** Sets the dominant hand for the user for this application. */
   4848 	virtual EVRInputError SetDominantHand( ETrackedControllerRole eDominantHand ) = 0;
   4849 
   4850 	// ---------------  Static Skeletal Data ------------------- //
   4851 
   4852 	/** Reads the number of bones in skeleton associated with the given action */
   4853 	virtual EVRInputError GetBoneCount( VRActionHandle_t action, uint32_t* pBoneCount ) = 0;
   4854 
   4855 	/** Fills the given array with the index of each bone's parent in the skeleton associated with the given action */
   4856 	virtual EVRInputError GetBoneHierarchy( VRActionHandle_t action, VR_ARRAY_COUNT( unIndexArayCount ) BoneIndex_t* pParentIndices, uint32_t unIndexArayCount ) = 0;
   4857 
   4858 	/** Fills the given buffer with the name of the bone at the given index in the skeleton associated with the given action */
   4859 	virtual EVRInputError GetBoneName( VRActionHandle_t action, BoneIndex_t nBoneIndex, VR_OUT_STRING() char* pchBoneName, uint32_t unNameBufferSize ) = 0;
   4860 
   4861 	/** Fills the given buffer with the transforms for a specific static skeletal reference pose */
   4862 	virtual EVRInputError GetSkeletalReferenceTransforms( VRActionHandle_t action, EVRSkeletalTransformSpace eTransformSpace, EVRSkeletalReferencePose eReferencePose, VR_ARRAY_COUNT( unTransformArrayCount ) VRBoneTransform_t *pTransformArray, uint32_t unTransformArrayCount ) = 0;
   4863 
   4864 	/** Reads the level of accuracy to which the controller is able to track the user to recreate a skeletal pose */
   4865 	virtual EVRInputError GetSkeletalTrackingLevel( VRActionHandle_t action, EVRSkeletalTrackingLevel* pSkeletalTrackingLevel ) = 0;
   4866 
   4867 	// ---------------  Dynamic Skeletal Data ------------------- //
   4868 
   4869 	/** Reads the state of the skeletal bone data associated with this action and copies it into the given buffer. */
   4870 	virtual EVRInputError GetSkeletalBoneData( VRActionHandle_t action, EVRSkeletalTransformSpace eTransformSpace, EVRSkeletalMotionRange eMotionRange, VR_ARRAY_COUNT( unTransformArrayCount ) VRBoneTransform_t *pTransformArray, uint32_t unTransformArrayCount ) = 0;
   4871 
   4872 	/** Reads summary information about the current pose of the skeleton associated with the given action.   */
   4873 	virtual EVRInputError GetSkeletalSummaryData( VRActionHandle_t action, EVRSummaryType eSummaryType, VRSkeletalSummaryData_t * pSkeletalSummaryData ) = 0;
   4874 
   4875 	/** Reads the state of the skeletal bone data in a compressed form that is suitable for
   4876 	* sending over the network. The required buffer size will never exceed ( sizeof(VR_BoneTransform_t)*boneCount + 2).
   4877 	* Usually the size will be much smaller. */
   4878 	virtual EVRInputError GetSkeletalBoneDataCompressed( VRActionHandle_t action, EVRSkeletalMotionRange eMotionRange, VR_OUT_BUFFER_COUNT( unCompressedSize ) void *pvCompressedData, uint32_t unCompressedSize, uint32_t *punRequiredCompressedSize ) = 0;
   4879 
   4880 	/** Turns a compressed buffer from GetSkeletalBoneDataCompressed and turns it back into a bone transform array. */
   4881 	virtual EVRInputError DecompressSkeletalBoneData( const void *pvCompressedBuffer, uint32_t unCompressedBufferSize, EVRSkeletalTransformSpace eTransformSpace, VR_ARRAY_COUNT( unTransformArrayCount ) VRBoneTransform_t *pTransformArray, uint32_t unTransformArrayCount ) = 0;
   4882 
   4883 	// --------------- Haptics ------------------- //
   4884 
   4885 	/** Triggers a haptic event as described by the specified action */
   4886 	virtual EVRInputError TriggerHapticVibrationAction( VRActionHandle_t action, float fStartSecondsFromNow, float fDurationSeconds, float fFrequency, float fAmplitude, VRInputValueHandle_t ulRestrictToDevice ) = 0;
   4887 
   4888 	// --------------- Action Origins ---------------- //
   4889 
   4890 	/** Retrieve origin handles for an action */
   4891 	virtual EVRInputError GetActionOrigins( VRActionSetHandle_t actionSetHandle, VRActionHandle_t digitalActionHandle, VR_ARRAY_COUNT( originOutCount ) VRInputValueHandle_t *originsOut, uint32_t originOutCount ) = 0;
   4892 
   4893 	/** Retrieves the name of the origin in the current language. unStringSectionsToInclude is a bitfield of values in EVRInputStringBits that allows the 
   4894 		application to specify which parts of the origin's information it wants a string for. */
   4895 	virtual EVRInputError GetOriginLocalizedName( VRInputValueHandle_t origin, VR_OUT_STRING() char *pchNameArray, uint32_t unNameArraySize, int32_t unStringSectionsToInclude ) = 0;
   4896 
   4897 	/** Retrieves useful information for the origin of this action */
   4898 	virtual EVRInputError GetOriginTrackedDeviceInfo( VRInputValueHandle_t origin, InputOriginInfo_t *pOriginInfo, uint32_t unOriginInfoSize ) = 0;
   4899 
   4900 	/** Retrieves useful information about the bindings for an action */
   4901 	virtual EVRInputError GetActionBindingInfo( VRActionHandle_t action, InputBindingInfo_t *pOriginInfo, uint32_t unBindingInfoSize, uint32_t unBindingInfoCount, uint32_t *punReturnedBindingInfoCount ) = 0;
   4902 
   4903 	/** Shows the current binding for the action in-headset */
   4904 	virtual EVRInputError ShowActionOrigins( VRActionSetHandle_t actionSetHandle, VRActionHandle_t ulActionHandle ) = 0;
   4905 
   4906 	/** Shows the current binding all the actions in the specified action sets */
   4907 	virtual EVRInputError ShowBindingsForActionSet( VR_ARRAY_COUNT( unSetCount ) VRActiveActionSet_t *pSets, uint32_t unSizeOfVRSelectedActionSet_t, uint32_t unSetCount, VRInputValueHandle_t originToHighlight ) = 0;
   4908 
   4909 	/** Use this to query what action on the component returned by GetOriginTrackedDeviceInfo would trigger this binding. */
   4910 	virtual EVRInputError GetComponentStateForBinding( const char *pchRenderModelName, const char *pchComponentName,
   4911 		const InputBindingInfo_t *pOriginInfo, uint32_t unBindingInfoSize, uint32_t unBindingInfoCount,
   4912 		vr::RenderModel_ComponentState_t *pComponentState ) = 0;
   4913 
   4914 
   4915 	// --------------- Legacy Input ------------------- //
   4916 	virtual bool IsUsingLegacyInput() = 0;
   4917 
   4918 
   4919 	// --------------- Utilities ------------------- //
   4920 
   4921 	/** Opens the binding user interface. If no app key is provided it will use the key from the calling process.
   4922 	* If no set is provided it will open to the root of the app binding page. */
   4923 	virtual EVRInputError OpenBindingUI( const char* pchAppKey, VRActionSetHandle_t ulActionSetHandle, VRInputValueHandle_t ulDeviceHandle, bool bShowOnDesktop ) = 0;
   4924 
   4925 	/** Returns the variant set in the current bindings. If the binding doesn't include a variant setting, this function 
   4926 	* will return an empty string */
   4927 	virtual EVRInputError GetBindingVariant( vr::VRInputValueHandle_t ulDevicePath,
   4928 		VR_OUT_STRING() char *pchVariantArray, uint32_t unVariantArraySize ) = 0;
   4929 
   4930 };
   4931 
   4932 static const char * const IVRInput_Version = "IVRInput_010";
   4933 
   4934 } // namespace vr
   4935 
   4936 // ivriobuffer.h
   4937 namespace vr
   4938 {
   4939 
   4940 typedef uint64_t IOBufferHandle_t;
   4941 static const uint64_t k_ulInvalidIOBufferHandle = 0;
   4942 
   4943 enum EIOBufferError
   4944 {
   4945 	IOBuffer_Success                  = 0,
   4946 	IOBuffer_OperationFailed          = 100,
   4947 	IOBuffer_InvalidHandle            = 101,
   4948 	IOBuffer_InvalidArgument          = 102,
   4949 	IOBuffer_PathExists               = 103,
   4950 	IOBuffer_PathDoesNotExist         = 104,
   4951 	IOBuffer_Permission               = 105,
   4952 };
   4953 
   4954 enum EIOBufferMode
   4955 {
   4956 	IOBufferMode_Read                 = 0x0001,
   4957 	IOBufferMode_Write                = 0x0002,
   4958 	IOBufferMode_Create               = 0x0200,
   4959 };
   4960 
   4961 // ----------------------------------------------------------------------------------------------
   4962 // Purpose:
   4963 // ----------------------------------------------------------------------------------------------
   4964 class IVRIOBuffer
   4965 {
   4966 public:
   4967 	/** opens an existing or creates a new IOBuffer of unSize bytes */
   4968 	virtual vr::EIOBufferError Open( const char *pchPath, vr::EIOBufferMode mode, uint32_t unElementSize, uint32_t unElements, vr::IOBufferHandle_t *pulBuffer ) = 0;
   4969 	
   4970 	/** closes a previously opened or created buffer */
   4971 	virtual vr::EIOBufferError Close( vr::IOBufferHandle_t ulBuffer ) = 0;
   4972 	
   4973 	/** reads up to unBytes from buffer into *pDst, returning number of bytes read in *punRead */
   4974 	virtual vr::EIOBufferError Read( vr::IOBufferHandle_t ulBuffer, void *pDst, uint32_t unBytes, uint32_t *punRead ) = 0;
   4975 	
   4976 	/** writes unBytes of data from *pSrc into a buffer. */
   4977 	virtual vr::EIOBufferError Write( vr::IOBufferHandle_t ulBuffer, void *pSrc, uint32_t unBytes ) = 0;
   4978 	
   4979 	/** retrieves the property container of an buffer. */
   4980 	virtual vr::PropertyContainerHandle_t PropertyContainer( vr::IOBufferHandle_t ulBuffer ) = 0;
   4981 
   4982 	/** inexpensively checks for readers to allow writers to fast-fail potentially expensive copies and writes. */
   4983 	virtual bool HasReaders( vr::IOBufferHandle_t ulBuffer ) = 0;
   4984 };
   4985 
   4986 static const char *IVRIOBuffer_Version = "IVRIOBuffer_002";
   4987 }
   4988 
   4989 // ivrspatialanchors.h
   4990 namespace vr
   4991 {
   4992 static const SpatialAnchorHandle_t k_ulInvalidSpatialAnchorHandle = 0;
   4993 
   4994 struct SpatialAnchorPose_t
   4995 {
   4996 	HmdMatrix34_t mAnchorToAbsoluteTracking;
   4997 };
   4998 
   4999 class IVRSpatialAnchors
   5000 {
   5001 public:
   5002 
   5003 	/** Returns a handle for an spatial anchor described by "descriptor".  On success, pHandle
   5004 	* will contain a handle valid for this session.  Caller can wait for an event or occasionally
   5005 	* poll GetSpatialAnchorPose() to find the virtual coordinate associated with this anchor. */
   5006 	virtual EVRSpatialAnchorError CreateSpatialAnchorFromDescriptor( const char *pchDescriptor, SpatialAnchorHandle_t *pHandleOut ) = 0;
   5007 
   5008 	/** Returns a handle for an new spatial anchor at pPose.  On success, pHandle
   5009 	* will contain a handle valid for this session.  Caller can wait for an event or occasionally
   5010 	* poll GetSpatialAnchorDescriptor() to find the permanent descriptor for this pose.
   5011 	* The result of GetSpatialAnchorPose() may evolve from this initial position if the driver chooses
   5012 	* to update it.
   5013 	* The anchor will be associated with the driver that provides unDeviceIndex, and the driver may use that specific
   5014 	* device as a hint for how to best create the anchor.
   5015 	* The eOrigin must match whatever tracking origin you are working in (seated/standing/raw).
   5016 	* This should be called when the user is close to (and ideally looking at/interacting with) the target physical
   5017 	* location.  At that moment, the driver will have the most information about how to recover that physical point
   5018 	* in the future, and the quality of the anchor (when the descriptor is re-used) will be highest.
   5019 	* The caller may decide to apply offsets from this initial pose, but is advised to stay relatively close to the 
   5020 	* original pose location for highest fidelity. */
   5021 	virtual EVRSpatialAnchorError CreateSpatialAnchorFromPose( TrackedDeviceIndex_t unDeviceIndex, ETrackingUniverseOrigin eOrigin, SpatialAnchorPose_t *pPose, SpatialAnchorHandle_t *pHandleOut ) = 0;
   5022 
   5023 	/** Get the pose for a given handle.  This is intended to be cheap enough to call every frame (or fairly often)
   5024 	* so that the driver can refine this position when it has more information available. */
   5025 	virtual EVRSpatialAnchorError GetSpatialAnchorPose( SpatialAnchorHandle_t unHandle, ETrackingUniverseOrigin eOrigin, SpatialAnchorPose_t *pPoseOut ) = 0;
   5026 
   5027 	/** Get the descriptor for a given handle.  This will be empty for handles where the driver has not
   5028 	* yet built a descriptor.  It will be the application-supplied descriptor for previously saved anchors
   5029 	* that the application is requesting poses for.  If the driver has called UpdateSpatialAnchorDescriptor()
   5030 	* already in this session, it will be the descriptor provided by the driver.
   5031 	* Returns true if the descriptor fits into the buffer, else false.  Buffer size should be at least
   5032 	* k_unMaxSpatialAnchorDescriptorSize. */
   5033 	virtual EVRSpatialAnchorError GetSpatialAnchorDescriptor( SpatialAnchorHandle_t unHandle, VR_OUT_STRING() char *pchDescriptorOut, uint32_t *punDescriptorBufferLenInOut ) = 0;
   5034 
   5035 };
   5036 
   5037 static const char * const IVRSpatialAnchors_Version = "IVRSpatialAnchors_001";
   5038 
   5039 } // namespace vr
   5040 
   5041 // ivrdebug.h
   5042 namespace vr
   5043 {
   5044 enum EVRDebugError
   5045 {
   5046 	VRDebugError_Success = 0,
   5047 	VRDebugError_BadParameter
   5048 };
   5049 
   5050 /** Handle for vr profiler events */
   5051 typedef uint64_t VrProfilerEventHandle_t;
   5052 
   5053 class IVRDebug
   5054 {
   5055 public:
   5056 
   5057 	/** Create a vr profiler discrete event (point)
   5058 	* The event will be associated with the message provided in pchMessage, and the current
   5059 	* time will be used as the event timestamp. */
   5060 	virtual EVRDebugError EmitVrProfilerEvent( const char *pchMessage ) = 0;
   5061 
   5062 	/** Create an vr profiler duration event (line)
   5063 	* The current time will be used as the timestamp for the start of the line.
   5064 	* On success, pHandleOut will contain a handle valid for terminating this event. */
   5065 	virtual EVRDebugError BeginVrProfilerEvent( VrProfilerEventHandle_t *pHandleOut ) = 0;
   5066 
   5067 	/** Terminate a vr profiler event
   5068 	* The event associated with hHandle will be considered completed when this method is called.
   5069 	* The current time will be used assocaited to the termination time of the event, and
   5070 	* pchMessage will be used as the event title. */
   5071 	virtual EVRDebugError FinishVrProfilerEvent( VrProfilerEventHandle_t hHandle, const char *pchMessage ) = 0;
   5072 
   5073 	/** Sends a request to the driver for the specified device and returns the response. The maximum response size is 32k,
   5074 	* but this method can be called with a smaller buffer. If the response exceeds the size of the buffer, it is truncated.
   5075 	* The size of the response including its terminating null is returned. */
   5076 	virtual uint32_t DriverDebugRequest( vr::TrackedDeviceIndex_t unDeviceIndex, const char *pchRequest, VR_OUT_STRING() char *pchResponseBuffer, uint32_t unResponseBufferSize ) = 0;
   5077 
   5078 };
   5079 
   5080 static const char * const IVRDebug_Version = "IVRDebug_001";
   5081 
   5082 } // namespace vr
   5083 // End
   5084 
   5085 #endif // _OPENVR_API
   5086 
   5087 
   5088 
   5089 namespace vr
   5090 {
   5091 #if !defined( OPENVR_INTERFACE_INTERNAL )
   5092 
   5093 /** Finds the active installation of the VR API and initializes it. The provided path must be absolute
   5094 * or relative to the current working directory. These are the local install versions of the equivalent
   5095 * functions in steamvr.h and will work without a local Steam install.
   5096 *
   5097 * This path is to the "root" of the VR API install. That's the directory with
   5098 * the "drivers" directory and a platform (i.e. "win32") directory in it, not the directory with the DLL itself.
   5099 *
   5100 * pStartupInfo is reserved for future use.
   5101 */
   5102 inline IVRSystem *VR_Init( EVRInitError *peError, EVRApplicationType eApplicationType, const char *pStartupInfo = nullptr );
   5103 
   5104 /** unloads vrclient.dll. Any interface pointers from the interface are
   5105 * invalid after this point */
   5106 inline void VR_Shutdown();
   5107 
   5108 /** Returns true if there is an HMD attached. This check is as lightweight as possible and
   5109 * can be called outside of VR_Init/VR_Shutdown. It should be used when an application wants
   5110 * to know if initializing VR is a possibility but isn't ready to take that step yet.
   5111 */
   5112 VR_INTERFACE bool VR_CALLTYPE VR_IsHmdPresent();
   5113 
   5114 /** Returns true if the OpenVR runtime is installed. */
   5115 VR_INTERFACE bool VR_CALLTYPE VR_IsRuntimeInstalled();
   5116 
   5117 /** Returns where the OpenVR runtime is installed. */
   5118 VR_INTERFACE bool VR_GetRuntimePath( VR_OUT_STRING() char *pchPathBuffer, uint32_t unBufferSize, uint32_t *punRequiredBufferSize );
   5119 
   5120 /** Returns the name of the enum value for an EVRInitError. This function may be called outside of VR_Init()/VR_Shutdown(). */
   5121 VR_INTERFACE const char *VR_CALLTYPE VR_GetVRInitErrorAsSymbol( EVRInitError error );
   5122 
   5123 /** Returns an English string for an EVRInitError. Applications should call VR_GetVRInitErrorAsSymbol instead and
   5124 * use that as a key to look up their own localized error message. This function may be called outside of VR_Init()/VR_Shutdown(). */
   5125 VR_INTERFACE const char *VR_CALLTYPE VR_GetVRInitErrorAsEnglishDescription( EVRInitError error );
   5126 
   5127 /** Returns the interface of the specified version. This method must be called after VR_Init. The
   5128 * pointer returned is valid until VR_Shutdown is called.
   5129 */
   5130 VR_INTERFACE void *VR_CALLTYPE VR_GetGenericInterface( const char *pchInterfaceVersion, EVRInitError *peError );
   5131 
   5132 /** Returns whether the interface of the specified version exists.
   5133 */
   5134 VR_INTERFACE bool VR_CALLTYPE VR_IsInterfaceVersionValid( const char *pchInterfaceVersion );
   5135 
   5136 /** Returns a token that represents whether the VR interface handles need to be reloaded */
   5137 VR_INTERFACE uint32_t VR_CALLTYPE VR_GetInitToken();
   5138 
   5139 // These typedefs allow old enum names from SDK 0.9.11 to be used in applications.
   5140 // They will go away in the future.
   5141 typedef EVRInitError HmdError;
   5142 typedef EVREye Hmd_Eye;
   5143 typedef EColorSpace ColorSpace;
   5144 typedef ETrackingResult HmdTrackingResult;
   5145 typedef ETrackedDeviceClass TrackedDeviceClass;
   5146 typedef ETrackingUniverseOrigin TrackingUniverseOrigin;
   5147 typedef ETrackedDeviceProperty TrackedDeviceProperty;
   5148 typedef ETrackedPropertyError TrackedPropertyError;
   5149 typedef EVRSubmitFlags VRSubmitFlags_t;
   5150 typedef EVRState VRState_t;
   5151 typedef ECollisionBoundsStyle CollisionBoundsStyle_t;
   5152 typedef EVROverlayError VROverlayError;
   5153 typedef EVRFirmwareError VRFirmwareError;
   5154 typedef EVRCompositorError VRCompositorError;
   5155 typedef EVRScreenshotError VRScreenshotsError;
   5156 
   5157 inline uint32_t &VRToken()
   5158 {
   5159 	static uint32_t token;
   5160 	return token;
   5161 }
   5162 
   5163 class COpenVRContext
   5164 {
   5165 public:
   5166 	COpenVRContext() { Clear(); }
   5167 	void Clear();
   5168 
   5169 	inline void CheckClear()
   5170 	{
   5171 		if ( VRToken() != VR_GetInitToken() )
   5172 		{
   5173 			Clear();
   5174 			VRToken() = VR_GetInitToken();
   5175 		}
   5176 	}
   5177 
   5178 	IVRSystem *VRSystem()
   5179 	{
   5180 		CheckClear();
   5181 		if ( m_pVRSystem == nullptr )
   5182 		{
   5183 			EVRInitError eError;
   5184 			m_pVRSystem = ( IVRSystem * )VR_GetGenericInterface( IVRSystem_Version, &eError );
   5185 		}
   5186 		return m_pVRSystem;
   5187 	}
   5188 	IVRChaperone *VRChaperone()
   5189 	{
   5190 		CheckClear();
   5191 		if ( m_pVRChaperone == nullptr )
   5192 		{
   5193 			EVRInitError eError;
   5194 			m_pVRChaperone = ( IVRChaperone * )VR_GetGenericInterface( IVRChaperone_Version, &eError );
   5195 		}
   5196 		return m_pVRChaperone;
   5197 	}
   5198 
   5199 	IVRChaperoneSetup *VRChaperoneSetup()
   5200 	{
   5201 		CheckClear();
   5202 		if ( m_pVRChaperoneSetup == nullptr )
   5203 		{
   5204 			EVRInitError eError;
   5205 			m_pVRChaperoneSetup = ( IVRChaperoneSetup * )VR_GetGenericInterface( IVRChaperoneSetup_Version, &eError );
   5206 		}
   5207 		return m_pVRChaperoneSetup;
   5208 	}
   5209 
   5210 	IVRCompositor *VRCompositor()
   5211 	{
   5212 		CheckClear();
   5213 		if ( m_pVRCompositor == nullptr )
   5214 		{
   5215 			EVRInitError eError;
   5216 			m_pVRCompositor = ( IVRCompositor * )VR_GetGenericInterface( IVRCompositor_Version, &eError );
   5217 		}
   5218 		return m_pVRCompositor;
   5219 	}
   5220 
   5221 	IVROverlay *VROverlay()
   5222 	{
   5223 		CheckClear();
   5224 		if ( m_pVROverlay == nullptr )
   5225 		{
   5226 			EVRInitError eError;
   5227 			m_pVROverlay = ( IVROverlay * )VR_GetGenericInterface( IVROverlay_Version, &eError );
   5228 		}
   5229 		return m_pVROverlay;
   5230 	}
   5231 
   5232 	IVROverlayView *VROverlayView()
   5233 	{
   5234 		CheckClear();
   5235 		if ( m_pVROverlayView == nullptr )
   5236 		{
   5237 			EVRInitError eError;
   5238 			m_pVROverlayView = ( IVROverlayView * ) VR_GetGenericInterface( IVROverlayView_Version, &eError );
   5239 		}
   5240 		return m_pVROverlayView;
   5241 	}
   5242 
   5243 	IVRHeadsetView *VRHeadsetView()
   5244 	{
   5245 		CheckClear();
   5246 		if ( m_pVRHeadsetView == nullptr )
   5247 		{
   5248 			EVRInitError eError;
   5249 			m_pVRHeadsetView = ( IVRHeadsetView * ) VR_GetGenericInterface( IVRHeadsetView_Version, &eError );
   5250 		}
   5251 		return m_pVRHeadsetView;
   5252 	}
   5253 
   5254 	IVRResources *VRResources()
   5255 	{
   5256 		CheckClear();
   5257 		if ( m_pVRResources == nullptr )
   5258 		{
   5259 			EVRInitError eError;
   5260 			m_pVRResources = (IVRResources *)VR_GetGenericInterface( IVRResources_Version, &eError );
   5261 		}
   5262 		return m_pVRResources;
   5263 	}
   5264 
   5265 	IVRScreenshots *VRScreenshots()
   5266 	{
   5267 		CheckClear();
   5268 		if ( m_pVRScreenshots == nullptr )
   5269 		{
   5270 			EVRInitError eError;
   5271 			m_pVRScreenshots = ( IVRScreenshots * )VR_GetGenericInterface( IVRScreenshots_Version, &eError );
   5272 		}
   5273 		return m_pVRScreenshots;
   5274 	}
   5275 
   5276 	IVRRenderModels *VRRenderModels()
   5277 	{
   5278 		CheckClear();
   5279 		if ( m_pVRRenderModels == nullptr )
   5280 		{
   5281 			EVRInitError eError;
   5282 			m_pVRRenderModels = ( IVRRenderModels * )VR_GetGenericInterface( IVRRenderModels_Version, &eError );
   5283 		}
   5284 		return m_pVRRenderModels;
   5285 	}
   5286 
   5287 	IVRExtendedDisplay *VRExtendedDisplay()
   5288 	{
   5289 		CheckClear();
   5290 		if ( m_pVRExtendedDisplay == nullptr )
   5291 		{
   5292 			EVRInitError eError;
   5293 			m_pVRExtendedDisplay = ( IVRExtendedDisplay * )VR_GetGenericInterface( IVRExtendedDisplay_Version, &eError );
   5294 		}
   5295 		return m_pVRExtendedDisplay;
   5296 	}
   5297 
   5298 	IVRSettings *VRSettings()
   5299 	{
   5300 		CheckClear();
   5301 		if ( m_pVRSettings == nullptr )
   5302 		{
   5303 			EVRInitError eError;
   5304 			m_pVRSettings = ( IVRSettings * )VR_GetGenericInterface( IVRSettings_Version, &eError );
   5305 		}
   5306 		return m_pVRSettings;
   5307 	}
   5308 
   5309 	IVRApplications *VRApplications()
   5310 	{
   5311 		CheckClear();
   5312 		if ( m_pVRApplications == nullptr )
   5313 		{
   5314 			EVRInitError eError;
   5315 			m_pVRApplications = ( IVRApplications * )VR_GetGenericInterface( IVRApplications_Version, &eError );
   5316 		}
   5317 		return m_pVRApplications;
   5318 	}
   5319 
   5320 	IVRTrackedCamera *VRTrackedCamera()
   5321 	{
   5322 		CheckClear();
   5323 		if ( m_pVRTrackedCamera == nullptr )
   5324 		{
   5325 			EVRInitError eError;
   5326 			m_pVRTrackedCamera = ( IVRTrackedCamera * )VR_GetGenericInterface( IVRTrackedCamera_Version, &eError );
   5327 		}
   5328 		return m_pVRTrackedCamera;
   5329 	}
   5330 
   5331 	IVRDriverManager *VRDriverManager()
   5332 	{
   5333 		CheckClear();
   5334 		if ( !m_pVRDriverManager )
   5335 		{
   5336 			EVRInitError eError;
   5337 			m_pVRDriverManager = ( IVRDriverManager * )VR_GetGenericInterface( IVRDriverManager_Version, &eError );
   5338 		}
   5339 		return m_pVRDriverManager;
   5340 	}
   5341 
   5342 	IVRInput *VRInput()
   5343 	{
   5344 		CheckClear();
   5345 		if ( !m_pVRInput )
   5346 		{
   5347 			EVRInitError eError;
   5348 			m_pVRInput = (IVRInput *)VR_GetGenericInterface( IVRInput_Version, &eError );
   5349 		}
   5350 		return m_pVRInput;
   5351 	}
   5352 
   5353 	IVRIOBuffer *VRIOBuffer()
   5354 	{
   5355 		if ( !m_pVRIOBuffer )
   5356 		{
   5357 			EVRInitError eError;
   5358 			m_pVRIOBuffer = ( IVRIOBuffer * )VR_GetGenericInterface( IVRIOBuffer_Version, &eError );
   5359 		}
   5360 		return m_pVRIOBuffer;
   5361 	}
   5362 
   5363 	IVRSpatialAnchors *VRSpatialAnchors()
   5364 	{
   5365 		CheckClear();
   5366 		if ( !m_pVRSpatialAnchors )
   5367 		{
   5368 			EVRInitError eError;
   5369 			m_pVRSpatialAnchors = (IVRSpatialAnchors *)VR_GetGenericInterface( IVRSpatialAnchors_Version, &eError );
   5370 		}
   5371 		return m_pVRSpatialAnchors;
   5372 	}
   5373 
   5374 	IVRDebug *VRDebug()
   5375 	{
   5376 		CheckClear();
   5377 		if ( !m_pVRDebug )
   5378 		{
   5379 			EVRInitError eError;
   5380 			m_pVRDebug = (IVRDebug *)VR_GetGenericInterface( IVRDebug_Version, &eError );
   5381 		}
   5382 		return m_pVRDebug;
   5383 	}
   5384 
   5385 	IVRNotifications *VRNotifications()
   5386 	{
   5387 		CheckClear();
   5388 		if ( !m_pVRNotifications )
   5389 		{
   5390 			EVRInitError eError;
   5391 			m_pVRNotifications = ( IVRNotifications * )VR_GetGenericInterface( IVRNotifications_Version, &eError );
   5392 		}
   5393 		return m_pVRNotifications;
   5394 	}
   5395 	
   5396 private:
   5397 	IVRSystem			*m_pVRSystem;
   5398 	IVRChaperone		*m_pVRChaperone;
   5399 	IVRChaperoneSetup	*m_pVRChaperoneSetup;
   5400 	IVRCompositor		*m_pVRCompositor;
   5401 	IVRHeadsetView		*m_pVRHeadsetView;
   5402 	IVROverlay			*m_pVROverlay;
   5403 	IVROverlayView		*m_pVROverlayView;
   5404 	IVRResources		*m_pVRResources;
   5405 	IVRRenderModels		*m_pVRRenderModels;
   5406 	IVRExtendedDisplay	*m_pVRExtendedDisplay;
   5407 	IVRSettings			*m_pVRSettings;
   5408 	IVRApplications		*m_pVRApplications;
   5409 	IVRTrackedCamera	*m_pVRTrackedCamera;
   5410 	IVRScreenshots		*m_pVRScreenshots;
   5411 	IVRDriverManager	*m_pVRDriverManager;
   5412 	IVRInput			*m_pVRInput;
   5413 	IVRIOBuffer			*m_pVRIOBuffer;
   5414 	IVRSpatialAnchors   *m_pVRSpatialAnchors;
   5415 	IVRDebug			*m_pVRDebug;
   5416 	IVRNotifications	*m_pVRNotifications;
   5417 };
   5418 
   5419 inline COpenVRContext &OpenVRInternal_ModuleContext()
   5420 {
   5421 	static void *ctx[ sizeof( COpenVRContext ) / sizeof( void * ) ];
   5422 	return *( COpenVRContext * )ctx; // bypass zero-init constructor
   5423 }
   5424 
   5425 inline IVRSystem *VR_CALLTYPE VRSystem() { return OpenVRInternal_ModuleContext().VRSystem(); }
   5426 inline IVRChaperone *VR_CALLTYPE VRChaperone() { return OpenVRInternal_ModuleContext().VRChaperone(); }
   5427 inline IVRChaperoneSetup *VR_CALLTYPE VRChaperoneSetup() { return OpenVRInternal_ModuleContext().VRChaperoneSetup(); }
   5428 inline IVRCompositor *VR_CALLTYPE VRCompositor() { return OpenVRInternal_ModuleContext().VRCompositor(); }
   5429 inline IVROverlay *VR_CALLTYPE VROverlay() { return OpenVRInternal_ModuleContext().VROverlay(); }
   5430 inline IVROverlayView *VR_CALLTYPE VROverlayView() { return OpenVRInternal_ModuleContext().VROverlayView(); }
   5431 inline IVRHeadsetView *VR_CALLTYPE VRHeadsetView() { return OpenVRInternal_ModuleContext().VRHeadsetView(); }
   5432 inline IVRScreenshots *VR_CALLTYPE VRScreenshots() { return OpenVRInternal_ModuleContext().VRScreenshots(); }
   5433 inline IVRRenderModels *VR_CALLTYPE VRRenderModels() { return OpenVRInternal_ModuleContext().VRRenderModels(); }
   5434 inline IVRApplications *VR_CALLTYPE VRApplications() { return OpenVRInternal_ModuleContext().VRApplications(); }
   5435 inline IVRSettings *VR_CALLTYPE VRSettings() { return OpenVRInternal_ModuleContext().VRSettings(); }
   5436 inline IVRResources *VR_CALLTYPE VRResources() { return OpenVRInternal_ModuleContext().VRResources(); }
   5437 inline IVRExtendedDisplay *VR_CALLTYPE VRExtendedDisplay() { return OpenVRInternal_ModuleContext().VRExtendedDisplay(); }
   5438 inline IVRTrackedCamera *VR_CALLTYPE VRTrackedCamera() { return OpenVRInternal_ModuleContext().VRTrackedCamera(); }
   5439 inline IVRDriverManager *VR_CALLTYPE VRDriverManager() { return OpenVRInternal_ModuleContext().VRDriverManager(); }
   5440 inline IVRInput *VR_CALLTYPE VRInput() { return OpenVRInternal_ModuleContext().VRInput(); }
   5441 inline IVRIOBuffer *VR_CALLTYPE VRIOBuffer() { return OpenVRInternal_ModuleContext().VRIOBuffer(); }
   5442 inline IVRSpatialAnchors *VR_CALLTYPE VRSpatialAnchors() { return OpenVRInternal_ModuleContext().VRSpatialAnchors(); }
   5443 inline IVRNotifications *VR_CALLTYPE VRNotifications() { return OpenVRInternal_ModuleContext().VRNotifications(); }
   5444 inline IVRDebug *VR_CALLTYPE VRDebug() { return OpenVRInternal_ModuleContext().VRDebug(); }
   5445 
   5446 inline void COpenVRContext::Clear()
   5447 {
   5448 	m_pVRSystem = nullptr;
   5449 	m_pVRChaperone = nullptr;
   5450 	m_pVRChaperoneSetup = nullptr;
   5451 	m_pVRCompositor = nullptr;
   5452 	m_pVROverlay = nullptr;
   5453 	m_pVROverlayView = nullptr;
   5454 	m_pVRHeadsetView = nullptr;
   5455 	m_pVRRenderModels = nullptr;
   5456 	m_pVRExtendedDisplay = nullptr;
   5457 	m_pVRSettings = nullptr;
   5458 	m_pVRApplications = nullptr;
   5459 	m_pVRTrackedCamera = nullptr;
   5460 	m_pVRResources = nullptr;
   5461 	m_pVRScreenshots = nullptr;
   5462 	m_pVRDriverManager = nullptr;
   5463 	m_pVRInput = nullptr;
   5464 	m_pVRIOBuffer = nullptr;
   5465 	m_pVRSpatialAnchors = nullptr;
   5466 	m_pVRNotifications = nullptr;
   5467 	m_pVRDebug = nullptr;
   5468 }
   5469 
   5470 VR_INTERFACE uint32_t VR_CALLTYPE VR_InitInternal2( EVRInitError *peError, EVRApplicationType eApplicationType, const char *pStartupInfo );
   5471 VR_INTERFACE void VR_CALLTYPE VR_ShutdownInternal();
   5472 
   5473 /** Finds the active installation of vrclient.dll and initializes it */
   5474 inline IVRSystem *VR_Init( EVRInitError *peError, EVRApplicationType eApplicationType, const char *pStartupInfo )
   5475 {
   5476 	IVRSystem *pVRSystem = nullptr;
   5477 
   5478 	EVRInitError eError;
   5479 	VRToken() = VR_InitInternal2( &eError, eApplicationType, pStartupInfo );
   5480 	COpenVRContext &ctx = OpenVRInternal_ModuleContext();
   5481 	ctx.Clear();
   5482 
   5483 	if ( eError == VRInitError_None )
   5484 	{
   5485 		if ( VR_IsInterfaceVersionValid( IVRSystem_Version ) )
   5486 		{
   5487 			pVRSystem = VRSystem();
   5488 		}
   5489 		else
   5490 		{
   5491 			VR_ShutdownInternal();
   5492 			eError = VRInitError_Init_InterfaceNotFound;
   5493 		}
   5494 	}
   5495 
   5496 	if ( peError )
   5497 		*peError = eError;
   5498 	return pVRSystem;
   5499 }
   5500 
   5501 /** unloads vrclient.dll. Any interface pointers from the interface are
   5502 * invalid after this point */
   5503 inline void VR_Shutdown()
   5504 {
   5505 	VR_ShutdownInternal();
   5506 }
   5507 
   5508 #endif // OPENVR_INTERFACE_INTERNAL
   5509 }