--- a/gfx/vr/gfxVROculus.cpp
+++ b/gfx/vr/gfxVROculus.cpp
@@ -28,45 +28,77 @@
using namespace mozilla::gfx;
using namespace mozilla::gfx::impl;
namespace {
#ifdef OVR_CAPI_LIMITED_MOZILLA
static pfn_ovr_Initialize ovr_Initialize = nullptr;
static pfn_ovr_Shutdown ovr_Shutdown = nullptr;
-static pfn_ovr_GetTimeInSeconds ovr_GetTimeInSeconds = nullptr;
+static pfn_ovr_GetLastErrorInfo ovr_GetLastErrorInfo = nullptr;
+static pfn_ovr_GetVersionString ovr_GetVersionString = nullptr;
+static pfn_ovr_TraceMessage ovr_TraceMessage = nullptr;
static pfn_ovr_GetHmdDesc ovr_GetHmdDesc = nullptr;
-
+static pfn_ovr_GetTrackerCount ovr_GetTrackerCount = nullptr;
+static pfn_ovr_GetTrackerDesc ovr_GetTrackerDesc = nullptr;
static pfn_ovr_Create ovr_Create = nullptr;
static pfn_ovr_Destroy ovr_Destroy = nullptr;
-
-static pfn_ovr_RecenterPose ovr_RecenterPose = nullptr;
+static pfn_ovr_GetSessionStatus ovr_GetSessionStatus = nullptr;
+static pfn_ovr_SetTrackingOriginType ovr_SetTrackingOriginType = nullptr;
+static pfn_ovr_GetTrackingOriginType ovr_GetTrackingOriginType = nullptr;
+static pfn_ovr_RecenterTrackingOrigin ovr_RecenterTrackingOrigin = nullptr;
+static pfn_ovr_ClearShouldRecenterFlag ovr_ClearShouldRecenterFlag = nullptr;
static pfn_ovr_GetTrackingState ovr_GetTrackingState = nullptr;
-static pfn_ovr_GetPredictedDisplayTime ovr_GetPredictedDisplayTime = nullptr;
+static pfn_ovr_GetTrackerPose ovr_GetTrackerPose = nullptr;
+static pfn_ovr_GetInputState ovr_GetInputState = nullptr;
+static pfn_ovr_GetConnectedControllerTypes ovr_GetConnectedControllerTypes = nullptr;
+static pfn_ovr_SetControllerVibration ovr_SetControllerVibration = nullptr;
+static pfn_ovr_GetTextureSwapChainLength ovr_GetTextureSwapChainLength = nullptr;
+static pfn_ovr_GetTextureSwapChainCurrentIndex ovr_GetTextureSwapChainCurrentIndex = nullptr;
+static pfn_ovr_GetTextureSwapChainDesc ovr_GetTextureSwapChainDesc = nullptr;
+static pfn_ovr_CommitTextureSwapChain ovr_CommitTextureSwapChain = nullptr;
+static pfn_ovr_DestroyTextureSwapChain ovr_DestroyTextureSwapChain = nullptr;
+static pfn_ovr_DestroyMirrorTexture ovr_DestroyMirrorTexture = nullptr;
static pfn_ovr_GetFovTextureSize ovr_GetFovTextureSize = nullptr;
static pfn_ovr_GetRenderDesc ovr_GetRenderDesc = nullptr;
-
-static pfn_ovr_DestroySwapTextureSet ovr_DestroySwapTextureSet = nullptr;
static pfn_ovr_SubmitFrame ovr_SubmitFrame = nullptr;
+static pfn_ovr_GetPredictedDisplayTime ovr_GetPredictedDisplayTime = nullptr;
+static pfn_ovr_GetTimeInSeconds ovr_GetTimeInSeconds = nullptr;
+static pfn_ovr_GetBool ovr_GetBool = nullptr;
+static pfn_ovr_SetBool ovr_SetBool = nullptr;
+static pfn_ovr_GetInt ovr_GetInt = nullptr;
+static pfn_ovr_SetInt ovr_SetInt = nullptr;
+static pfn_ovr_GetFloat ovr_GetFloat = nullptr;
+static pfn_ovr_SetFloat ovr_SetFloat = nullptr;
+static pfn_ovr_GetFloatArray ovr_GetFloatArray = nullptr;
+static pfn_ovr_SetFloatArray ovr_SetFloatArray = nullptr;
+static pfn_ovr_GetString ovr_GetString = nullptr;
+static pfn_ovr_SetString ovr_SetString = nullptr;
#ifdef XP_WIN
-static pfn_ovr_CreateSwapTextureSetD3D11 ovr_CreateSwapTextureSetD3D11 = nullptr;
+static pfn_ovr_CreateTextureSwapChainDX ovr_CreateTextureSwapChainDX = nullptr;
+static pfn_ovr_GetTextureSwapChainBufferDX ovr_GetTextureSwapChainBufferDX = nullptr;
+static pfn_ovr_CreateMirrorTextureDX ovr_CreateMirrorTextureDX = nullptr;
+static pfn_ovr_GetMirrorTextureBufferDX ovr_GetMirrorTextureBufferDX = nullptr;
#endif
-static pfn_ovr_CreateSwapTextureSetGL ovr_CreateSwapTextureSetGL = nullptr;
+
+static pfn_ovr_CreateTextureSwapChainGL ovr_CreateTextureSwapChainGL = nullptr;
+static pfn_ovr_GetTextureSwapChainBufferGL ovr_GetTextureSwapChainBufferGL = nullptr;
+static pfn_ovr_CreateMirrorTextureGL ovr_CreateMirrorTextureGL = nullptr;
+static pfn_ovr_GetMirrorTextureBufferGL ovr_GetMirrorTextureBufferGL = nullptr;
#ifdef HAVE_64BIT_BUILD
#define BUILD_BITS 64
#else
#define BUILD_BITS 32
#endif
-#define OVR_PRODUCT_VERSION 0
-#define OVR_MAJOR_VERSION 8
-#define OVR_MINOR_VERSION 0
+#define OVR_PRODUCT_VERSION 1
+#define OVR_MAJOR_VERSION 3
+#define OVR_MINOR_VERSION 1
static bool
InitializeOculusCAPI()
{
static PRLibrary *ovrlib = nullptr;
if (!ovrlib) {
nsTArray<nsCString> libSearchPaths;
@@ -82,17 +114,17 @@ InitializeOculusCAPI()
#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, OVR_PRODUCT_VERSION, OVR_MAJOR_VERSION);
+ libName.AppendPrintf("LibOVRRT%d_%d.dll", BUILD_BITS, OVR_PRODUCT_VERSION);
#elif defined(__APPLE__)
searchPath.Truncate();
searchPath.AppendPrintf("/Library/Frameworks/LibOVRRT_%d.framework/Versions/%d", OVR_PRODUCT_VERSION, OVR_MAJOR_VERSION);
libSearchPaths.AppendElement(searchPath);
if (PR_GetEnv("HOME")) {
searchPath.Truncate();
searchPath.AppendPrintf("%s/Library/Frameworks/LibOVRRT_%d.framework/Versions/%d", PR_GetEnv("HOME"), OVR_PRODUCT_VERSION, OVR_MAJOR_VERSION);
@@ -158,34 +190,69 @@ InitializeOculusCAPI()
#define REQUIRE_FUNCTION(_x) do { \
*(void **)&_x = (void *) PR_FindSymbol(ovrlib, #_x); \
if (!_x) { printf_stderr(#_x " symbol missing\n"); goto fail; } \
} while (0)
REQUIRE_FUNCTION(ovr_Initialize);
REQUIRE_FUNCTION(ovr_Shutdown);
- REQUIRE_FUNCTION(ovr_GetTimeInSeconds);
+ REQUIRE_FUNCTION(ovr_GetLastErrorInfo);
+ REQUIRE_FUNCTION(ovr_GetVersionString);
+ REQUIRE_FUNCTION(ovr_TraceMessage);
REQUIRE_FUNCTION(ovr_GetHmdDesc);
-
+ REQUIRE_FUNCTION(ovr_GetTrackerCount);
+ REQUIRE_FUNCTION(ovr_GetTrackerDesc);
REQUIRE_FUNCTION(ovr_Create);
REQUIRE_FUNCTION(ovr_Destroy);
-
- REQUIRE_FUNCTION(ovr_RecenterPose);
+ REQUIRE_FUNCTION(ovr_GetSessionStatus);
+ REQUIRE_FUNCTION(ovr_SetTrackingOriginType);
+ REQUIRE_FUNCTION(ovr_GetTrackingOriginType);
+ REQUIRE_FUNCTION(ovr_RecenterTrackingOrigin);
+ REQUIRE_FUNCTION(ovr_ClearShouldRecenterFlag);
REQUIRE_FUNCTION(ovr_GetTrackingState);
- REQUIRE_FUNCTION(ovr_GetPredictedDisplayTime);
+ REQUIRE_FUNCTION(ovr_GetTrackerPose);
+ REQUIRE_FUNCTION(ovr_GetInputState);
+ REQUIRE_FUNCTION(ovr_GetConnectedControllerTypes);
+ REQUIRE_FUNCTION(ovr_SetControllerVibration);
+ REQUIRE_FUNCTION(ovr_GetTextureSwapChainLength);
+ REQUIRE_FUNCTION(ovr_GetTextureSwapChainCurrentIndex);
+ REQUIRE_FUNCTION(ovr_GetTextureSwapChainDesc);
+ REQUIRE_FUNCTION(ovr_CommitTextureSwapChain);
+ REQUIRE_FUNCTION(ovr_DestroyTextureSwapChain);
+ REQUIRE_FUNCTION(ovr_DestroyMirrorTexture);
REQUIRE_FUNCTION(ovr_GetFovTextureSize);
REQUIRE_FUNCTION(ovr_GetRenderDesc);
+ REQUIRE_FUNCTION(ovr_SubmitFrame);
+ REQUIRE_FUNCTION(ovr_GetPredictedDisplayTime);
+ REQUIRE_FUNCTION(ovr_GetTimeInSeconds);
+ REQUIRE_FUNCTION(ovr_GetBool);
+ REQUIRE_FUNCTION(ovr_SetBool);
+ REQUIRE_FUNCTION(ovr_GetInt);
+ REQUIRE_FUNCTION(ovr_SetInt);
+ REQUIRE_FUNCTION(ovr_GetFloat);
+ REQUIRE_FUNCTION(ovr_SetFloat);
+ REQUIRE_FUNCTION(ovr_GetFloatArray);
+ REQUIRE_FUNCTION(ovr_SetFloatArray);
+ REQUIRE_FUNCTION(ovr_GetString);
+ REQUIRE_FUNCTION(ovr_SetString);
- REQUIRE_FUNCTION(ovr_DestroySwapTextureSet);
- REQUIRE_FUNCTION(ovr_SubmitFrame);
#ifdef XP_WIN
- REQUIRE_FUNCTION(ovr_CreateSwapTextureSetD3D11);
+
+ REQUIRE_FUNCTION(ovr_CreateTextureSwapChainDX);
+ REQUIRE_FUNCTION(ovr_GetTextureSwapChainBufferDX);
+ REQUIRE_FUNCTION(ovr_CreateMirrorTextureDX);
+ REQUIRE_FUNCTION(ovr_GetMirrorTextureBufferDX);
+
#endif
- REQUIRE_FUNCTION(ovr_CreateSwapTextureSetGL);
+
+ REQUIRE_FUNCTION(ovr_CreateTextureSwapChainGL);
+ REQUIRE_FUNCTION(ovr_GetTextureSwapChainBufferGL);
+ REQUIRE_FUNCTION(ovr_CreateMirrorTextureGL);
+ REQUIRE_FUNCTION(ovr_GetMirrorTextureBufferGL);
#undef REQUIRE_FUNCTION
return true;
fail:
ovr_Initialize = nullptr;
return false;
@@ -286,18 +353,18 @@ HMDInfoOculus::SetFOV(const gfx::VRField
// get eye parameters and create the mesh
for (uint32_t eye = 0; eye < VRDeviceInfo::NumEyes; eye++) {
mDeviceInfo.mEyeFOV[eye] = eye == 0 ? aFOVLeft : aFOVRight;
mFOVPort[eye] = ToFovPort(mDeviceInfo.mEyeFOV[eye]);
ovrEyeRenderDesc renderDesc = ovr_GetRenderDesc(mSession, (ovrEyeType)eye, mFOVPort[eye]);
- // As of Oculus 0.6.0, the HmdToEyeViewOffset values are correct and don't need to be negated.
- mDeviceInfo.mEyeTranslation[eye] = Point3D(renderDesc.HmdToEyeViewOffset.x, renderDesc.HmdToEyeViewOffset.y, renderDesc.HmdToEyeViewOffset.z);
+ // As of Oculus 0.6.0, the HmdToEyeOffset values are correct and don't need to be negated.
+ mDeviceInfo.mEyeTranslation[eye] = Point3D(renderDesc.HmdToEyeOffset.x, renderDesc.HmdToEyeOffset.y, renderDesc.HmdToEyeOffset.z);
// note that we are using a right-handed coordinate system here, to match CSS
mDeviceInfo.mEyeProjectionMatrix[eye] = mDeviceInfo.mEyeFOV[eye].ConstructProjectionMatrix(zNear, zFar, true);
texSize[eye] = ovr_GetFovTextureSize(mSession, (ovrEyeType)eye, mFOVPort[eye], pixelsPerDisplayPixel);
}
// take the max of both for eye resolution
@@ -333,17 +400,17 @@ void
HMDInfoOculus::NotifyVsync(const mozilla::TimeStamp& aVsyncTimestamp)
{
++mInputFrameID;
}
void
HMDInfoOculus::ZeroSensor()
{
- ovr_RecenterPose(mSession);
+ ovr_RecenterTrackingOrigin(mSession);
}
VRHMDSensorState
HMDInfoOculus::GetSensorState()
{
VRHMDSensorState result;
double frameTiming = 0.0f;
if (gfxPrefs::VRPosePredictionEnabled()) {
@@ -405,109 +472,124 @@ HMDInfoOculus::GetSensorState(double tim
result.linearAcceleration[2] = pose.LinearAcceleration.z;
}
return result;
}
struct RenderTargetSetOculus : public VRHMDRenderingSupport::RenderTargetSet
{
- RenderTargetSetOculus(const IntSize& aSize,
+ RenderTargetSetOculus(ovrSession aSession,
+ const IntSize& aSize,
HMDInfoOculus *aHMD,
- ovrSwapTextureSet *aTS)
+ ovrTextureSwapChain aTS)
: hmd(aHMD)
+ , textureSet(aTS)
+ , session(aSession)
{
- textureSet = aTS;
size = aSize;
}
already_AddRefed<layers::CompositingRenderTarget> GetNextRenderTarget() override {
- currentRenderTarget = (currentRenderTarget + 1) % renderTargets.Length();
- textureSet->CurrentIndex = currentRenderTarget;
+ int currentRenderTarget = 0;
+ DebugOnly<ovrResult> orv = ovr_GetTextureSwapChainCurrentIndex(session, textureSet, ¤tRenderTarget);
+ MOZ_ASSERT(orv == ovrSuccess, "ovr_GetTextureSwapChainCurrentIndex failed.");
+
renderTargets[currentRenderTarget]->ClearOnBind();
RefPtr<layers::CompositingRenderTarget> rt = renderTargets[currentRenderTarget];
return rt.forget();
}
void Destroy() {
- if (!hmd)
- return;
-
- if (hmd->GetOculusSession()) {
- // If the ovrSession was already destroyed, so were all associated
- // texture sets
- ovr_DestroySwapTextureSet(hmd->GetOculusSession(), textureSet);
- }
+ ovr_DestroyTextureSwapChain(session, textureSet);
hmd = nullptr;
textureSet = nullptr;
}
~RenderTargetSetOculus() {
Destroy();
}
RefPtr<HMDInfoOculus> hmd;
- ovrSwapTextureSet *textureSet;
+ ovrTextureSwapChain textureSet;
+ ovrSession session;
};
#ifdef XP_WIN
class BasicTextureSourceD3D11 : public layers::TextureSourceD3D11
{
public:
BasicTextureSourceD3D11(ID3D11Texture2D *aTexture, const IntSize& aSize) {
mTexture = aTexture;
mSize = aSize;
}
};
struct RenderTargetSetD3D11 : public RenderTargetSetOculus
{
- RenderTargetSetD3D11(layers::CompositorD3D11 *aCompositor,
+ RenderTargetSetD3D11(ovrSession aSession,
+ layers::CompositorD3D11 *aCompositor,
const IntSize& aSize,
HMDInfoOculus *aHMD,
- ovrSwapTextureSet *aTS)
- : RenderTargetSetOculus(aSize, aHMD, aTS)
+ ovrTextureSwapChain aTS)
+ : RenderTargetSetOculus(aSession, aSize, aHMD, aTS)
{
compositor = aCompositor;
- renderTargets.SetLength(aTS->TextureCount);
-
- currentRenderTarget = aTS->CurrentIndex;
+ int textureCount = 0;
+ DebugOnly<ovrResult> orv = ovr_GetTextureSwapChainLength(session, aTS, &textureCount);
+ MOZ_ASSERT(orv == ovrSuccess, "ovr_GetTextureSwapChainLength failed.");
- for (int i = 0; i < aTS->TextureCount; ++i) {
- ovrD3D11Texture *tex11;
+ renderTargets.SetLength(textureCount);
+
+ for (int i = 0; i < textureCount; ++i) {
+
RefPtr<layers::CompositingRenderTargetD3D11> rt;
-
- tex11 = (ovrD3D11Texture*)&aTS->Textures[i];
- rt = new layers::CompositingRenderTargetD3D11(tex11->D3D11.pTexture, IntPoint(0, 0), DXGI_FORMAT_B8G8R8A8_UNORM);
+
+ ID3D11Texture2D* texture = nullptr;
+ orv = ovr_GetTextureSwapChainBufferDX(session, aTS, i, IID_PPV_ARGS(&texture));
+ MOZ_ASSERT(orv == ovrSuccess, "ovr_GetTextureSwapChainBufferDX failed.");
+ rt = new layers::CompositingRenderTargetD3D11(texture, IntPoint(0, 0), DXGI_FORMAT_B8G8R8A8_UNORM);
rt->SetSize(size);
renderTargets[i] = rt;
+ texture->Release();
}
}
};
#endif
already_AddRefed<VRHMDRenderingSupport::RenderTargetSet>
HMDInfoOculus::CreateRenderTargetSet(layers::Compositor *aCompositor, const IntSize& aSize)
{
#ifdef XP_WIN
if (aCompositor->GetBackendType() == layers::LayersBackend::LAYERS_D3D11)
{
layers::CompositorD3D11 *comp11 = static_cast<layers::CompositorD3D11*>(aCompositor);
- CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, aSize.width, aSize.height, 1, 1,
- D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET);
- ovrSwapTextureSet *ts = nullptr;
+ ovrTextureSwapChainDesc desc;
+ memset(&desc, 0, sizeof(desc));
+ desc.Type = ovrTexture_2D;
+ desc.ArraySize = 1;
+ desc.Format = OVR_FORMAT_B8G8R8A8_UNORM_SRGB;
+ desc.Width = aSize.width;
+ desc.Height = aSize.height;
+ desc.MipLevels = 1;
+ desc.SampleCount = 1;
+ desc.StaticImage = false;
+ desc.MiscFlags = ovrTextureMisc_DX_Typeless;
+ desc.BindFlags = ovrTextureBind_DX_RenderTarget;
+
+ ovrTextureSwapChain ts = nullptr;
- ovrResult orv = ovr_CreateSwapTextureSetD3D11(mSession, comp11->GetDevice(), &desc, ovrSwapTextureSetD3D11_Typeless, &ts);
+ ovrResult orv = ovr_CreateTextureSwapChainDX(mSession, comp11->GetDevice(), &desc, &ts);
if (orv != ovrSuccess) {
return nullptr;
}
- RefPtr<RenderTargetSetD3D11> rts = new RenderTargetSetD3D11(comp11, aSize, this, ts);
+ RefPtr<RenderTargetSetD3D11> rts = new RenderTargetSetD3D11(mSession, comp11, aSize, this, ts);
return rts.forget();
}
#endif
if (aCompositor->GetBackendType() == layers::LayersBackend::LAYERS_OPENGL) {
}
return nullptr;
@@ -527,16 +609,20 @@ HMDInfoOculus::SubmitFrame(RenderTargetS
MOZ_ASSERT(rts->hmd != nullptr);
MOZ_ASSERT(rts->textureSet != nullptr);
MOZ_ASSERT(aInputFrameID >= 0);
if (aInputFrameID < 0) {
// Sanity check to prevent invalid memory access on builds with assertions
// disabled.
aInputFrameID = 0;
}
+ ovrResult orv = ovr_CommitTextureSwapChain(mSession, rts->textureSet);
+ if (orv != ovrSuccess) {
+ printf_stderr("ovr_CommitTextureSwapChain failed.\n");
+ }
VRHMDSensorState sensorState = mLastSensorState[aInputFrameID % kMaxLatencyFrames];
// It is possible to get a cache miss on mLastSensorState if latency is
// longer than kMaxLatencyFrames. An optimization would be to find a frame
// that is closer than the one selected with the modulus.
// If we hit this; however, latency is already so high that the site is
// un-viewable and a more accurate pose prediction is not likely to
// compensate.
@@ -575,20 +661,20 @@ HMDInfoOculus::SubmitFrame(RenderTargetS
layer.RenderPose[i].Orientation.z = o.z;
layer.RenderPose[i].Orientation.w = o.w;
layer.RenderPose[i].Position.x = p.x + sensorState.position[0];
layer.RenderPose[i].Position.y = p.y + sensorState.position[1];
layer.RenderPose[i].Position.z = p.z + sensorState.position[2];
}
ovrLayerHeader *layers = &layer.Header;
- ovrResult orv = ovr_SubmitFrame(mSession, aInputFrameID, nullptr, &layers, 1);
+ orv = ovr_SubmitFrame(mSession, aInputFrameID, nullptr, &layers, 1);
//printf_stderr("Submitted frame %d, result: %d\n", rts->textureSet->CurrentIndex, orv);
if (orv != ovrSuccess) {
- // not visible? failed?
+ printf_stderr("ovr_SubmitFrame failed.\n");
}
}
/*static*/ already_AddRefed<VRHMDManagerOculus>
VRHMDManagerOculus::Create()
{
MOZ_ASSERT(NS_IsMainThread());
--- a/gfx/vr/ovr_capi_dynamic.h
+++ b/gfx/vr/ovr_capi_dynamic.h
@@ -54,16 +54,20 @@
#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
+#if !defined(OVR_UNUSED_STRUCT_PAD)
+#define OVR_UNUSED_STRUCT_PAD(padName, size) char padName[size];
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
typedef int32_t ovrResult;
typedef enum {
ovrSuccess = 0,
@@ -88,17 +92,17 @@ typedef struct OVR_ALIGNAS(4) {
} ovrPosef;
typedef struct OVR_ALIGNAS(8) {
ovrPosef ThePose;
ovrVector3f AngularVelocity;
ovrVector3f LinearVelocity;
ovrVector3f AngularAcceleration;
ovrVector3f LinearAcceleration;
- float Pad;
+ OVR_UNUSED_STRUCT_PAD(pad0, 4)
double TimeInSeconds;
} ovrPoseStatef;
typedef struct {
float UpTan;
float DownTan;
float LeftTan;
float RightTan;
@@ -108,360 +112,410 @@ typedef enum {
ovrHmd_None = 0,
ovrHmd_DK1 = 3,
ovrHmd_DKHD = 4,
ovrHmd_DK2 = 6,
ovrHmd_CB = 8,
ovrHmd_Other = 9,
ovrHmd_E3_2015 = 10,
ovrHmd_ES06 = 11,
+ ovrHmd_ES09 = 12,
+ ovrHmd_ES11 = 13,
+ ovrHmd_CV1 = 14,
ovrHmd_EnumSize = 0x7fffffff
} ovrHmdType;
typedef enum {
- ovrHmdCap_Writable_Mask = 0x0000,
- ovrHmdCap_Service_Mask = 0x0000,
ovrHmdCap_DebugDevice = 0x0010,
ovrHmdCap_EnumSize = 0x7fffffff
} ovrHmdCaps;
typedef enum
{
ovrTrackingCap_Orientation = 0x0010,
ovrTrackingCap_MagYawCorrection = 0x0020,
ovrTrackingCap_Position = 0x0040,
- ovrTrackingCap_Idle = 0x0100,
ovrTrackingCap_EnumSize = 0x7fffffff
} ovrTrackingCaps;
-typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) {
- char Reserved[8];
-} ovrGraphicsLuid;
-
typedef enum {
ovrEye_Left = 0,
ovrEye_Right = 1,
ovrEye_Count = 2,
ovrEye_EnumSize = 0x7fffffff
} ovrEyeType;
+typedef enum {
+ ovrTrackingOrigin_EyeLevel = 0,
+ ovrTrackingOrigin_FloorLevel = 1,
+ ovrTrackingOrigin_Count = 2, ///< \internal Count of enumerated elements.
+ ovrTrackingOrigin_EnumSize = 0x7fffffff ///< \internal Force type int32_t.
+} ovrTrackingOrigin;
+
+typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) {
+ char Reserved[8];
+} ovrGraphicsLuid;
+
typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) {
ovrHmdType Type;
- OVR_ON64(unsigned char pad0[4];)
+ OVR_ON64(OVR_UNUSED_STRUCT_PAD(pad0, 4))
char ProductName[64];
char Manufacturer[64];
short VendorId;
short ProductId;
char SerialNumber[24];
short FirmwareMajor;
short FirmwareMinor;
- float CameraFrustumHFovInRadians;
- float CameraFrustumVFovInRadians;
- float CameraFrustumNearZInMeters;
- float CameraFrustumFarZInMeters;
-
unsigned int AvailableHmdCaps;
unsigned int DefaultHmdCaps;
unsigned int AvailableTrackingCaps;
unsigned int DefaultTrackingCaps;
-
- ovrFovPort DefaultEyeFov[ovrEye_Count];
- ovrFovPort MaxEyeFov[ovrEye_Count];
- ovrSizei Resolution;
+ ovrFovPort DefaultEyeFov[ovrEye_Count];
+ ovrFovPort MaxEyeFov[ovrEye_Count];
+ ovrSizei Resolution;
float DisplayRefreshRate;
- OVR_ON64(unsigned char pad1[4];)
+ OVR_ON64(OVR_UNUSED_STRUCT_PAD(pad1, 4))
} ovrHmdDesc;
typedef struct ovrHmdStruct* ovrSession;
typedef enum {
ovrStatus_OrientationTracked = 0x0001,
ovrStatus_PositionTracked = 0x0002,
- ovrStatus_CameraPoseTracked = 0x0004,
- ovrStatus_PositionConnected = 0x0020,
- ovrStatus_HmdConnected = 0x0080,
ovrStatus_EnumSize = 0x7fffffff
} ovrStatusBits;
-typedef struct OVR_ALIGNAS(4) {
- ovrVector3f Accelerometer;
- ovrVector3f Gyro;
- ovrVector3f Magnetometer;
- float Temperature;
- float TimeInSeconds;
-} ovrSensorData;
+typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) {
+ float FrustumHFovInRadians;
+ float FrustumVFovInRadians;
+ float FrustumNearZInMeters;
+ float FrustumFarZInMeters;
+} ovrTrackerDesc;
+typedef enum {
+ ovrTracker_Connected = 0x0020,
+ ovrTracker_PoseTracked = 0x0004
+} ovrTrackerFlags;
+
+typedef struct OVR_ALIGNAS(8) {
+ unsigned int TrackerFlags;
+ ovrPosef Pose;
+ ovrPosef LeveledPose;
+ OVR_UNUSED_STRUCT_PAD(pad0, 4)
+} ovrTrackerPose;
typedef struct OVR_ALIGNAS(8) {
ovrPoseStatef HeadPose;
- ovrPosef CameraPose;
- ovrPosef LeveledCameraPose;
+ unsigned int StatusFlags;
ovrPoseStatef HandPoses[2];
- ovrSensorData RawSensorData;
- unsigned int StatusFlags;
unsigned int HandStatusFlags[2];
- uint32_t LastCameraFrameCounter;
- unsigned char pad0[4];
+ ovrPosef CalibratedOrigin;
} ovrTrackingState;
typedef struct OVR_ALIGNAS(4) {
- ovrEyeType Eye;
- ovrFovPort Fov;
- ovrRecti DistortedViewport;
- ovrVector2f PixelsPerTanAngleAtCenter;
- ovrVector3f HmdToEyeViewOffset;
+ ovrEyeType Eye;
+ ovrFovPort Fov;
+ ovrRecti DistortedViewport;
+ ovrVector2f PixelsPerTanAngleAtCenter;
+ ovrVector3f HmdToEyeOffset;
} ovrEyeRenderDesc;
typedef struct OVR_ALIGNAS(4) {
- float Projection22;
- float Projection23;
- float Projection32;
+ float Projection22;
+ float Projection23;
+ float Projection32;
} ovrTimewarpProjectionDesc;
typedef struct OVR_ALIGNAS(4) {
- ovrVector3f HmdToEyeViewOffset[ovrEye_Count];
- float HmdSpaceToWorldScaleInMeters;
+ ovrVector3f HmdToEyeViewOffset[ovrEye_Count];
+ float HmdSpaceToWorldScaleInMeters;
} ovrViewScaleDesc;
typedef enum {
- ovrRenderAPI_None = 0,
- ovrRenderAPI_OpenGL = 1,
- ovrRenderAPI_Android_GLES = 2,
- ovrRenderAPI_D3D11 = 5,
- ovrRenderAPI_Count = 4,
- ovrRenderAPI_EnumSize = 0x7fffffff
-} ovrRenderAPIType;
+ ovrTexture_2D,
+ ovrTexture_2D_External,
+ ovrTexture_Cube,
+ ovrTexture_Count,
+ ovrTexture_EnumSize = 0x7fffffff
+} ovrTextureType;
+
+typedef enum {
+ ovrTextureBind_None,
+ ovrTextureBind_DX_RenderTarget = 0x0001,
+ ovrTextureBind_DX_UnorderedAccess = 0x0002,
+ ovrTextureBind_DX_DepthStencil = 0x0004,
+ ovrTextureBind_EnumSize = 0x7fffffff
+} ovrTextureBindFlags;
-typedef struct OVR_ALIGNAS(4) {
- ovrRenderAPIType API;
- ovrSizei TextureSize;
-} ovrTextureHeader;
+typedef enum {
+ OVR_FORMAT_UNKNOWN,
+ OVR_FORMAT_B5G6R5_UNORM,
+ OVR_FORMAT_B5G5R5A1_UNORM,
+ OVR_FORMAT_B4G4R4A4_UNORM,
+ OVR_FORMAT_R8G8B8A8_UNORM,
+ OVR_FORMAT_R8G8B8A8_UNORM_SRGB,
+ OVR_FORMAT_B8G8R8A8_UNORM,
+ OVR_FORMAT_B8G8R8A8_UNORM_SRGB,
+ OVR_FORMAT_B8G8R8X8_UNORM,
+ OVR_FORMAT_B8G8R8X8_UNORM_SRGB,
+ OVR_FORMAT_R16G16B16A16_FLOAT,
+ OVR_FORMAT_D16_UNORM,
+ OVR_FORMAT_D24_UNORM_S8_UINT,
+ OVR_FORMAT_D32_FLOAT,
+ OVR_FORMAT_D32_FLOAT_S8X24_UINT,
+ OVR_FORMAT_ENUMSIZE = 0x7fffffff
+} ovrTextureFormat;
-typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) {
- ovrTextureHeader Header;
- OVR_ON64(unsigned char pad0[4];)
- uintptr_t PlatformData[8];
-} ovrTexture;
+typedef enum {
+ ovrTextureMisc_None,
+ ovrTextureMisc_DX_Typeless = 0x0001,
+ ovrTextureMisc_AllowGenerateMips = 0x0002,
+ ovrTextureMisc_EnumSize = 0x7fffffff
+} ovrTextureFlags;
-typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) {
- ovrTexture* Textures;
- int TextureCount;
- int CurrentIndex;
-} ovrSwapTextureSet;
+typedef struct {
+ ovrTextureType Type;
+ ovrTextureFormat Format;
+ int ArraySize;
+ int Width;
+ int Height;
+ int MipLevels;
+ int SampleCount;
+ ovrBool StaticImage;
+ unsigned int MiscFlags;
+ unsigned int BindFlags;
+} ovrTextureSwapChainDesc;
+
+typedef struct
+{
+ ovrTextureFormat Format;
+ int Width;
+ int Height;
+ unsigned int MiscFlags;
+} ovrMirrorTextureDesc;
+
+typedef void* ovrTextureSwapChain;
+typedef struct ovrMirrorTextureData* ovrMirrorTexture;
+
typedef enum {
ovrButton_A = 0x00000001,
ovrButton_B = 0x00000002,
ovrButton_RThumb = 0x00000004,
ovrButton_RShoulder = 0x00000008,
+ ovrButton_RMask = ovrButton_A | ovrButton_B | ovrButton_RThumb | ovrButton_RShoulder,
ovrButton_X = 0x00000100,
ovrButton_Y = 0x00000200,
ovrButton_LThumb = 0x00000400,
ovrButton_LShoulder = 0x00000800,
+ ovrButton_LMask = ovrButton_X | ovrButton_Y | ovrButton_LThumb | ovrButton_LShoulder,
ovrButton_Up = 0x00010000,
ovrButton_Down = 0x00020000,
ovrButton_Left = 0x00040000,
ovrButton_Right = 0x00080000,
ovrButton_Enter = 0x00100000,
ovrButton_Back = 0x00200000,
- ovrButton_Private = 0x00400000 | 0x00800000 | 0x01000000,
+ ovrButton_VolUp = 0x00400000,
+ ovrButton_VolDown = 0x00800000,
+ ovrButton_Home = 0x01000000,
+ ovrButton_Private = ovrButton_VolUp | ovrButton_VolDown | ovrButton_Home,
ovrButton_EnumSize = 0x7fffffff
} ovrButton;
typedef enum {
ovrTouch_A = ovrButton_A,
ovrTouch_B = ovrButton_B,
ovrTouch_RThumb = ovrButton_RThumb,
ovrTouch_RIndexTrigger = 0x00000010,
+ ovrTouch_RButtonMask = ovrTouch_A | ovrTouch_B | ovrTouch_RThumb | ovrTouch_RIndexTrigger,
ovrTouch_X = ovrButton_X,
ovrTouch_Y = ovrButton_Y,
ovrTouch_LThumb = ovrButton_LThumb,
ovrTouch_LIndexTrigger = 0x00001000,
+ ovrTouch_LButtonMask = ovrTouch_X | ovrTouch_Y | ovrTouch_LThumb | ovrTouch_LIndexTrigger,
ovrTouch_RIndexPointing = 0x00000020,
ovrTouch_RThumbUp = 0x00000040,
+ ovrTouch_RPoseMask = ovrTouch_RIndexPointing | ovrTouch_RThumbUp,
ovrTouch_LIndexPointing = 0x00002000,
ovrTouch_LThumbUp = 0x00004000,
+ ovrTouch_LPoseMask = ovrTouch_LIndexPointing | ovrTouch_LThumbUp,
ovrTouch_EnumSize = 0x7fffffff
} ovrTouch;
typedef enum {
ovrControllerType_None = 0x00,
ovrControllerType_LTouch = 0x01,
ovrControllerType_RTouch = 0x02,
ovrControllerType_Touch = 0x03,
+ ovrControllerType_Remote = 0x04,
ovrControllerType_XBox = 0x10,
- ovrControllerType_All = 0xff,
+ ovrControllerType_Active = 0xff,
ovrControllerType_EnumSize = 0x7fffffff
} ovrControllerType;
typedef enum {
ovrHand_Left = 0,
ovrHand_Right = 1,
+ ovrHand_Count = 2,
ovrHand_EnumSize = 0x7fffffff
} ovrHandType;
typedef struct {
- double TimeInSeconds;
- unsigned int ConnectedControllerTypes;
- unsigned int Buttons;
- unsigned int Touches;
- float IndexTrigger[2];
- float HandTrigger[2];
- ovrVector2f Thumbstick[2];
+ double TimeInSeconds;
+ unsigned int Buttons;
+ unsigned int Touches;
+ float IndexTrigger[ovrHand_Count];
+ float HandTrigger[ovrHand_Count];
+ ovrVector2f Thumbstick[ovrHand_Count];
+ ovrControllerType ControllerType;
} ovrInputState;
typedef enum {
ovrInit_Debug = 0x00000001,
ovrInit_RequestVersion = 0x00000004,
ovrinit_WritableBits = 0x00ffffff,
ovrInit_EnumSize = 0x7fffffff
} ovrInitFlags;
typedef enum {
ovrLogLevel_Debug = 0,
ovrLogLevel_Info = 1,
ovrLogLevel_Error = 2,
ovrLogLevel_EnumSize = 0x7fffffff
} ovrLogLevel;
-typedef void (OVR_PFN *ovrLogCallback)(int level, const char* message);
+typedef void (OVR_PFN* ovrLogCallback)(uintptr_t userData, int level, const char* message);
typedef struct OVR_ALIGNAS(8) {
uint32_t Flags;
uint32_t RequestedMinorVersion;
ovrLogCallback LogCallback;
uintptr_t UserData;
uint32_t ConnectionTimeoutMS;
- OVR_ON64(unsigned char pad0[4];)
+ OVR_ON64(OVR_UNUSED_STRUCT_PAD(pad0, 4))
} ovrInitParams;
-typedef ovrResult(OVR_PFN *pfn_ovr_Initialize)(ovrInitParams const* params);
-typedef void (OVR_PFN *pfn_ovr_Shutdown)();
+typedef ovrResult(OVR_PFN* pfn_ovr_Initialize)(const ovrInitParams* params);
+typedef void (OVR_PFN* pfn_ovr_Shutdown)();
typedef struct {
ovrResult Result;
char ErrorString[512];
} ovrErrorInfo;
-typedef void (OVR_PFN *pfn_ovr_GetLastErrorInfo)(ovrErrorInfo* errorInfo);
-typedef const char* (OVR_PFN *pfn_ovr_GetVersionString)();
-typedef int (OVR_PFN *pfn_ovr_TraceMessage)(int level, const char* message);
-typedef ovrHmdDesc (OVR_PFN *pfn_ovr_GetHmdDesc)(ovrSession session);
-typedef ovrResult (OVR_PFN *pfn_ovr_Create)(ovrSession*, ovrGraphicsLuid*);
-typedef void (OVR_PFN *pfn_ovr_Destroy)(ovrSession session);
+typedef void (OVR_PFN* pfn_ovr_GetLastErrorInfo)(ovrErrorInfo* errorInfo);
+typedef const char* (OVR_PFN* pfn_ovr_GetVersionString)();
+typedef int (OVR_PFN* pfn_ovr_TraceMessage)(int level, const char* message);
+typedef ovrHmdDesc (OVR_PFN* pfn_ovr_GetHmdDesc)(ovrSession session);
+typedef unsigned int (OVR_PFN* pfn_ovr_GetTrackerCount)(ovrSession session);
+typedef ovrTrackerDesc* (OVR_PFN* pfn_ovr_GetTrackerDesc)(ovrSession session, unsigned int trackerDescIndex);
+typedef ovrResult (OVR_PFN* pfn_ovr_Create)(ovrSession* pSession, ovrGraphicsLuid* pLuid);
+typedef void (OVR_PFN* pfn_ovr_Destroy)(ovrSession session);
typedef struct {
- ovrBool HasVrFocus;
+ ovrBool IsVisible;
ovrBool HmdPresent;
+ ovrBool HmdMounted;
+ ovrBool DisplayLost;
+ ovrBool ShouldQuit;
+ ovrBool ShouldRecenter;
} ovrSessionStatus;
-typedef ovrResult (OVR_PFN *pfn_ovr_GetSessionStatus)(ovrSession session, ovrSessionStatus* sessionStatus);
-typedef unsigned int (OVR_PFN *pfn_ovr_GetEnabledCaps)(ovrSession session);
-typedef void (OVR_PFN *pfn_ovr_SetEnabledCaps)(ovrSession session, unsigned int hmdCaps);
-typedef unsigned int (OVR_PFN *pfn_ovr_GetTrackingCaps)(ovrSession session);
-typedef ovrResult(OVR_PFN *pfn_ovr_ConfigureTracking)(ovrSession session, unsigned int requestedTrackingCaps, unsigned int requiredTrackingCaps);
-typedef void (OVR_PFN *pfn_ovr_RecenterPose)(ovrSession session);
-typedef ovrTrackingState (OVR_PFN *pfn_ovr_GetTrackingState)(ovrSession session, double absTime, ovrBool latencyMarker);
-typedef ovrResult (OVR_PFN *pfn_ovr_GetInputState)(ovrSession session, unsigned int controllerTypeMask, ovrInputState* inputState);
-typedef ovrResult (OVR_PFN *pfn_ovr_SetControllerVibration)(ovrSession session, unsigned int controllerTypeMask, float frequency, float amplitude);
+typedef ovrResult (OVR_PFN* pfn_ovr_GetSessionStatus)(ovrSession session, ovrSessionStatus* sessionStatus);
+
+typedef ovrResult (OVR_PFN* pfn_ovr_SetTrackingOriginType)(ovrSession session, ovrTrackingOrigin origin);
+typedef ovrTrackingOrigin (OVR_PFN* pfn_ovr_GetTrackingOriginType)(ovrSession session);
+typedef ovrResult (OVR_PFN* pfn_ovr_RecenterTrackingOrigin)(ovrSession session);
+typedef void (OVR_PFN* pfn_ovr_ClearShouldRecenterFlag)(ovrSession session);
+typedef ovrTrackingState (OVR_PFN* pfn_ovr_GetTrackingState)(ovrSession session, double absTime, ovrBool latencyMarker);
+typedef ovrTrackerPose (OVR_PFN* pfn_ovr_GetTrackerPose)(ovrSession session, unsigned int trackerPoseIndex);
+typedef ovrResult (OVR_PFN* pfn_ovr_GetInputState)(ovrSession session, ovrControllerType controllerType, ovrInputState* inputState);
+typedef unsigned int (OVR_PFN* pfn_ovr_GetConnectedControllerTypes)(ovrSession session);
+typedef ovrResult (OVR_PFN* pfn_ovr_SetControllerVibration)(ovrSession session, ovrControllerType controllerType, float frequency, float amplitude);
enum {
- ovrMaxLayerCount = 32
+ ovrMaxLayerCount = 16
};
typedef enum {
ovrLayerType_Disabled = 0,
ovrLayerType_EyeFov = 1,
- ovrLayerType_EyeFovDepth = 2,
ovrLayerType_Quad = 3,
ovrLayerType_EyeMatrix = 5,
- ovrLayerType_Direct = 6,
ovrLayerType_EnumSize = 0x7fffffff
} ovrLayerType;
typedef enum {
ovrLayerFlag_HighQuality = 0x01,
ovrLayerFlag_TextureOriginAtBottomLeft = 0x02,
ovrLayerFlag_HeadLocked = 0x04
} ovrLayerFlags;
typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) {
- ovrLayerType Type;
- unsigned Flags;
+ ovrLayerType Type;
+ unsigned Flags;
} ovrLayerHeader;
typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) {
- ovrLayerHeader Header;
- ovrSwapTextureSet* ColorTexture[ovrEye_Count];
- ovrRecti Viewport[ovrEye_Count];
- ovrFovPort Fov[ovrEye_Count];
- ovrPosef RenderPose[ovrEye_Count];
- double SensorSampleTime;
+ ovrLayerHeader Header;
+ ovrTextureSwapChain ColorTexture[ovrEye_Count];
+ ovrRecti Viewport[ovrEye_Count];
+ ovrFovPort Fov[ovrEye_Count];
+ ovrPosef RenderPose[ovrEye_Count];
+ double SensorSampleTime;
} ovrLayerEyeFov;
typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) {
- ovrLayerHeader Header;
- ovrSwapTextureSet* ColorTexture[ovrEye_Count];
- ovrRecti Viewport[ovrEye_Count];
- ovrFovPort Fov[ovrEye_Count];
- ovrPosef RenderPose[ovrEye_Count];
- double SensorSampleTime;
- ovrSwapTextureSet* DepthTexture[ovrEye_Count];
- ovrTimewarpProjectionDesc ProjectionDesc;
-} ovrLayerEyeFovDepth;
-
-typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) {
- ovrLayerHeader Header;
- ovrSwapTextureSet* ColorTexture[ovrEye_Count];
- ovrRecti Viewport[ovrEye_Count];
- ovrPosef RenderPose[ovrEye_Count];
- ovrMatrix4f Matrix[ovrEye_Count];
- double SensorSampleTime;
+ ovrLayerHeader Header;
+ ovrTextureSwapChain ColorTexture[ovrEye_Count];
+ ovrRecti Viewport[ovrEye_Count];
+ ovrPosef RenderPose[ovrEye_Count];
+ ovrMatrix4f Matrix[ovrEye_Count];
+ double SensorSampleTime;
} ovrLayerEyeMatrix;
typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) {
- ovrLayerHeader Header;
- ovrSwapTextureSet* ColorTexture;
- ovrRecti Viewport;
- ovrPosef QuadPoseCenter;
- ovrVector2f QuadSize;
+ ovrLayerHeader Header;
+ ovrTextureSwapChain ColorTexture;
+ ovrRecti Viewport;
+ ovrPosef QuadPoseCenter;
+ ovrVector2f QuadSize;
} ovrLayerQuad;
-typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) {
- ovrLayerHeader Header;
- ovrSwapTextureSet* ColorTexture[ovrEye_Count];
- ovrRecti Viewport[ovrEye_Count];
-} ovrLayerDirect;
-
typedef union {
- ovrLayerHeader Header;
- ovrLayerEyeFov EyeFov;
- ovrLayerEyeFovDepth EyeFovDepth;
- ovrLayerQuad Quad;
- ovrLayerDirect Direct;
+ ovrLayerHeader Header;
+ ovrLayerEyeFov EyeFov;
+ ovrLayerQuad Quad;
} ovrLayer_Union;
-typedef void (OVR_PFN *pfn_ovr_DestroySwapTextureSet)(ovrSession session, ovrSwapTextureSet* textureSet);
-typedef void (OVR_PFN *pfn_ovr_DestroyMirrorTexture)(ovrSession session, ovrTexture* mirrorTexture);
-typedef ovrSizei (OVR_PFN *pfn_ovr_GetFovTextureSize)(ovrSession session, ovrEyeType eye, ovrFovPort fov, float pixelsPerDisplayPixel);
-typedef ovrEyeRenderDesc (OVR_PFN *pfn_ovr_GetRenderDesc)(ovrSession session, ovrEyeType eyeType, ovrFovPort fov);
-typedef ovrResult (OVR_PFN *pfn_ovr_SubmitFrame)(ovrSession session, unsigned int frameIndex,
- const ovrViewScaleDesc* viewScaleDesc,
- ovrLayerHeader const * const * layerPtrList, unsigned int layerCount);
-typedef double (OVR_PFN *pfn_ovr_GetPredictedDisplayTime)(ovrSession session, long long frameIndex);
-typedef double (OVR_PFN *pfn_ovr_GetTimeInSeconds)();
+
+typedef ovrResult (OVR_PFN* pfn_ovr_GetTextureSwapChainLength)(ovrSession session, ovrTextureSwapChain chain, int* out_Length);
+typedef ovrResult (OVR_PFN* pfn_ovr_GetTextureSwapChainCurrentIndex)(ovrSession session, ovrTextureSwapChain chain, int* out_Index);
+typedef ovrResult (OVR_PFN* pfn_ovr_GetTextureSwapChainDesc)(ovrSession session, ovrTextureSwapChain chain, ovrTextureSwapChainDesc* out_Desc);
+typedef ovrResult (OVR_PFN* pfn_ovr_CommitTextureSwapChain)(ovrSession session, ovrTextureSwapChain chain);
+typedef void (OVR_PFN* pfn_ovr_DestroyTextureSwapChain)(ovrSession session, ovrTextureSwapChain chain);
+typedef void (OVR_PFN* pfn_ovr_DestroyMirrorTexture)(ovrSession session, ovrMirrorTexture mirrorTexture);
+typedef ovrSizei(OVR_PFN* pfn_ovr_GetFovTextureSize)(ovrSession session, ovrEyeType eye, ovrFovPort fov, float pixelsPerDisplayPixel);
+typedef ovrEyeRenderDesc(OVR_PFN* pfn_ovr_GetRenderDesc)(ovrSession session, ovrEyeType eyeType, ovrFovPort fov);
+typedef ovrResult(OVR_PFN* pfn_ovr_SubmitFrame)(ovrSession session, unsigned int frameIndex,
+ const ovrViewScaleDesc* viewScaleDesc,
+ ovrLayerHeader const * const * layerPtrList, unsigned int layerCount);
+typedef double (OVR_PFN* pfn_ovr_GetPredictedDisplayTime)(ovrSession session, long long frameIndex);
+typedef double (OVR_PFN* pfn_ovr_GetTimeInSeconds)();
+
typedef enum {
ovrPerfHud_Off = 0,
- ovrPerfHud_LatencyTiming = 1,
- ovrPerfHud_RenderTiming = 2,
- ovrPerfHud_PerfHeadroom = 3,
- ovrPerfHud_VersionInfo = 4,
- ovrPerfHud_Count,
+ ovrPerfHud_PerfSummary = 1,
+ ovrPerfHud_LatencyTiming = 2,
+ ovrPerfHud_AppRenderTiming = 3,
+ ovrPerfHud_CompRenderTiming = 4,
+ ovrPerfHud_VersionInfo = 5,
+ ovrPerfHud_Count = 6,
ovrPerfHud_EnumSize = 0x7fffffff
} ovrPerfHudMode;
typedef enum {
ovrLayerHud_Off = 0,
ovrLayerHud_Info = 1,
ovrLayerHud_EnumSize = 0x7fffffff
} ovrLayerHudMode;
@@ -470,44 +524,47 @@ typedef enum {
ovrDebugHudStereo_Off = 0,
ovrDebugHudStereo_Quad = 1,
ovrDebugHudStereo_QuadWithCrosshair = 2,
ovrDebugHudStereo_CrosshairAtInfinity = 3,
ovrDebugHudStereo_Count,
ovrDebugHudStereo_EnumSize = 0x7fffffff
} ovrDebugHudStereoMode;
-typedef void (OVR_PFN *pfn_ovr_ResetBackOfHeadTracking)(ovrSession session);
-typedef void (OVR_PFN *pfn_ovr_ResetMulticameraTracking)(ovrSession session);
-typedef ovrBool (OVR_PFN *pfn_ovr_GetBool)(ovrSession session, const char* propertyName, ovrBool defaultVal);
-typedef ovrBool (OVR_PFN *pfn_ovr_SetBool)(ovrSession session, const char* propertyName, ovrBool value);
-typedef int (OVR_PFN *pfn_ovr_GetInt)(ovrSession session, const char* propertyName, int defaultVal);
-typedef ovrBool (OVR_PFN *pfn_ovr_SetInt)(ovrSession session, const char* propertyName, int value);
-typedef float (OVR_PFN *pfn_ovr_GetFloat)(ovrSession session, const char* propertyName, float defaultVal);
-typedef ovrBool (OVR_PFN *pfn_ovr_SetFloat)(ovrSession session, const char* propertyName, float value);
-typedef unsigned int (OVR_PFN *pfn_ovr_GetFloatArray)(ovrSession session, const char* propertyName,
+typedef ovrBool(OVR_PFN* pfn_ovr_GetBool)(ovrSession session, const char* propertyName, ovrBool defaultVal);
+typedef ovrBool(OVR_PFN* pfn_ovr_SetBool)(ovrSession session, const char* propertyName, ovrBool value);
+typedef int (OVR_PFN* pfn_ovr_GetInt)(ovrSession session, const char* propertyName, int defaultVal);
+typedef ovrBool (OVR_PFN* pfn_ovr_SetInt)(ovrSession session, const char* propertyName, int value);
+typedef float (OVR_PFN* pfn_ovr_GetFloat)(ovrSession session, const char* propertyName, float defaultVal);
+typedef ovrBool (OVR_PFN* pfn_ovr_SetFloat)(ovrSession session, const char* propertyName, float value);
+typedef unsigned int (OVR_PFN* pfn_ovr_GetFloatArray)(ovrSession session, const char* propertyName,
float values[], unsigned int valuesCapacity);
-typedef ovrBool (OVR_PFN *pfn_ovr_SetFloatArray)(ovrSession session, const char* propertyName,
+typedef ovrBool (OVR_PFN* pfn_ovr_SetFloatArray)(ovrSession session, const char* propertyName,
const float values[], unsigned int valuesSize);
-typedef const char* (OVR_PFN *pfn_ovr_GetString)(ovrSession session, const char* propertyName,
+typedef const char* (OVR_PFN* pfn_ovr_GetString)(ovrSession session, const char* propertyName,
const char* defaultVal);
-typedef ovrBool (OVR_PFN *pfn_ovr_SetString)(ovrSession session, const char* propertyName,
+typedef ovrBool (OVR_PFN* pfn_ovr_SetString)(ovrSession session, const char* propertyName,
const char* value);
typedef enum {
ovrError_MemoryAllocationFailure = -1000,
ovrError_SocketCreationFailure = -1001,
ovrError_InvalidSession = -1002,
ovrError_Timeout = -1003,
ovrError_NotInitialized = -1004,
ovrError_InvalidParameter = -1005,
ovrError_ServiceError = -1006,
ovrError_NoHmd = -1007,
+ ovrError_Unsupported = -1009,
+ ovrError_DeviceUnavailable = -1010,
+ ovrError_InvalidHeadsetOrientation = -1011,
+ ovrError_ClientSkippedDestroy = -1012,
+ ovrError_ClientSkippedShutdown = -1013,
ovrError_AudioReservedBegin = -2000,
ovrError_AudioDeviceNotFound = -2001,
ovrError_AudioComError = -2002,
ovrError_AudioReservedEnd = -2999,
ovrError_Initialize = -3000,
ovrError_LibLoad = -3001,
ovrError_LibVersion = -3002,
ovrError_ServiceConnection = -3003,
@@ -518,92 +575,110 @@ typedef enum {
ovrError_Reinitialization = -3008,
ovrError_MismatchedAdapters = -3009,
ovrError_LeakingResources = -3010,
ovrError_ClientVersion = -3011,
ovrError_OutOfDateOS = -3012,
ovrError_OutOfDateGfxDriver = -3013,
ovrError_IncompatibleGPU = -3014,
ovrError_NoValidVRDisplaySystem = -3015,
+ ovrError_Obsolete = -3016,
+ ovrError_DisabledOrDefaultAdapter = -3017,
+ ovrError_HybridGraphicsNotSupported = -3018,
+ ovrError_DisplayManagerInit = -3019,
+ ovrError_TrackerDriverInit = -3020,
ovrError_InvalidBundleAdjustment = -4000,
ovrError_USBBandwidth = -4001,
ovrError_USBEnumeratedSpeed = -4002,
ovrError_ImageSensorCommError = -4003,
ovrError_GeneralTrackerFailure = -4004,
ovrError_ExcessiveFrameTruncation = -4005,
ovrError_ExcessiveFrameSkipping = -4006,
ovrError_SyncDisconnected = -4007,
ovrError_TrackerMemoryReadFailure = -4008,
ovrError_TrackerMemoryWriteFailure = -4009,
ovrError_TrackerFrameTimeout = -4010,
ovrError_TrackerTruncatedFrame = -4011,
+ ovrError_TrackerDriverFailure = -4012,
+ ovrError_TrackerNRFFailure = -4013,
+ ovrError_HardwareGone = -4014,
+ ovrError_NordicEnabledNoSync = -4015,
+ ovrError_NordicSyncNoFrames = -4016,
+ ovrError_CatastrophicFailure = -4017,
ovrError_HMDFirmwareMismatch = -4100,
ovrError_TrackerFirmwareMismatch = -4101,
ovrError_BootloaderDeviceDetected = -4102,
ovrError_TrackerCalibrationError = -4103,
ovrError_ControllerFirmwareMismatch = -4104,
+ ovrError_IMUTooManyLostSamples = -4200,
+ ovrError_IMURateError = -4201,
+ ovrError_FeatureReportFailure = -4202,
ovrError_Incomplete = -5000,
ovrError_Abandoned = -5001,
ovrError_DisplayLost = -6000,
+ ovrError_TextureSwapChainFull = -6001,
+ ovrError_TextureSwapChainInvalid = -6002,
ovrError_RuntimeException = -7000,
+ ovrError_MetricsUnknownApp = -90000,
+ ovrError_MetricsDuplicateApp = -90001,
+ ovrError_MetricsNoEvents = -90002,
+ ovrError_MetricsRuntime = -90003,
+ ovrError_MetricsFile = -90004,
+ ovrError_MetricsNoClientInfo = -90005,
+ ovrError_MetricsNoAppMetaData = -90006,
+ ovrError_MetricsNoApp = -90007,
+ ovrError_MetricsOafFailure = -90008,
+ ovrError_MetricsSessionAlreadyActive = -90009,
+ ovrError_MetricsSessionNotActive = -90010,
} ovrErrorType;
#ifdef XP_WIN
-struct D3D11_TEXTURE2D_DESC;
-struct ID3D11Device;
-struct ID3D11Texture2D;
-struct ID3D11ShaderResourceView;
+
+struct IUnknown;
-typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) {
- ovrTextureHeader Header;
- OVR_ON64(uint32_t pad0;)
- ID3D11Texture2D* pTexture;
- ID3D11ShaderResourceView* pSRView;
-} ovrD3D11TextureData;
+typedef ovrResult (OVR_PFN* pfn_ovr_CreateTextureSwapChainDX)(ovrSession session,
+ IUnknown* d3dPtr,
+ const ovrTextureSwapChainDesc* desc,
+ ovrTextureSwapChain* out_TextureSwapChain);
-typedef union {
- ovrTexture Texture;
- ovrD3D11TextureData D3D11;
-} ovrD3D11Texture;
-
-typedef enum {
- ovrSwapTextureSetD3D11_Typeless = 0x0001,
- ovrSwapTextureSetD3D11_EnumSize = 0x7fffffff
-} ovrSwapTextureSetD3D11Flags;
+typedef ovrResult (OVR_PFN* pfn_ovr_GetTextureSwapChainBufferDX)(ovrSession session,
+ ovrTextureSwapChain chain,
+ int index,
+ IID iid,
+ void** out_Buffer);
-typedef ovrResult (OVR_PFN *pfn_ovr_CreateSwapTextureSetD3D11)(ovrSession session, ID3D11Device* device,
- const D3D11_TEXTURE2D_DESC* desc,
- unsigned int miscFlags,
- ovrSwapTextureSet** outTextureSet);
+typedef ovrResult (OVR_PFN* pfn_ovr_CreateMirrorTextureDX)(ovrSession session,
+ IUnknown* d3dPtr,
+ const ovrMirrorTextureDesc* desc,
+ ovrMirrorTexture* out_MirrorTexture);
-typedef ovrResult (OVR_PFN *pfn_ovr_CreateMirrorTextureD3D11)(ovrSession session,
- ID3D11Device* device,
- const D3D11_TEXTURE2D_DESC* desc,
- unsigned int miscFlags,
- ovrTexture** outMirrorTexture);
+typedef ovrResult (OVR_PFN* pfn_ovr_GetMirrorTextureBufferDX)(ovrSession session,
+ ovrMirrorTexture mirrorTexture,
+ IID iid,
+ void** out_Buffer);
#endif
-typedef struct {
- ovrTextureHeader Header;
- uint32_t TexId;
-} ovrGLTextureData;
+
+typedef ovrResult (OVR_PFN* pfn_ovr_CreateTextureSwapChainGL)(ovrSession session,
+ const ovrTextureSwapChainDesc* desc,
+ ovrTextureSwapChain* out_TextureSwapChain);
-typedef union {
- ovrTexture Texture;
- ovrGLTextureData OGL;
-} ovrGLTexture;
+typedef ovrResult (OVR_PFN* pfn_ovr_GetTextureSwapChainBufferGL)(ovrSession session,
+ ovrTextureSwapChain chain,
+ int index,
+ unsigned int* out_TexId);
-typedef ovrResult (OVR_PFN *pfn_ovr_CreateSwapTextureSetGL)(ovrSession session, uint32_t format,
- int width, int height,
- ovrSwapTextureSet** outTextureSet);
+typedef ovrResult (OVR_PFN* pfn_ovr_CreateMirrorTextureGL)(ovrSession session,
+ const ovrMirrorTextureDesc* desc,
+ ovrMirrorTexture* out_MirrorTexture);
-typedef ovrResult (OVR_PFN *pfn_ovr_CreateMirrorTextureGL)(ovrSession session, uint32_t format,
- int width, int height,
- ovrTexture** outMirrorTexture);
+typedef ovrResult (OVR_PFN* pfn_ovr_GetMirrorTextureBufferGL)(ovrSession session,
+ ovrMirrorTexture mirrorTexture,
+ unsigned int* out_TexId);
#ifdef __cplusplus
}
#endif
#endif /* mozilla_ovr_capi_dynamic_h_ */
#endif /* OVR_CAPI_h */