ovr_capi_dynamic.h (31597B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 /* This file contains just the needed struct definitions for 8 * interacting with the Oculus VR C API, without needing to #include 9 * OVR_CAPI.h directly. Note that it uses the same type names as the 10 * CAPI, and cannot be #included at the same time as OVR_CAPI.h. It 11 * does not include the entire C API, just want's needed. 12 */ 13 14 #ifdef OVR_CAPI_h 15 # ifdef _MSC_VER 16 # pragma message( \ 17 "ovr_capi_dyanmic.h: OVR_CAPI.h included before ovr_capi_dynamic.h, skipping this") 18 # else 19 # warning OVR_CAPI.h included before ovr_capi_dynamic.h, skipping this 20 # endif 21 # define mozilla_ovr_capi_dynamic_h_ 22 23 #else 24 25 # ifndef mozilla_ovr_capi_dynamic_h_ 26 # define mozilla_ovr_capi_dynamic_h_ 27 28 # ifdef HAVE_64BIT_BUILD 29 # define OVR_PTR_SIZE 8 30 # define OVR_ON64(x) x 31 # else 32 # define OVR_PTR_SIZE 4 33 # define OVR_ON64(x) /**/ 34 # endif 35 36 # if defined(_WIN32) 37 # define OVR_PFN __cdecl 38 # else 39 # define OVR_PFN 40 # endif 41 42 # if !defined(OVR_ALIGNAS) 43 # if defined(__GNUC__) || defined(__clang__) 44 # define OVR_ALIGNAS(n) __attribute__((aligned(n))) 45 # elif defined(_MSC_VER) || defined(__INTEL_COMPILER) 46 # define OVR_ALIGNAS(n) __declspec(align(n)) 47 # elif defined(__CC_ARM) 48 # define OVR_ALIGNAS(n) __align(n) 49 # else 50 # error Need to define OVR_ALIGNAS 51 # endif 52 # endif 53 54 # if !defined(OVR_UNUSED_STRUCT_PAD) 55 # define OVR_UNUSED_STRUCT_PAD(padName, size) char padName[size]; 56 # endif 57 58 # ifdef __cplusplus 59 extern "C" { 60 # endif 61 62 typedef int32_t ovrResult; 63 64 typedef enum { 65 ovrSuccess = 0, 66 } ovrSuccessType; 67 68 typedef char ovrBool; 69 typedef struct OVR_ALIGNAS(4) { 70 float r, g, b, a; 71 } ovrColorf; 72 typedef struct OVR_ALIGNAS(4) { 73 int x, y; 74 } ovrVector2i; 75 typedef struct OVR_ALIGNAS(4) { 76 int w, h; 77 } ovrSizei; 78 typedef struct OVR_ALIGNAS(4) { 79 ovrVector2i Pos; 80 ovrSizei Size; 81 } ovrRecti; 82 typedef struct OVR_ALIGNAS(4) { 83 float x, y, z, w; 84 } ovrQuatf; 85 typedef struct OVR_ALIGNAS(4) { 86 float x, y; 87 } ovrVector2f; 88 typedef struct OVR_ALIGNAS(4) { 89 float x, y, z; 90 } ovrVector3f; 91 typedef struct OVR_ALIGNAS(4) { 92 float M[4][4]; 93 } ovrMatrix4f; 94 95 typedef struct OVR_ALIGNAS(4) { 96 ovrQuatf Orientation; 97 ovrVector3f Position; 98 } ovrPosef; 99 100 typedef struct OVR_ALIGNAS(8) { 101 ovrPosef ThePose; 102 ovrVector3f AngularVelocity; 103 ovrVector3f LinearVelocity; 104 ovrVector3f AngularAcceleration; 105 ovrVector3f LinearAcceleration; 106 OVR_UNUSED_STRUCT_PAD(pad0, 4) 107 double TimeInSeconds; 108 } ovrPoseStatef; 109 110 typedef struct { 111 float UpTan; 112 float DownTan; 113 float LeftTan; 114 float RightTan; 115 } ovrFovPort; 116 117 typedef enum { 118 ovrHmd_None = 0, 119 ovrHmd_DK1 = 3, 120 ovrHmd_DKHD = 4, 121 ovrHmd_DK2 = 6, 122 ovrHmd_CB = 8, 123 ovrHmd_Other = 9, 124 ovrHmd_E3_2015 = 10, 125 ovrHmd_ES06 = 11, 126 ovrHmd_ES09 = 12, 127 ovrHmd_ES11 = 13, 128 ovrHmd_CV1 = 14, 129 ovrHmd_EnumSize = 0x7fffffff 130 } ovrHmdType; 131 132 typedef enum { 133 ovrHmdCap_DebugDevice = 0x0010, 134 ovrHmdCap_EnumSize = 0x7fffffff 135 } ovrHmdCaps; 136 137 typedef enum { 138 ovrTrackingCap_Orientation = 0x0010, 139 ovrTrackingCap_MagYawCorrection = 0x0020, 140 ovrTrackingCap_Position = 0x0040, 141 ovrTrackingCap_EnumSize = 0x7fffffff 142 } ovrTrackingCaps; 143 144 typedef enum { 145 ovrExtension_TextureLayout_Octilinear = 0, 146 ovrExtension_Count, 147 ovrExtension_EnumSize = 0x7fffffff 148 } ovrExtensions; 149 150 typedef enum { 151 ovrEye_Left = 0, 152 ovrEye_Right = 1, 153 ovrEye_Count = 2, 154 ovrEye_EnumSize = 0x7fffffff 155 } ovrEyeType; 156 157 typedef enum { 158 ovrTrackingOrigin_EyeLevel = 0, 159 ovrTrackingOrigin_FloorLevel = 1, 160 ovrTrackingOrigin_Count = 2, ///< \internal Count of enumerated elements. 161 ovrTrackingOrigin_EnumSize = 0x7fffffff ///< \internal Force type int32_t. 162 } ovrTrackingOrigin; 163 164 typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) { 165 char Reserved[8]; 166 } ovrGraphicsLuid; 167 168 typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) { 169 ovrHmdType Type; 170 OVR_ON64(OVR_UNUSED_STRUCT_PAD(pad0, 4)) 171 char ProductName[64]; 172 char Manufacturer[64]; 173 short VendorId; 174 short ProductId; 175 char SerialNumber[24]; 176 short FirmwareMajor; 177 short FirmwareMinor; 178 unsigned int AvailableHmdCaps; 179 unsigned int DefaultHmdCaps; 180 unsigned int AvailableTrackingCaps; 181 unsigned int DefaultTrackingCaps; 182 ovrFovPort DefaultEyeFov[ovrEye_Count]; 183 ovrFovPort MaxEyeFov[ovrEye_Count]; 184 ovrSizei Resolution; 185 float DisplayRefreshRate; 186 OVR_ON64(OVR_UNUSED_STRUCT_PAD(pad1, 4)) 187 } ovrHmdDesc; 188 189 typedef struct ovrHmdStruct* ovrSession; 190 191 # ifdef XP_WIN 192 typedef uint32_t ovrProcessId; 193 # else 194 typedef pid_t ovrProcessId; 195 # endif 196 197 typedef enum { 198 ovrStatus_OrientationTracked = 0x0001, 199 ovrStatus_PositionTracked = 0x0002, 200 ovrStatus_EnumSize = 0x7fffffff 201 } ovrStatusBits; 202 203 typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) { 204 float FrustumHFovInRadians; 205 float FrustumVFovInRadians; 206 float FrustumNearZInMeters; 207 float FrustumFarZInMeters; 208 } ovrTrackerDesc; 209 210 typedef enum { 211 ovrTracker_Connected = 0x0020, 212 ovrTracker_PoseTracked = 0x0004 213 } ovrTrackerFlags; 214 215 typedef struct OVR_ALIGNAS(8) { 216 unsigned int TrackerFlags; 217 ovrPosef Pose; 218 ovrPosef LeveledPose; 219 OVR_UNUSED_STRUCT_PAD(pad0, 4) 220 } ovrTrackerPose; 221 222 typedef struct OVR_ALIGNAS(8) { 223 ovrPoseStatef HeadPose; 224 unsigned int StatusFlags; 225 ovrPoseStatef HandPoses[2]; 226 unsigned int HandStatusFlags[2]; 227 ovrPosef CalibratedOrigin; 228 } ovrTrackingState; 229 230 typedef struct OVR_ALIGNAS(4) { 231 ovrEyeType Eye; 232 ovrFovPort Fov; 233 ovrRecti DistortedViewport; 234 ovrVector2f PixelsPerTanAngleAtCenter; 235 ovrPosef HmdToEyePose; 236 } ovrEyeRenderDesc; 237 238 typedef struct OVR_ALIGNAS(4) { 239 float Projection22; 240 float Projection23; 241 float Projection32; 242 } ovrTimewarpProjectionDesc; 243 244 typedef struct OVR_ALIGNAS(4) { 245 ovrPosef HmdToEyePose[ovrEye_Count]; 246 float HmdSpaceToWorldScaleInMeters; 247 } ovrViewScaleDesc; 248 249 typedef enum { 250 ovrTexture_2D, 251 ovrTexture_2D_External, 252 ovrTexture_Cube, 253 ovrTexture_Count, 254 ovrTexture_EnumSize = 0x7fffffff 255 } ovrTextureType; 256 257 typedef enum { 258 ovrTextureBind_None, 259 ovrTextureBind_DX_RenderTarget = 0x0001, 260 ovrTextureBind_DX_UnorderedAccess = 0x0002, 261 ovrTextureBind_DX_DepthStencil = 0x0004, 262 ovrTextureBind_EnumSize = 0x7fffffff 263 } ovrTextureBindFlags; 264 265 typedef enum { 266 OVR_FORMAT_UNKNOWN = 0, 267 OVR_FORMAT_B5G6R5_UNORM = 1, 268 OVR_FORMAT_B5G5R5A1_UNORM = 2, 269 OVR_FORMAT_B4G4R4A4_UNORM = 3, 270 OVR_FORMAT_R8G8B8A8_UNORM = 4, 271 OVR_FORMAT_R8G8B8A8_UNORM_SRGB = 5, 272 OVR_FORMAT_B8G8R8A8_UNORM = 6, 273 OVR_FORMAT_B8G8R8A8_UNORM_SRGB = 7, 274 OVR_FORMAT_B8G8R8X8_UNORM = 8, 275 OVR_FORMAT_B8G8R8X8_UNORM_SRGB = 9, 276 OVR_FORMAT_R16G16B16A16_FLOAT = 10, 277 OVR_FORMAT_R11G11B10_FLOAT = 25, 278 OVR_FORMAT_D16_UNORM = 11, 279 OVR_FORMAT_D24_UNORM_S8_UINT = 12, 280 OVR_FORMAT_D32_FLOAT = 13, 281 OVR_FORMAT_D32_FLOAT_S8X24_UINT = 14, 282 OVR_FORMAT_BC1_UNORM = 15, 283 OVR_FORMAT_BC1_UNORM_SRGB = 16, 284 OVR_FORMAT_BC2_UNORM = 17, 285 OVR_FORMAT_BC2_UNORM_SRGB = 18, 286 OVR_FORMAT_BC3_UNORM = 19, 287 OVR_FORMAT_BC3_UNORM_SRGB = 20, 288 OVR_FORMAT_BC6H_UF16 = 21, 289 OVR_FORMAT_BC6H_SF16 = 22, 290 OVR_FORMAT_BC7_UNORM = 23, 291 OVR_FORMAT_BC7_UNORM_SRGB = 24, 292 293 OVR_FORMAT_ENUMSIZE = 0x7fffffff 294 } ovrTextureFormat; 295 296 typedef enum { 297 ovrTextureMisc_None, 298 ovrTextureMisc_DX_Typeless = 0x0001, 299 ovrTextureMisc_AllowGenerateMips = 0x0002, 300 ovrTextureMisc_ProtectedContent = 0x0004, 301 ovrTextureMisc_AutoGenerateMips = 0x0008, 302 ovrTextureMisc_EnumSize = 0x7fffffff 303 } ovrTextureFlags; 304 305 typedef struct { 306 ovrTextureType Type; 307 ovrTextureFormat Format; 308 int ArraySize; 309 int Width; 310 int Height; 311 int MipLevels; 312 int SampleCount; 313 ovrBool StaticImage; 314 unsigned int MiscFlags; 315 unsigned int BindFlags; 316 } ovrTextureSwapChainDesc; 317 318 typedef struct { 319 ovrTextureFormat Format; 320 int Width; 321 int Height; 322 unsigned int MiscFlags; 323 unsigned int MirrorOptions; 324 } ovrMirrorTextureDesc; 325 326 typedef struct ovrTextureSwapChainData* ovrTextureSwapChain; 327 typedef struct ovrMirrorTextureData* ovrMirrorTexture; 328 329 typedef enum { 330 ovrButton_A = 0x00000001, 331 ovrButton_B = 0x00000002, 332 ovrButton_RThumb = 0x00000004, 333 ovrButton_RShoulder = 0x00000008, 334 ovrButton_X = 0x00000100, 335 ovrButton_Y = 0x00000200, 336 ovrButton_LThumb = 0x00000400, 337 ovrButton_LShoulder = 0x00000800, 338 ovrButton_Up = 0x00010000, 339 ovrButton_Down = 0x00020000, 340 ovrButton_Left = 0x00040000, 341 ovrButton_Right = 0x00080000, 342 ovrButton_Enter = 0x00100000, 343 ovrButton_Back = 0x00200000, 344 ovrButton_VolUp = 0x00400000, 345 ovrButton_VolDown = 0x00800000, 346 ovrButton_Home = 0x01000000, 347 ovrButton_Private = ovrButton_VolUp | ovrButton_VolDown | ovrButton_Home, 348 ovrButton_RMask = 349 ovrButton_A | ovrButton_B | ovrButton_RThumb | ovrButton_RShoulder, 350 ovrButton_LMask = ovrButton_X | ovrButton_Y | ovrButton_LThumb | 351 ovrButton_LShoulder | ovrButton_Enter, 352 ovrButton_EnumSize = 0x7fffffff 353 } ovrButton; 354 355 typedef enum { 356 ovrTouch_A = ovrButton_A, 357 ovrTouch_B = ovrButton_B, 358 ovrTouch_RThumb = ovrButton_RThumb, 359 ovrTouch_RThumbRest = 0x00000008, 360 ovrTouch_RIndexTrigger = 0x00000010, 361 ovrTouch_RButtonMask = ovrTouch_A | ovrTouch_B | ovrTouch_RThumb | 362 ovrTouch_RThumbRest | ovrTouch_RIndexTrigger, 363 ovrTouch_X = ovrButton_X, 364 ovrTouch_Y = ovrButton_Y, 365 ovrTouch_LThumb = ovrButton_LThumb, 366 ovrTouch_LThumbRest = 0x00000800, 367 ovrTouch_LIndexTrigger = 0x00001000, 368 ovrTouch_LButtonMask = ovrTouch_X | ovrTouch_Y | ovrTouch_LThumb | 369 ovrTouch_LThumbRest | ovrTouch_LIndexTrigger, 370 ovrTouch_RIndexPointing = 0x00000020, 371 ovrTouch_RThumbUp = 0x00000040, 372 ovrTouch_LIndexPointing = 0x00002000, 373 ovrTouch_LThumbUp = 0x00004000, 374 ovrTouch_RPoseMask = ovrTouch_RIndexPointing | ovrTouch_RThumbUp, 375 ovrTouch_LPoseMask = ovrTouch_LIndexPointing | ovrTouch_LThumbUp, 376 ovrTouch_EnumSize = 0x7fffffff 377 } ovrTouch; 378 379 typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) { 380 int SampleRateHz; 381 int SampleSizeInBytes; 382 int QueueMinSizeToAvoidStarvation; 383 int SubmitMinSamples; 384 int SubmitMaxSamples; 385 int SubmitOptimalSamples; 386 } ovrTouchHapticsDesc; 387 388 typedef enum { 389 ovrControllerType_None = 0x0000, 390 ovrControllerType_LTouch = 0x0001, 391 ovrControllerType_RTouch = 0x0002, 392 ovrControllerType_Touch = 393 (ovrControllerType_LTouch | ovrControllerType_RTouch), 394 ovrControllerType_Remote = 0x0004, 395 ovrControllerType_XBox = 0x0010, 396 ovrControllerType_Object0 = 0x0100, 397 ovrControllerType_Object1 = 0x0200, 398 ovrControllerType_Object2 = 0x0400, 399 ovrControllerType_Object3 = 0x0800, 400 ovrControllerType_Active = 0xffffffff, 401 ovrControllerType_EnumSize = 0x7fffffff 402 } ovrControllerType; 403 404 typedef enum { ovrHapticsBufferSubmit_Enqueue } ovrHapticsBufferSubmitMode; 405 406 # define OVR_HAPTICS_BUFFER_SAMPLES_MAX 256 407 408 typedef struct { 409 const void* Samples; 410 int SamplesCount; 411 ovrHapticsBufferSubmitMode SubmitMode; 412 } ovrHapticsBuffer; 413 414 typedef struct { 415 int RemainingQueueSpace; 416 int SamplesQueued; 417 } ovrHapticsPlaybackState; 418 419 typedef enum { 420 ovrTrackedDevice_None = 0x0000, 421 ovrTrackedDevice_HMD = 0x0001, 422 ovrTrackedDevice_LTouch = 0x0002, 423 ovrTrackedDevice_RTouch = 0x0004, 424 ovrTrackedDevice_Touch = (ovrTrackedDevice_LTouch | ovrTrackedDevice_RTouch), 425 ovrTrackedDevice_Object0 = 0x0010, 426 ovrTrackedDevice_Object1 = 0x0020, 427 ovrTrackedDevice_Object2 = 0x0040, 428 ovrTrackedDevice_Object3 = 0x0080, 429 ovrTrackedDevice_All = 0xFFFF, 430 } ovrTrackedDeviceType; 431 432 typedef enum { 433 ovrBoundary_Outer = 0x0001, 434 ovrBoundary_PlayArea = 0x0100, 435 } ovrBoundaryType; 436 437 typedef struct { 438 ovrColorf Color; 439 } ovrBoundaryLookAndFeel; 440 441 typedef struct { 442 ovrBool IsTriggering; 443 float ClosestDistance; 444 ovrVector3f ClosestPoint; 445 ovrVector3f ClosestPointNormal; 446 } ovrBoundaryTestResult; 447 448 typedef enum { 449 ovrHand_Left = 0, 450 ovrHand_Right = 1, 451 ovrHand_Count = 2, 452 ovrHand_EnumSize = 0x7fffffff 453 } ovrHandType; 454 455 typedef struct { 456 double TimeInSeconds; 457 unsigned int Buttons; 458 unsigned int Touches; 459 float IndexTrigger[ovrHand_Count]; 460 float HandTrigger[ovrHand_Count]; 461 ovrVector2f Thumbstick[ovrHand_Count]; 462 ovrControllerType ControllerType; 463 float IndexTriggerNoDeadzone[ovrHand_Count]; 464 float HandTriggerNoDeadzone[ovrHand_Count]; 465 ovrVector2f ThumbstickNoDeadzone[ovrHand_Count]; 466 float IndexTriggerRaw[ovrHand_Count]; 467 float HandTriggerRaw[ovrHand_Count]; 468 ovrVector2f ThumbstickRaw[ovrHand_Count]; 469 } ovrInputState; 470 471 typedef struct { 472 double LastChangedTime; 473 ovrFovPort FOVPort; 474 float VirtualNearPlaneDistanceMeters; 475 float VirtualFarPlaneDistanceMeters; 476 ovrSizei ImageSensorPixelResolution; 477 ovrMatrix4f LensDistortionMatrix; 478 double ExposurePeriodSeconds; 479 double ExposureDurationSeconds; 480 } ovrCameraIntrinsics; 481 482 typedef enum { 483 ovrCameraStatus_None = 0x0, 484 ovrCameraStatus_Connected = 0x1, 485 ovrCameraStatus_Calibrating = 0x2, 486 ovrCameraStatus_CalibrationFailed = 0x4, 487 ovrCameraStatus_Calibrated = 0x8, 488 ovrCameraStatus_EnumSize = 0x7fffffff 489 } ovrCameraStatusFlags; 490 491 typedef struct { 492 double LastChangedTimeSeconds; 493 unsigned int CameraStatusFlags; 494 ovrTrackedDeviceType AttachedToDevice; 495 ovrPosef RelativePose; 496 double LastExposureTimeSeconds; 497 double ExposureLatencySeconds; 498 double AdditionalLatencySeconds; 499 } ovrCameraExtrinsics; 500 501 # define OVR_EXTERNAL_CAMERA_NAME_SIZE 32 502 typedef struct { 503 char Name[OVR_EXTERNAL_CAMERA_NAME_SIZE]; 504 ovrCameraIntrinsics Intrinsics; 505 ovrCameraExtrinsics Extrinsics; 506 } ovrExternalCamera; 507 508 typedef enum { 509 ovrInit_Debug = 0x00000001, 510 ovrInit_RequestVersion = 0x00000004, 511 ovrInit_Invisible = 0x00000010, 512 ovrInit_MixedRendering = 0x00000020, 513 ovrInit_FocusAware = 0x00000040, 514 ovrinit_WritableBits = 0x00ffffff, 515 ovrInit_EnumSize = 0x7fffffff 516 } ovrInitFlags; 517 518 typedef enum { 519 ovrLogLevel_Debug = 0, 520 ovrLogLevel_Info = 1, 521 ovrLogLevel_Error = 2, 522 ovrLogLevel_EnumSize = 0x7fffffff 523 } ovrLogLevel; 524 525 typedef void(OVR_PFN* ovrLogCallback)(uintptr_t userData, int level, 526 const char* message); 527 528 typedef struct OVR_ALIGNAS(8) { 529 uint32_t Flags; 530 uint32_t RequestedMinorVersion; 531 ovrLogCallback LogCallback; 532 uintptr_t UserData; 533 uint32_t ConnectionTimeoutMS; 534 OVR_ON64(OVR_UNUSED_STRUCT_PAD(pad0, 4)) 535 } ovrInitParams; 536 537 typedef ovrResult(OVR_PFN* pfn_ovr_Initialize)(const ovrInitParams* params); 538 typedef void(OVR_PFN* pfn_ovr_Shutdown)(); 539 540 typedef struct { 541 ovrResult Result; 542 char ErrorString[512]; 543 } ovrErrorInfo; 544 545 typedef void(OVR_PFN* pfn_ovr_GetLastErrorInfo)(ovrErrorInfo* errorInfo); 546 typedef const char*(OVR_PFN* pfn_ovr_GetVersionString)(); 547 typedef int(OVR_PFN* pfn_ovr_TraceMessage)(int level, const char* message); 548 typedef ovrResult(OVR_PFN* pfn_ovr_IdentifyClient)(const char* identity); 549 typedef ovrHmdDesc(OVR_PFN* pfn_ovr_GetHmdDesc)(ovrSession session); 550 typedef unsigned int(OVR_PFN* pfn_ovr_GetTrackerCount)(ovrSession session); 551 typedef ovrTrackerDesc(OVR_PFN* pfn_ovr_GetTrackerDesc)( 552 ovrSession session, unsigned int trackerDescIndex); 553 typedef ovrResult(OVR_PFN* pfn_ovr_Create)(ovrSession* pSession, 554 ovrGraphicsLuid* pLuid); 555 typedef void(OVR_PFN* pfn_ovr_Destroy)(ovrSession session); 556 557 typedef struct { 558 ovrBool IsVisible; 559 ovrBool HmdPresent; 560 ovrBool HmdMounted; 561 ovrBool DisplayLost; 562 ovrBool ShouldQuit; 563 ovrBool ShouldRecenter; 564 ovrBool HasInputFocus; 565 ovrBool OverlayPresent; 566 } ovrSessionStatus; 567 568 typedef ovrResult(OVR_PFN* pfn_ovr_GetSessionStatus)( 569 ovrSession session, ovrSessionStatus* sessionStatus); 570 typedef ovrResult(OVR_PFN* pfn_ovr_IsExtensionSupported)( 571 ovrSession session, ovrExtensions extension, 572 ovrBool* outExtensionSupported); 573 typedef ovrResult(OVR_PFN* pfn_ovr_EnableExtension)(ovrSession session, 574 ovrExtensions extension); 575 typedef ovrResult(OVR_PFN* pfn_ovr_SetTrackingOriginType)( 576 ovrSession session, ovrTrackingOrigin origin); 577 typedef ovrTrackingOrigin(OVR_PFN* pfn_ovr_GetTrackingOriginType)( 578 ovrSession session); 579 typedef ovrResult(OVR_PFN* pfn_ovr_RecenterTrackingOrigin)(ovrSession session); 580 typedef ovrResult(OVR_PFN* pfn_ovr_SpecifyTrackingOrigin)(ovrSession session, 581 ovrPosef originPose); 582 typedef void(OVR_PFN* pfn_ovr_ClearShouldRecenterFlag)(ovrSession session); 583 typedef ovrTrackingState(OVR_PFN* pfn_ovr_GetTrackingState)( 584 ovrSession session, double absTime, ovrBool latencyMarker); 585 typedef ovrResult(OVR_PFN* pfn_ovr_GetDevicePoses)( 586 ovrSession session, ovrTrackedDeviceType* deviceTypes, int deviceCount, 587 double absTime, ovrPoseStatef* outDevicePoses); 588 typedef ovrTrackerPose(OVR_PFN* pfn_ovr_GetTrackerPose)( 589 ovrSession session, unsigned int trackerPoseIndex); 590 typedef ovrResult(OVR_PFN* pfn_ovr_GetInputState)( 591 ovrSession session, ovrControllerType controllerType, 592 ovrInputState* inputState); 593 typedef unsigned int(OVR_PFN* pfn_ovr_GetConnectedControllerTypes)( 594 ovrSession session); 595 typedef ovrTouchHapticsDesc(OVR_PFN* pfn_ovr_GetTouchHapticsDesc)( 596 ovrSession session, ovrControllerType controllerType); 597 typedef ovrResult(OVR_PFN* pfn_ovr_SetControllerVibration)( 598 ovrSession session, ovrControllerType controllerType, float frequency, 599 float amplitude); 600 typedef ovrResult(OVR_PFN* pfn_ovr_SubmitControllerVibration)( 601 ovrSession session, ovrControllerType controllerType, 602 const ovrHapticsBuffer* buffer); 603 typedef ovrResult(OVR_PFN* pfn_ovr_GetControllerVibrationState)( 604 ovrSession session, ovrControllerType controllerType, 605 ovrHapticsPlaybackState* outState); 606 typedef ovrResult(OVR_PFN* pfn_ovr_TestBoundary)( 607 ovrSession session, ovrTrackedDeviceType deviceBitmask, 608 ovrBoundaryType boundaryType, ovrBoundaryTestResult* outTestResult); 609 typedef ovrResult(OVR_PFN* pfn_ovr_TestBoundaryPoint)( 610 ovrSession session, const ovrVector3f* point, 611 ovrBoundaryType singleBoundaryType, ovrBoundaryTestResult* outTestResult); 612 typedef ovrResult(OVR_PFN* pfn_ovr_SetBoundaryLookAndFeel)( 613 ovrSession session, const ovrBoundaryLookAndFeel* lookAndFeel); 614 typedef ovrResult(OVR_PFN* pfn_ovr_ResetBoundaryLookAndFeel)( 615 ovrSession session); 616 typedef ovrResult(OVR_PFN* pfn_ovr_GetBoundaryGeometry)( 617 ovrSession session, ovrBoundaryType boundaryType, 618 ovrVector3f* outFloorPoints, int* outFloorPointsCount); 619 typedef ovrResult(OVR_PFN* pfn_ovr_GetBoundaryDimensions)( 620 ovrSession session, ovrBoundaryType boundaryType, 621 ovrVector3f* outDimensions); 622 typedef ovrResult(OVR_PFN* pfn_ovr_GetBoundaryVisible)(ovrSession session, 623 ovrBool* outIsVisible); 624 typedef ovrResult(OVR_PFN* pfn_ovr_RequestBoundaryVisible)(ovrSession session, 625 ovrBool visible); 626 627 enum { ovrMaxLayerCount = 16 }; 628 629 typedef enum { 630 ovrLayerType_Disabled = 0, 631 ovrLayerType_EyeFov = 1, 632 ovrLayerType_Quad = 3, 633 ovrLayerType_EyeMatrix = 5, 634 ovrLayerType_EyeFovMultires = 7, 635 ovrLayerType_Cube = 10, 636 ovrLayerType_EnumSize = 0x7fffffff 637 } ovrLayerType; 638 639 typedef enum { 640 ovrLayerFlag_HighQuality = 0x01, 641 ovrLayerFlag_TextureOriginAtBottomLeft = 0x02, 642 ovrLayerFlag_HeadLocked = 0x04 643 } ovrLayerFlags; 644 645 typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) { 646 ovrLayerType Type; 647 unsigned Flags; 648 } ovrLayerHeader; 649 650 typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) { 651 ovrLayerHeader Header; 652 ovrTextureSwapChain ColorTexture[ovrEye_Count]; 653 ovrRecti Viewport[ovrEye_Count]; 654 ovrFovPort Fov[ovrEye_Count]; 655 ovrPosef RenderPose[ovrEye_Count]; 656 double SensorSampleTime; 657 } ovrLayerEyeFov; 658 659 typedef enum { 660 ovrTextureLayout_Rectilinear = 0, 661 ovrTextureLayout_Octilinear = 1, 662 ovrTextureLayout_EnumSize = 0x7fffffff 663 } ovrTextureLayout; 664 665 typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) { 666 float WarpLeft; 667 float WarpRight; 668 float WarpUp; 669 float WarpDown; 670 float SizeLeft; 671 float SizeRight; 672 float SizeUp; 673 float SizeDown; 674 675 } ovrTextureLayoutOctilinear; 676 677 typedef union OVR_ALIGNAS(OVR_PTR_SIZE) { 678 ovrTextureLayoutOctilinear Octilinear[ovrEye_Count]; 679 } ovrTextureLayoutDesc_Union; 680 681 typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) { 682 ovrLayerHeader Header; 683 ovrTextureSwapChain ColorTexture[ovrEye_Count]; 684 ovrRecti Viewport[ovrEye_Count]; 685 ovrFovPort Fov[ovrEye_Count]; 686 ovrPosef RenderPose[ovrEye_Count]; 687 double SensorSampleTime; 688 ovrTextureLayout TextureLayout; 689 ovrTextureLayoutDesc_Union TextureLayoutDesc; 690 } ovrLayerEyeFovMultires; 691 692 typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) { 693 ovrLayerHeader Header; 694 ovrTextureSwapChain ColorTexture[ovrEye_Count]; 695 ovrRecti Viewport[ovrEye_Count]; 696 ovrPosef RenderPose[ovrEye_Count]; 697 ovrMatrix4f Matrix[ovrEye_Count]; 698 double SensorSampleTime; 699 } ovrLayerEyeMatrix; 700 701 typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) { 702 ovrLayerHeader Header; 703 ovrTextureSwapChain ColorTexture; 704 ovrRecti Viewport; 705 ovrPosef QuadPoseCenter; 706 ovrVector2f QuadSize; 707 } ovrLayerQuad; 708 709 typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) { 710 ovrLayerHeader Header; 711 ovrQuatf Orientation; 712 ovrTextureSwapChain CubeMapTexture; 713 } ovrLayerCube; 714 715 typedef union { 716 ovrLayerHeader Header; 717 ovrLayerEyeFov EyeFov; 718 ovrLayerQuad Quad; 719 ovrLayerEyeFovMultires Multires; 720 ovrLayerCube Cube; 721 } ovrLayer_Union; 722 723 typedef ovrResult(OVR_PFN* pfn_ovr_GetTextureSwapChainLength)( 724 ovrSession session, ovrTextureSwapChain chain, int* out_Length); 725 typedef ovrResult(OVR_PFN* pfn_ovr_GetTextureSwapChainCurrentIndex)( 726 ovrSession session, ovrTextureSwapChain chain, int* out_Index); 727 typedef ovrResult(OVR_PFN* pfn_ovr_GetTextureSwapChainDesc)( 728 ovrSession session, ovrTextureSwapChain chain, 729 ovrTextureSwapChainDesc* out_Desc); 730 typedef ovrResult(OVR_PFN* pfn_ovr_CommitTextureSwapChain)( 731 ovrSession session, ovrTextureSwapChain chain); 732 typedef void(OVR_PFN* pfn_ovr_DestroyTextureSwapChain)( 733 ovrSession session, ovrTextureSwapChain chain); 734 typedef void(OVR_PFN* pfn_ovr_DestroyMirrorTexture)( 735 ovrSession session, ovrMirrorTexture mirrorTexture); 736 typedef ovrSizei(OVR_PFN* pfn_ovr_GetFovTextureSize)( 737 ovrSession session, ovrEyeType eye, ovrFovPort fov, 738 float pixelsPerDisplayPixel); 739 typedef ovrEyeRenderDesc(OVR_PFN* pfn_ovr_GetRenderDesc2)(ovrSession session, 740 ovrEyeType eyeType, 741 ovrFovPort fov); 742 typedef ovrResult(OVR_PFN* pfn_ovr_WaitToBeginFrame)(ovrSession session, 743 long long frameIndex); 744 typedef ovrResult(OVR_PFN* pfn_ovr_BeginFrame)(ovrSession session, 745 long long frameIndex); 746 typedef ovrResult(OVR_PFN* pfn_ovr_EndFrame)( 747 ovrSession session, long long frameIndex, 748 const ovrViewScaleDesc* viewScaleDesc, 749 ovrLayerHeader const* const* layerPtrList, unsigned int layerCount); 750 typedef ovrResult(OVR_PFN* pfn_ovr_SubmitFrame)( 751 ovrSession session, long long frameIndex, 752 const ovrViewScaleDesc* viewScaleDesc, 753 ovrLayerHeader const* const* layerPtrList, unsigned int layerCount); 754 755 typedef struct OVR_ALIGNAS(4) { 756 int HmdVsyncIndex; 757 int AppFrameIndex; 758 int AppDroppedFrameCount; 759 float AppMotionToPhotonLatency; 760 float AppQueueAheadTime; 761 float AppCpuElapsedTime; 762 float AppGpuElapsedTime; 763 int CompositorFrameIndex; 764 int CompositorDroppedFrameCount; 765 float CompositorLatency; 766 float CompositorCpuElapsedTime; 767 float CompositorGpuElapsedTime; 768 float CompositorCpuStartToGpuEndElapsedTime; 769 float CompositorGpuEndToVsyncElapsedTime; 770 ovrBool AswIsActive; 771 int AswActivatedToggleCount; 772 int AswPresentedFrameCount; 773 int AswFailedFrameCount; 774 } ovrPerfStatsPerCompositorFrame; 775 776 enum { ovrMaxProvidedFrameStats = 5 }; 777 778 typedef struct OVR_ALIGNAS(4) { 779 ovrPerfStatsPerCompositorFrame FrameStats[ovrMaxProvidedFrameStats]; 780 int FrameStatsCount; 781 ovrBool AnyFrameStatsDropped; 782 float AdaptiveGpuPerformanceScale; 783 ovrBool AswIsAvailable; 784 ovrProcessId VisibleProcessId; 785 } ovrPerfStats; 786 787 typedef ovrResult(OVR_PFN* pfn_ovr_GetPerfStats)(ovrSession session, 788 ovrPerfStats* outStats); 789 typedef ovrResult(OVR_PFN* pfn_ovr_ResetPerfStats)(ovrSession session); 790 typedef double(OVR_PFN* pfn_ovr_GetPredictedDisplayTime)(ovrSession session, 791 long long frameIndex); 792 typedef double(OVR_PFN* pfn_ovr_GetTimeInSeconds)(); 793 794 typedef enum { 795 ovrPerfHud_Off = 0, 796 ovrPerfHud_PerfSummary = 1, 797 ovrPerfHud_LatencyTiming = 2, 798 ovrPerfHud_AppRenderTiming = 3, 799 ovrPerfHud_CompRenderTiming = 4, 800 ovrPerfHud_AswStats = 6, 801 ovrPerfHud_VersionInfo = 5, 802 ovrPerfHud_Count = 7, 803 ovrPerfHud_EnumSize = 0x7fffffff 804 } ovrPerfHudMode; 805 806 typedef enum { 807 ovrLayerHud_Off = 0, 808 ovrLayerHud_Info = 1, 809 ovrLayerHud_EnumSize = 0x7fffffff 810 } ovrLayerHudMode; 811 812 typedef enum { 813 ovrDebugHudStereo_Off = 0, 814 ovrDebugHudStereo_Quad = 1, 815 ovrDebugHudStereo_QuadWithCrosshair = 2, 816 ovrDebugHudStereo_CrosshairAtInfinity = 3, 817 ovrDebugHudStereo_Count, 818 ovrDebugHudStereo_EnumSize = 0x7fffffff 819 } ovrDebugHudStereoMode; 820 821 typedef ovrBool(OVR_PFN* pfn_ovr_GetBool)(ovrSession session, 822 const char* propertyName, 823 ovrBool defaultVal); 824 typedef ovrBool(OVR_PFN* pfn_ovr_SetBool)(ovrSession session, 825 const char* propertyName, 826 ovrBool value); 827 typedef int(OVR_PFN* pfn_ovr_GetInt)(ovrSession session, 828 const char* propertyName, int defaultVal); 829 typedef ovrBool(OVR_PFN* pfn_ovr_SetInt)(ovrSession session, 830 const char* propertyName, int value); 831 typedef float(OVR_PFN* pfn_ovr_GetFloat)(ovrSession session, 832 const char* propertyName, 833 float defaultVal); 834 typedef ovrBool(OVR_PFN* pfn_ovr_SetFloat)(ovrSession session, 835 const char* propertyName, 836 float value); 837 typedef unsigned int(OVR_PFN* pfn_ovr_GetFloatArray)( 838 ovrSession session, const char* propertyName, float values[], 839 unsigned int valuesCapacity); 840 typedef ovrBool(OVR_PFN* pfn_ovr_SetFloatArray)(ovrSession session, 841 const char* propertyName, 842 const float values[], 843 unsigned int valuesSize); 844 typedef const char*(OVR_PFN* pfn_ovr_GetString)(ovrSession session, 845 const char* propertyName, 846 const char* defaultVal); 847 typedef ovrBool(OVR_PFN* pfn_ovr_SetString)(ovrSession session, 848 const char* propertyName, 849 const char* value); 850 851 typedef ovrResult(OVR_PFN* pfn_ovr_GetExternalCameras)( 852 ovrSession session, ovrExternalCamera* cameras, 853 unsigned int* inoutCameraCount); 854 typedef ovrResult(OVR_PFN* pfn_ovr_SetExternalCameraProperties)( 855 ovrSession session, const char* name, 856 const ovrCameraIntrinsics* const intrinsics, 857 const ovrCameraExtrinsics* const extrinsics); 858 859 typedef enum { 860 ovrSuccess_NotVisible = 1000, 861 ovrSuccess_BoundaryInvalid = 1001, 862 ovrSuccess_DeviceUnavailable = 1002, 863 } ovrSuccessTypes; 864 865 typedef enum { 866 ovrError_MemoryAllocationFailure = -1000, 867 ovrError_InvalidSession = -1002, 868 ovrError_Timeout = -1003, 869 ovrError_NotInitialized = -1004, 870 ovrError_InvalidParameter = -1005, 871 ovrError_ServiceError = -1006, 872 ovrError_NoHmd = -1007, 873 ovrError_Unsupported = -1009, 874 ovrError_DeviceUnavailable = -1010, 875 ovrError_InvalidHeadsetOrientation = -1011, 876 ovrError_ClientSkippedDestroy = -1012, 877 ovrError_ClientSkippedShutdown = -1013, 878 ovrError_ServiceDeadlockDetected = -1014, 879 ovrError_InvalidOperation = -1015, 880 ovrError_InsufficientArraySize = -1016, 881 ovrError_NoExternalCameraInfo = -1017, 882 ovrError_LostTracking = -1018, 883 ovrError_AudioDeviceNotFound = -2001, 884 ovrError_AudioComError = -2002, 885 ovrError_Initialize = -3000, 886 ovrError_LibLoad = -3001, 887 ovrError_LibVersion = -3002, 888 ovrError_ServiceConnection = -3003, 889 ovrError_ServiceVersion = -3004, 890 ovrError_IncompatibleOS = -3005, 891 ovrError_DisplayInit = -3006, 892 ovrError_ServerStart = -3007, 893 ovrError_Reinitialization = -3008, 894 ovrError_MismatchedAdapters = -3009, 895 ovrError_LeakingResources = -3010, 896 ovrError_ClientVersion = -3011, 897 ovrError_OutOfDateOS = -3012, 898 ovrError_OutOfDateGfxDriver = -3013, 899 ovrError_IncompatibleGPU = -3014, 900 ovrError_NoValidVRDisplaySystem = -3015, 901 ovrError_Obsolete = -3016, 902 ovrError_DisabledOrDefaultAdapter = -3017, 903 ovrError_HybridGraphicsNotSupported = -3018, 904 ovrError_DisplayManagerInit = -3019, 905 ovrError_TrackerDriverInit = -3020, 906 ovrError_LibSignCheck = -3021, 907 ovrError_LibPath = -3022, 908 ovrError_LibSymbols = -3023, 909 ovrError_RemoteSession = -3024, 910 ovrError_InitializeVulkan = -3025, 911 ovrError_DisplayLost = -6000, 912 ovrError_TextureSwapChainFull = -6001, 913 ovrError_TextureSwapChainInvalid = -6002, 914 ovrError_GraphicsDeviceReset = -6003, 915 ovrError_DisplayRemoved = -6004, 916 ovrError_ContentProtectionNotAvailable = -6005, 917 ovrError_ApplicationInvisible = -6006, 918 ovrError_Disallowed = -6007, 919 ovrError_DisplayPluggedIncorrectly = -6008, 920 ovrError_RuntimeException = -7000, 921 ovrError_NoCalibration = -9000, 922 ovrError_OldVersion = -9001, 923 ovrError_MisformattedBlock = -9002, 924 } ovrErrorType; 925 926 # ifdef XP_WIN 927 928 struct IUnknown; 929 930 typedef ovrResult(OVR_PFN* pfn_ovr_CreateTextureSwapChainDX)( 931 ovrSession session, IUnknown* d3dPtr, const ovrTextureSwapChainDesc* desc, 932 ovrTextureSwapChain* out_TextureSwapChain); 933 934 typedef ovrResult(OVR_PFN* pfn_ovr_GetTextureSwapChainBufferDX)( 935 ovrSession session, ovrTextureSwapChain chain, int index, IID iid, 936 void** out_Buffer); 937 938 typedef ovrResult(OVR_PFN* pfn_ovr_CreateMirrorTextureDX)( 939 ovrSession session, IUnknown* d3dPtr, const ovrMirrorTextureDesc* desc, 940 ovrMirrorTexture* out_MirrorTexture); 941 942 typedef ovrResult(OVR_PFN* pfn_ovr_GetMirrorTextureBufferDX)( 943 ovrSession session, ovrMirrorTexture mirrorTexture, IID iid, 944 void** out_Buffer); 945 946 # endif 947 948 typedef ovrResult(OVR_PFN* pfn_ovr_CreateTextureSwapChainGL)( 949 ovrSession session, const ovrTextureSwapChainDesc* desc, 950 ovrTextureSwapChain* out_TextureSwapChain); 951 952 typedef ovrResult(OVR_PFN* pfn_ovr_GetTextureSwapChainBufferGL)( 953 ovrSession session, ovrTextureSwapChain chain, int index, 954 unsigned int* out_TexId); 955 956 typedef ovrResult(OVR_PFN* pfn_ovr_CreateMirrorTextureGL)( 957 ovrSession session, const ovrMirrorTextureDesc* desc, 958 ovrMirrorTexture* out_MirrorTexture); 959 960 typedef ovrResult(OVR_PFN* pfn_ovr_GetMirrorTextureBufferGL)( 961 ovrSession session, ovrMirrorTexture mirrorTexture, 962 unsigned int* out_TexId); 963 964 # define OVR_KEY_EYE_HEIGHT "EyeHeight" // float meters 965 # define OVR_DEFAULT_EYE_HEIGHT 1.675f 966 967 # if !defined(OVR_SUCCESS) 968 # define OVR_SUCCESS(result) (result >= 0) 969 # endif 970 971 # if !defined(OVR_UNQUALIFIED_SUCCESS) 972 # define OVR_UNQUALIFIED_SUCCESS(result) (result == ovrSuccess) 973 # endif 974 975 # if !defined(OVR_FAILURE) 976 # define OVR_FAILURE(result) (!OVR_SUCCESS(result)) 977 # endif 978 979 # ifdef __cplusplus 980 } 981 # endif 982 983 # endif /* mozilla_ovr_capi_dynamic_h_ */ 984 #endif /* OVR_CAPI_h */