mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 19:42:53 +02:00
OpenXrContext: Improve errors when runtime is not available.
This commit is contained in:
parent
473bd4d64e
commit
be3e12b18c
1 changed files with 19 additions and 4 deletions
|
@ -49,11 +49,14 @@ static bool initFunctionPointers(XrInstance instance) {
|
||||||
OpenXrContext::OpenXrContext() {
|
OpenXrContext::OpenXrContext() {
|
||||||
_isSupported = initPreGraphics();
|
_isSupported = initPreGraphics();
|
||||||
if (!_isSupported) {
|
if (!_isSupported) {
|
||||||
qCCritical(xr_context_cat, "Pre graphics init failed.");
|
qCWarning(xr_context_cat, "OpenXR is not supported.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenXrContext::~OpenXrContext() {
|
OpenXrContext::~OpenXrContext() {
|
||||||
|
if (_instance == XR_NULL_HANDLE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
XrResult res = xrDestroyInstance(_instance);
|
XrResult res = xrDestroyInstance(_instance);
|
||||||
if (res != XR_SUCCESS) {
|
if (res != XR_SUCCESS) {
|
||||||
qCCritical(xr_context_cat, "Failed to destroy OpenXR instance");
|
qCCritical(xr_context_cat, "Failed to destroy OpenXR instance");
|
||||||
|
@ -65,7 +68,13 @@ bool OpenXrContext::initInstance() {
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
XrResult result = xrEnumerateInstanceExtensionProperties(nullptr, 0, &count, nullptr);
|
XrResult result = xrEnumerateInstanceExtensionProperties(nullptr, 0, &count, nullptr);
|
||||||
|
|
||||||
if (!xrCheck(XR_NULL_HANDLE, result, "Failed to enumerate number of extension properties"))
|
// Since this is the first OpenXR call we do, check here if RUNTIME_UNAVAILABLE is returned.
|
||||||
|
if (result == XR_ERROR_RUNTIME_UNAVAILABLE) {
|
||||||
|
qCCritical(xr_context_cat, "XR_ERROR_RUNTIME_UNAVAILABLE: Is XR_RUNTIME_JSON set correctly?");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!xrCheck(XR_NULL_HANDLE, result, "Failed to enumerate number of extensions."))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::vector<XrExtensionProperties> properties;
|
std::vector<XrExtensionProperties> properties;
|
||||||
|
@ -75,7 +84,7 @@ bool OpenXrContext::initInstance() {
|
||||||
}
|
}
|
||||||
|
|
||||||
result = xrEnumerateInstanceExtensionProperties(nullptr, count, &count, properties.data());
|
result = xrEnumerateInstanceExtensionProperties(nullptr, count, &count, properties.data());
|
||||||
if (!xrCheck(XR_NULL_HANDLE, result, "Failed to enumerate extension properties"))
|
if (!xrCheck(XR_NULL_HANDLE, result, "Failed to enumerate extensions."))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool openglSupported = false;
|
bool openglSupported = false;
|
||||||
|
@ -109,7 +118,13 @@ bool OpenXrContext::initInstance() {
|
||||||
};
|
};
|
||||||
|
|
||||||
result = xrCreateInstance(&info, &_instance);
|
result = xrCreateInstance(&info, &_instance);
|
||||||
if (!xrCheck(XR_NULL_HANDLE, result, "Failed to create XR instance."))
|
|
||||||
|
if (result == XR_ERROR_RUNTIME_FAILURE) {
|
||||||
|
qCCritical(xr_context_cat, "XR_ERROR_RUNTIME_FAILURE: Is the OpenXR runtime up and running?");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!xrCheck(XR_NULL_HANDLE, result, "Failed to create OpenXR instance."))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!initFunctionPointers(_instance))
|
if (!initFunctionPointers(_instance))
|
||||||
|
|
Loading…
Reference in a new issue