cancel
Showing results for 
Search instead for 
Did you mean: 

ovr_GetLastErrorInfo can't be called to diagnose ovr_Initialize failure?

darknight201
Explorer
According to the documentation ovr_GetLastErrorInfo should be able to be called when the runtime is not yet initialized. From OVR_CAPI.h:
/// Initializes LibOVR
///
/// Initialize LibOVR for application usage. This includes finding and loading the LibOVRRT
/// shared library. No LibOVR API functions, other than ovr_GetLastErrorInfo and ovr_Detect, can
/// be called unless ovr_Initialize succeeds....

According to this, I should be able to call ovr_GetLastErrorInfo to diagnose failures in ovr_Initialize().  However, calling ovr_GetLastErrorInfo instead seems to generate its own error indicating that the runtime is not yet initialized.

My example case intentionally tries to initialize the runtime with an invalid (future) runtime version.
ovrInitParams initParams = { ovrInit_RequestVersion | ovrInit_MixedRendering, 26, NULL, 0, 0 };
 ovrResult result = ovr_Initialize(&initParams);

The ovrResult that is returned is -3002 (LibOVRRT version incompatibility).

This correctly fails because the runtime cannot be initialized with the requested version. Unfortunately, if I immediately call ovr_GetLastErrorInfo() to translate -3002 into a human-readable string, it seems that ovr_GetLastErrorInfo() generates its own error. I get a ovrErrorInfo struct that is populated with:
{Result=-1004, ErrorString="" }

-1004 is a ovrError_NotInitialized error. 

Am I not understanding how this is supposed to work? How can I get a human-readable error message so that our users know that their Oculus runtime is out of date?
3 REPLIES 3

darknight201
Explorer
So it appears that this may be a bug in the 1.23 version of the Oculus SDK. Switching to the latest 1.24 release fixes the problem. I can now correctly call ovr_GetLastErrorInfo() without an initialized runtime. In my case I now get the same -3002 error returned with an error string: "Insufficient LibOVRRT version. Requested major.minor version: 1.25; LibOVRRT version: 1.24"

eah
Protege
@darknight201 yup this was fixed for 1.24 (it was discovered while trying to debug an initialization failure :smile:)

darknight201
Explorer
@eah
Thanks! Good to know I wasn't doing something wrong.