Bug 1149781; Update Oculus runtime for new SDK 0.5; r=jrmuizel
authorVladimir Vukicevic <vladimir@pobox.com>
Wed, 01 Apr 2015 16:02:21 -0400
changeset 237099 43cbc390f436afdb710fe41b602cbf9b51add6cc
parent 237098 4e41289e4c38754f14d632dbed43a84799864e58
child 237100 eac9e907082ac8282c87136e9f3f36f883a5bd70
push idunknown
push userunknown
push dateunknown
reviewersjrmuizel
bugs1149781
milestone40.0a1
Bug 1149781; Update Oculus runtime for new SDK 0.5; r=jrmuizel
gfx/vr/gfxVROculus.cpp
gfx/vr/ovr_capi_dynamic.h
--- a/gfx/vr/gfxVROculus.cpp
+++ b/gfx/vr/gfxVROculus.cpp
@@ -51,79 +51,108 @@ static pfn_ovrHmd_EndFrameTiming ovrHmd_
 static pfn_ovrHmd_ResetFrameTiming ovrHmd_ResetFrameTiming = nullptr;
 static pfn_ovrHmd_GetEyePoses ovrHmd_GetEyePoses = nullptr;
 static pfn_ovrHmd_GetHmdPosePerEye ovrHmd_GetHmdPosePerEye = nullptr;
 static pfn_ovrHmd_GetEyeTimewarpMatrices ovrHmd_GetEyeTimewarpMatrices = nullptr;
 static pfn_ovrMatrix4f_Projection ovrMatrix4f_Projection = nullptr;
 static pfn_ovrMatrix4f_OrthoSubProjection ovrMatrix4f_OrthoSubProjection = nullptr;
 static pfn_ovr_GetTimeInSeconds ovr_GetTimeInSeconds = nullptr;
 
-#if defined(XP_WIN)
-# ifdef HAVE_64BIT_BUILD
-#  define OVR_LIB_NAME "libovr64.dll"
-# else
-#  define OVR_LIB_NAME "libovr.dll"
-# endif
-#elif defined(XP_MACOSX)
-# define OVR_LIB_NAME "libovr.dylib"
+#ifdef HAVE_64BIT_BUILD
+#define BUILD_BITS 64
 #else
-# define OVR_LIB_NAME 0
+#define BUILD_BITS 32
 #endif
 
+#define LIBOVR_PRODUCT_VERSION 0
+#define LIBOVR_MAJOR_VERSION   5
+#define LIBOVR_MINOR_VERSION   0
+
 static bool
 InitializeOculusCAPI()
 {
   static PRLibrary *ovrlib = nullptr;
 
   if (!ovrlib) {
-    const char *libName = OVR_LIB_NAME;
+    nsTArray<nsCString> libSearchPaths;
+    nsCString libName;
+    nsCString searchPath;
+
+#if defined(_WIN32)
+    static const char dirSep = '\\';
+#else
+    static const char dirSep = '/';
+#endif
+
+#if defined(_WIN32)
+    static const int pathLen = 260;
+    searchPath.SetCapacity(pathLen);
+    int realLen = ::GetSystemDirectoryA(searchPath.BeginWriting(), pathLen);
+    if (realLen != 0 && realLen < pathLen) {
+      searchPath.SetLength(realLen);
+      libSearchPaths.AppendElement(searchPath);
+    }
+    libName.AppendPrintf("LibOVRRT%d_%d_%d.dll", BUILD_BITS, LIBOVR_PRODUCT_VERSION, LIBOVR_MAJOR_VERSION);
+#elif defined(__APPLE__)
+    searchPath.Truncate();
+    searchPath.AppendPrintf("/Library/Frameworks/LibOVRRT_%d.framework/Versions/%d", LIBOVR_PRODUCT_VERSION, LIBOVR_MAJOR_VERSION);
+    libSearchPaths.AppendElement(searchPath);
+
+    if (PR_GetEnv("HOME")) {
+      searchPath.Truncate();
+      searchPath.AppendPrintf("%s/Library/Frameworks/LibOVRRT_%d.framework/Versions/%d", PR_GetEnv("HOME"), LIBOVR_PRODUCT_VERSION, LIBOVR_MAJOR_VERSION);
+      libSearchPaths.AppendElement(searchPath);
+    }
+    libName.AppendPrintf("LibOVRRT_%d", LIBOVR_PRODUCT_VERSION);
+#else
+    libSearchPaths.AppendElement(nsCString("/usr/local/lib"));
+    libSearchPaths.AppendElement(nsCString("/usr/lib"));
+    libName.AppendPrintf("LibOVRRT%d_%d.so.%d", BUILD_BITS, LIBOVR_PRODUCT_VERSION, LIBOVR_MAJOR_VERSION);
+#endif
 
     // If the pref is present, we override libName
-    nsAdoptingCString prefLibName = mozilla::Preferences::GetCString("dom.vr.ovr_lib_path");
+    nsAdoptingCString prefLibPath = mozilla::Preferences::GetCString("dom.vr.ovr_lib_path");
+    if (prefLibPath && prefLibPath.get()) {
+      libSearchPaths.InsertElementsAt(0, 1, prefLibPath);
+    }
+
+    nsAdoptingCString prefLibName = mozilla::Preferences::GetCString("dom.vr.ovr_lib_name");
     if (prefLibName && prefLibName.get()) {
-      libName = prefLibName.get();
+      libName.Assign(prefLibName);
     }
 
+    // search the path/module dir
+    libSearchPaths.InsertElementsAt(0, 1, nsCString());
+
     // If the env var is present, we override libName
+    if (PR_GetEnv("OVR_LIB_PATH")) {
+      searchPath = PR_GetEnv("OVR_LIB_PATH");
+      libSearchPaths.InsertElementsAt(0, 1, searchPath);
+    }
+
     if (PR_GetEnv("OVR_LIB_NAME")) {
       libName = PR_GetEnv("OVR_LIB_NAME");
     }
 
-    if (!libName) {
-      printf_stderr("Don't know how to find Oculus VR library; missing dom.vr.ovr_lib_path or OVR_LIB_NAME\n");
-      return false;
-    }
-
-    ovrlib = PR_LoadLibrary(libName);
+    for (uint32_t i = 0; i < libSearchPaths.Length(); ++i) {
+      nsCString& libPath = libSearchPaths[i];
+      nsCString fullName;
+      if (libPath.Length() == 0) {
+        fullName.Assign(libName);
+      } else {
+        fullName.AppendPrintf("%s%c%s", libPath.BeginReading(), dirSep, libName.BeginReading());
+      }
 
-    if (!ovrlib) {
-      // Not found? Try harder. Needed mainly on OSX/etc. where
-      // the binary location is not in the search path.
-      const char *xulName = "libxul.so";
-#if defined(XP_MACOSX)
-      xulName = "XUL";
-#endif
-
-      char *xulpath = PR_GetLibraryFilePathname(xulName, (PRFuncPtr) &InitializeOculusCAPI);
-      if (xulpath) {
-        char *xuldir = strrchr(xulpath, '/');
-        if (xuldir) {
-          *xuldir = 0;
-          xuldir = xulpath;
-
-          char *ovrpath = PR_GetLibraryName(xuldir, libName);
-          ovrlib = PR_LoadLibrary(ovrpath);
-          PR_Free(ovrpath);
-        }
-        PR_Free(xulpath);
-      }
+      ovrlib = PR_LoadLibrary(fullName.BeginReading());
+      if (ovrlib)
+        break;
     }
 
     if (!ovrlib) {
-      printf_stderr("Failed to load Oculus VR library, tried '%s'\n", libName);
+      printf_stderr("Failed to load Oculus VR library!\n");
       return false;
     }
   }
 
   // was it already initialized?
   if (ovr_Initialize)
     return true;
 
@@ -257,17 +286,17 @@ HMDInfoOculus::SetFOV(const VRFieldOfVie
   for (uint32_t eye = 0; eye < NumEyes; eye++) {
     mEyeFOV[eye] = eye == 0 ? aFOVLeft : aFOVRight;
     mFOVPort[eye] = ToFovPort(mEyeFOV[eye]);
 
     ovrEyeRenderDesc renderDesc = ovrHmd_GetRenderDesc(mHMD, (ovrEyeType) eye, mFOVPort[eye]);
 
     // these values are negated so that content can add the adjustment to its camera position,
     // instead of subtracting
-    mEyeTranslation[eye] = Point3D(-renderDesc.ViewAdjust.x, -renderDesc.ViewAdjust.y, -renderDesc.ViewAdjust.z);
+    mEyeTranslation[eye] = Point3D(-renderDesc.HmdToEyeViewOffset.x, -renderDesc.HmdToEyeViewOffset.y, -renderDesc.HmdToEyeViewOffset.z);
 
     // note that we are using a right-handed coordinate system here, to match CSS
     ovrMatrix4f projMatrix = ovrMatrix4f_Projection(mFOVPort[eye], zNear, zFar, true);
 
     // XXX this is gross, we really need better methods on Matrix4x4
     memcpy(&mEyeProjectionMatrix[eye], projMatrix.M, sizeof(ovrMatrix4f));
     mEyeProjectionMatrix[eye].Transpose();
 
@@ -437,17 +466,23 @@ VRHMDManagerOculus::PlatformInit()
     return true;
 
   if (!gfxPrefs::VREnabled())
     return false;
 
   if (!InitializeOculusCAPI())
     return false;
 
-  bool ok = ovr_Initialize();
+  ovrInitParams params;
+  params.Flags = ovrInit_RequestVersion;
+  params.RequestedMinorVersion = LIBOVR_MINOR_VERSION;
+  params.LogCallback = nullptr;
+  params.ConnectionTimeoutMS = 0;
+
+  bool ok = ovr_Initialize(&params);
 
   if (!ok)
     return false;
 
   mOculusPlatformInitialized = true;
   return true;
 }
 
--- a/gfx/vr/ovr_capi_dynamic.h
+++ b/gfx/vr/ovr_capi_dynamic.h
@@ -8,23 +8,50 @@
  * OVR_CAPI.h directly.  Note that it uses the same type names as the
  * CAPI, and cannot be #included at the same time as OVR_CAPI.h.  It
  * does not include the entire C API, just want's needed.
  */
 
 #ifdef OVR_CAPI_h
 #warning OVR_CAPI.h included before ovr_capi_dynamic.h, skpping this
 #define mozilla_ovr_capi_dynamic_h_
-#endif
+
+#else
 
 #ifndef mozilla_ovr_capi_dynamic_h_
 #define mozilla_ovr_capi_dynamic_h_
 
 #define OVR_CAPI_LIMITED_MOZILLA 1
 
+#if defined(_WIN32)
+#define OVR_PFN __cdecl
+#else
+#define OVR_PFN
+#endif
+
+#if !defined(OVR_ALIGNAS)
+#if defined(__GNUC__) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 408) && (defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L))
+#define OVR_ALIGNAS(n) alignas(n)
+#elif defined(__clang__) && !defined(__APPLE__) && (((__clang_major__ * 100) + __clang_minor__) >= 300) && (__cplusplus >= 201103L)
+#define OVR_ALIGNAS(n) alignas(n)
+#elif defined(__clang__) && defined(__APPLE__) && (((__clang_major__ * 100) + __clang_minor__) >= 401) && (__cplusplus >= 201103L)
+#define OVR_ALIGNAS(n) alignas(n)
+#elif defined(_MSC_VER) && (_MSC_VER >= 1900)
+#define OVR_ALIGNAS(n) alignas(n)
+#elif defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 408)
+#define OVR_ALIGNAS(n) alignas(n)
+#elif defined(__GNUC__) || defined(__clang__)
+#define OVR_ALIGNAS(n) __attribute__((aligned(n)))
+#elif defined(_MSC_VER) || defined(__INTEL_COMPILER)
+#define OVR_ALIGNAS(n) __declspec(align(n))
+#else
+#error Need to define OVR_ALIGNAS
+#endif
+#endif
+
 #ifdef __cplusplus 
 extern "C" {
 #endif
 
 typedef char ovrBool;
 typedef struct { int x, y; } ovrVector2i;
 typedef struct { int w, h; } ovrSizei;
 typedef struct { ovrVector2i Pos; ovrSizei Size; } ovrRecti;
@@ -33,75 +60,87 @@ typedef struct { float x, y; } ovrVector
 typedef struct { float x, y, z; } ovrVector3f;
 typedef struct { float M[4][4]; } ovrMatrix4f;
 
 typedef struct {
   ovrQuatf Orientation;
   ovrVector3f Position;
 } ovrPosef;
 
-typedef struct {
+typedef struct OVR_ALIGNAS(8) {
   ovrPosef ThePose;
   ovrVector3f AngularVelocity;
   ovrVector3f LinearVelocity;
   ovrVector3f AngularAcceleration;
   ovrVector3f LinearAcceleration;
-  double TimeInSeconds;
+  float       Pad;
+  double      TimeInSeconds;
 } ovrPoseStatef;
 
 typedef struct {
   float UpTan;
   float DownTan;
   float LeftTan;
   float RightTan;
 } ovrFovPort;
 
 typedef enum {
   ovrHmd_None             = 0,    
   ovrHmd_DK1              = 3,
   ovrHmd_DKHD             = 4,
   ovrHmd_DK2              = 6,
-  ovrHmd_Other
+  ovrHmd_BlackStar        = 7,
+  ovrHmd_CB               = 8,
+  ovrHmd_Other            = 9,
+  ovrHmd_EnumSize         = 0x7fffffff
 } ovrHmdType;
 
 typedef enum {
   ovrHmdCap_Present           = 0x0001,
   ovrHmdCap_Available         = 0x0002,
   ovrHmdCap_Captured          = 0x0004,
   ovrHmdCap_ExtendDesktop     = 0x0008,
+  ovrHmdCap_DebugDevice       = 0x0010,
   ovrHmdCap_DisplayOff        = 0x0040,
   ovrHmdCap_LowPersistence    = 0x0080,
   ovrHmdCap_DynamicPrediction = 0x0200,
   ovrHmdCap_NoVSync           = 0x1000,
   ovrHmdCap_NoMirrorToWindow  = 0x2000
 } ovrHmdCapBits;
 
 typedef enum
 {
   ovrTrackingCap_Orientation      = 0x0010,
   ovrTrackingCap_MagYawCorrection = 0x0020,
   ovrTrackingCap_Position         = 0x0040,
-  ovrTrackingCap_Idle             = 0x0100
+  ovrTrackingCap_Idle             = 0x0100,
+  ovrTrackingCap_EnumSize         = 0x7fffffff
 } ovrTrackingCaps;
 
 typedef enum {
   ovrDistortionCap_Chromatic = 0x01,
   ovrDistortionCap_TimeWarp  = 0x02,
   ovrDistortionCap_Vignette  = 0x08,
   ovrDistortionCap_NoRestore = 0x10,
   ovrDistortionCap_FlipInput = 0x20,
   ovrDistortionCap_SRGB      = 0x40,
   ovrDistortionCap_Overdrive = 0x80,
-  ovrDistortionCap_ProfileNoTimewarpSpinWaits = 0x10000
+  ovrDistortionCap_HqDistortion = 0x100,
+  ovrDistortionCap_LinuxDevFullscreen = 0x200,
+  ovrDistortionCap_ComputeShader = 0x400,
+  ovrDistortionCap_TimewarpJitDelay = 0x1000,
+  ovrDistortionCap_ProfileNoSpinWaits = 0x10000,
+  ovrDistortionCap_EnumSize = 0x7fffffff
 } ovrDistortionCaps;
 
 typedef enum {
   ovrEye_Left  = 0,
   ovrEye_Right = 1,
-  ovrEye_Count = 2
+  ovrEye_Count = 2,
+  ovrEye_EnumSize = 0x7fffffff
 } ovrEyeType;
 
 typedef struct ovrHmdDesc_ {
   void* Handle;
   ovrHmdType  Type;
   const char* ProductName;    
   const char* Manufacturer;
   short VendorId;
@@ -131,17 +170,18 @@ typedef struct ovrHmdDesc_ {
 
 typedef const ovrHmdDesc* ovrHmd;
 
 typedef enum {
   ovrStatus_OrientationTracked    = 0x0001,
   ovrStatus_PositionTracked       = 0x0002,
   ovrStatus_CameraPoseTracked     = 0x0004,
   ovrStatus_PositionConnected     = 0x0020,
-  ovrStatus_HmdConnected          = 0x0080
+  ovrStatus_HmdConnected          = 0x0080,
+  ovrStatus_EnumSize              = 0x7fffffff
 } ovrStatusBits;
 
 typedef struct ovrSensorData_ {
   ovrVector3f    Accelerometer;
   ovrVector3f    Gyro;
   ovrVector3f    Magnetometer;
   float          Temperature;
   float          TimeInSeconds;
@@ -150,35 +190,36 @@ typedef struct ovrSensorData_ {
 
 typedef struct ovrTrackingState_ {
   ovrPoseStatef HeadPose;
   ovrPosef CameraPose;
   ovrPosef LeveledCameraPose;
   ovrSensorData RawSensorData;
   unsigned int StatusFlags;
   double LastVisionProcessingTime;
-  double LastVisionFrameLatency;
   uint32_t LastCameraFrameCounter;
+  uint32_t Pad;
 } ovrTrackingState;
 
-typedef struct ovrFrameTiming_ {
+typedef struct OVR_ALIGNAS(8) ovrFrameTiming_ {
   float DeltaSeconds;
+  float Pad; 
   double ThisFrameSeconds;
   double TimewarpPointSeconds;
   double NextFrameSeconds;
   double ScanoutMidpointSeconds;
   double EyeScanoutSeconds[2];    
 } ovrFrameTiming;
 
 typedef struct ovrEyeRenderDesc_ {
-  ovrEyeType  Eye;        
+  ovrEyeType  Eye;
   ovrFovPort  Fov;
   ovrRecti DistortedViewport;
   ovrVector2f PixelsPerTanAngleAtCenter;
-  ovrVector3f ViewAdjust;
+  ovrVector3f HmdToEyeViewOffset;
 } ovrEyeRenderDesc;
 
 typedef struct ovrDistortionVertex_ {
   ovrVector2f ScreenPosNDC;
   float       TimeWarpFactor;
   float       VignetteFactor;
   ovrVector2f TanEyeAnglesR;
   ovrVector2f TanEyeAnglesG;
@@ -187,42 +228,65 @@ typedef struct ovrDistortionVertex_ {
 
 typedef struct ovrDistortionMesh_ {
   ovrDistortionVertex* pVertexData;
   unsigned short*      pIndexData;
   unsigned int         VertexCount;
   unsigned int         IndexCount;
 } ovrDistortionMesh;
 
-typedef ovrBool (*pfn_ovr_Initialize)();
-typedef void (*pfn_ovr_Shutdown)();
-typedef int (*pfn_ovrHmd_Detect)();
-typedef ovrHmd (*pfn_ovrHmd_Create)(int index);
-typedef void (*pfn_ovrHmd_Destroy)(ovrHmd hmd);
-typedef ovrHmd (*pfn_ovrHmd_CreateDebug)(ovrHmdType type);
-typedef const char* (*pfn_ovrHmd_GetLastError)(ovrHmd hmd);
-typedef ovrBool (*pfn_ovrHmd_AttachToWindow)(ovrHmd hmd, void* window, const ovrRecti* destMirrorRect, const ovrRecti* sourceRenderTargetRect);
-typedef unsigned int (*pfn_ovrHmd_GetEnabledCaps)(ovrHmd hmd);
-typedef void (*pfn_ovrHmd_SetEnabledCaps)(ovrHmd hmd, unsigned int hmdCaps);
-typedef ovrBool (*pfn_ovrHmd_ConfigureTracking)(ovrHmd hmd, unsigned int supportedTrackingCaps, unsigned int requiredTrackingCaps); 
-typedef void (*pfn_ovrHmd_RecenterPose)(ovrHmd hmd);
-typedef ovrTrackingState (*pfn_ovrHmd_GetTrackingState)(ovrHmd hmd, double absTime);
-typedef ovrSizei (*pfn_ovrHmd_GetFovTextureSize)(ovrHmd hmd, ovrEyeType eye, ovrFovPort fov, float pixelsPerDisplayPixel);
-typedef ovrEyeRenderDesc (*pfn_ovrHmd_GetRenderDesc)(ovrHmd hmd, ovrEyeType eyeType, ovrFovPort fov);
-typedef ovrBool (*pfn_ovrHmd_CreateDistortionMesh)(ovrHmd hmd, ovrEyeType eyeType, ovrFovPort fov, unsigned int distortionCaps, ovrDistortionMesh *meshData);
-typedef void (*pfn_ovrHmd_DestroyDistortionMesh)(ovrDistortionMesh* meshData);
-typedef void (*pfn_ovrHmd_GetRenderScaleAndOffset)(ovrFovPort fov, ovrSizei textureSize, ovrRecti renderViewport, ovrVector2f uvScaleOffsetOut[2]);
-typedef ovrFrameTiming (*pfn_ovrHmd_GetFrameTiming)(ovrHmd hmd, unsigned int frameIndex);
-typedef ovrFrameTiming (*pfn_ovrHmd_BeginFrameTiming)(ovrHmd hmd, unsigned int frameIndex);
-typedef void (*pfn_ovrHmd_EndFrameTiming)(ovrHmd hmd);
-typedef void (*pfn_ovrHmd_ResetFrameTiming)(ovrHmd hmd, unsigned int frameIndex, bool vsync);
-typedef void (*pfn_ovrHmd_GetEyePoses)(ovrHmd hmd, unsigned int frameIndex, ovrVector3f hmdToEyeViewOffset[2], ovrPosef outEyePoses[2], ovrTrackingState* outHmdTrackingState);
-typedef ovrPosef (*pfn_ovrHmd_GetHmdPosePerEye)(ovrHmd hmd, ovrEyeType eye);
-typedef void (*pfn_ovrHmd_GetEyeTimewarpMatrices)(ovrHmd hmd, ovrEyeType eye, ovrPosef renderPose, ovrMatrix4f twmOut[2]);
-typedef ovrMatrix4f (*pfn_ovrMatrix4f_Projection) (ovrFovPort fov, float znear, float zfar, ovrBool rightHanded );
-typedef ovrMatrix4f (*pfn_ovrMatrix4f_OrthoSubProjection) (ovrFovPort fov, ovrVector2f orthoScale, float orthoDistance, float eyeViewAdjustX);
-typedef double (*pfn_ovr_GetTimeInSeconds)();
+typedef enum {
+  ovrInit_Debug          = 0x00000001,
+  ovrInit_ServerOptional = 0x00000002,
+  ovrInit_RequestVersion = 0x00000004,
+  ovrInit_ForceNoDebug   = 0x00000008
+} ovrInitFlags;
+
+typedef enum {
+  ovrLogLevel_Debug = 0,
+  ovrLogLevel_Info  = 1,
+  ovrLogLevel_Error = 2
+} ovrLogLevel;
+
+typedef void (OVR_PFN *ovrLogCallback)(int level, const char* message);
+
+typedef struct {
+  uint32_t Flags;
+  uint32_t RequestedMinorVersion;
+  ovrLogCallback LogCallback;
+  uint32_t ConnectionTimeoutMS;
+} ovrInitParams;
+
+typedef ovrBool (OVR_PFN *pfn_ovr_Initialize)(ovrInitParams const* params);
+typedef void (OVR_PFN *pfn_ovr_Shutdown)();
+typedef int (OVR_PFN *pfn_ovrHmd_Detect)();
+typedef ovrHmd (OVR_PFN *pfn_ovrHmd_Create)(int index);
+typedef void (OVR_PFN *pfn_ovrHmd_Destroy)(ovrHmd hmd);
+typedef ovrHmd (OVR_PFN *pfn_ovrHmd_CreateDebug)(ovrHmdType type);
+typedef const char* (OVR_PFN *pfn_ovrHmd_GetLastError)(ovrHmd hmd);
+typedef ovrBool (OVR_PFN *pfn_ovrHmd_AttachToWindow)(ovrHmd hmd, void* window, const ovrRecti* destMirrorRect, const ovrRecti* sourceRenderTargetRect);
+typedef unsigned int (OVR_PFN *pfn_ovrHmd_GetEnabledCaps)(ovrHmd hmd);
+typedef void (OVR_PFN *pfn_ovrHmd_SetEnabledCaps)(ovrHmd hmd, unsigned int hmdCaps);
+typedef ovrBool (OVR_PFN *pfn_ovrHmd_ConfigureTracking)(ovrHmd hmd, unsigned int supportedTrackingCaps, unsigned int requiredTrackingCaps); 
+typedef void (OVR_PFN *pfn_ovrHmd_RecenterPose)(ovrHmd hmd);
+typedef ovrTrackingState (OVR_PFN *pfn_ovrHmd_GetTrackingState)(ovrHmd hmd, double absTime);
+typedef ovrSizei (OVR_PFN *pfn_ovrHmd_GetFovTextureSize)(ovrHmd hmd, ovrEyeType eye, ovrFovPort fov, float pixelsPerDisplayPixel);
+typedef ovrEyeRenderDesc (OVR_PFN *pfn_ovrHmd_GetRenderDesc)(ovrHmd hmd, ovrEyeType eyeType, ovrFovPort fov);
+typedef ovrBool (OVR_PFN *pfn_ovrHmd_CreateDistortionMesh)(ovrHmd hmd, ovrEyeType eyeType, ovrFovPort fov, unsigned int distortionCaps, ovrDistortionMesh *meshData);
+typedef void (OVR_PFN *pfn_ovrHmd_DestroyDistortionMesh)(ovrDistortionMesh* meshData);
+typedef void (OVR_PFN *pfn_ovrHmd_GetRenderScaleAndOffset)(ovrFovPort fov, ovrSizei textureSize, ovrRecti renderViewport, ovrVector2f uvScaleOffsetOut[2]);
+typedef ovrFrameTiming (OVR_PFN *pfn_ovrHmd_GetFrameTiming)(ovrHmd hmd, unsigned int frameIndex);
+typedef ovrFrameTiming (OVR_PFN *pfn_ovrHmd_BeginFrameTiming)(ovrHmd hmd, unsigned int frameIndex);
+typedef void (OVR_PFN *pfn_ovrHmd_EndFrameTiming)(ovrHmd hmd);
+typedef void (OVR_PFN *pfn_ovrHmd_ResetFrameTiming)(ovrHmd hmd, unsigned int frameIndex, bool vsync);
+typedef void (OVR_PFN *pfn_ovrHmd_GetEyePoses)(ovrHmd hmd, unsigned int frameIndex, ovrVector3f hmdToEyeViewOffset[2], ovrPosef outEyePoses[2], ovrTrackingState* outHmdTrackingState);
+typedef ovrPosef (OVR_PFN *pfn_ovrHmd_GetHmdPosePerEye)(ovrHmd hmd, ovrEyeType eye);
+typedef void (OVR_PFN *pfn_ovrHmd_GetEyeTimewarpMatrices)(ovrHmd hmd, ovrEyeType eye, ovrPosef renderPose, ovrMatrix4f twmOut[2]);
+typedef ovrMatrix4f (OVR_PFN *pfn_ovrMatrix4f_Projection) (ovrFovPort fov, float znear, float zfar, ovrBool rightHanded );
+typedef ovrMatrix4f (OVR_PFN *pfn_ovrMatrix4f_OrthoSubProjection) (ovrFovPort fov, ovrVector2f orthoScale, float orthoDistance, float eyeViewAdjustX);
+typedef double (OVR_PFN *pfn_ovr_GetTimeInSeconds)();
 
 #ifdef __cplusplus 
 }
 #endif
 
 #endif /* mozilla_ovr_capi_dynamic_h_ */
+#endif /* OVR_CAPI_h */