mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
st/oxr: Fix API negotiation code
This commit is contained in:
parent
3a89e2f0d4
commit
08a4b40f77
|
@ -66,26 +66,29 @@ oxr_xrCreateInstance(const XrInstanceCreateInfo* createInfo,
|
|||
oxr_log_init(&log, "xrCreateInstance");
|
||||
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, createInfo,
|
||||
XR_TYPE_INSTANCE_CREATE_INFO);
|
||||
#if XR_VERSION_MAJOR != 0
|
||||
#error "Must update this code following 1.0 release!"
|
||||
#endif
|
||||
const uint32_t major = XR_VERSION_MAJOR(XR_CURRENT_API_VERSION);
|
||||
const uint32_t minor = XR_VERSION_MINOR(XR_CURRENT_API_VERSION);
|
||||
/* const uint32_t patch = XR_VERSION_PATCH(XR_CURRENT_API_VERSION);*/
|
||||
#if 0
|
||||
const uint32_t patch = XR_VERSION_PATCH(XR_CURRENT_API_VERSION);
|
||||
#endif
|
||||
|
||||
if (createInfo->applicationInfo.apiVersion <
|
||||
XR_MAKE_VERSION(major, minor, 0)) {
|
||||
return oxr_error(
|
||||
&log, XR_ERROR_RUNTIME_VERSION_INCOMPATIBLE,
|
||||
&log, XR_ERROR_API_VERSION_UNSUPPORTED,
|
||||
"(createInfo->applicationInfo.apiVersion) "
|
||||
"Cannot satisfy request for version less than %d.%d.%d",
|
||||
major, minor, 0);
|
||||
}
|
||||
/* This is a slight fib, to let us approximately run pre-release
|
||||
* things between 0.90 and 1.0 */
|
||||
|
||||
/*
|
||||
* This is a slight fib, to let us approximately run things between 1.0
|
||||
* and 2.0
|
||||
*/
|
||||
if (createInfo->applicationInfo.apiVersion >=
|
||||
XR_MAKE_VERSION(1, 0, 0)) {
|
||||
XR_MAKE_VERSION(2, 0, 0)) {
|
||||
return oxr_error(
|
||||
&log, XR_ERROR_RUNTIME_VERSION_INCOMPATIBLE,
|
||||
&log, XR_ERROR_API_VERSION_UNSUPPORTED,
|
||||
"(createInfo->applicationInfo.apiVersion) "
|
||||
"Cannot satisfy request for version: too high");
|
||||
}
|
||||
|
|
|
@ -59,33 +59,23 @@ xrNegotiateLoaderRuntimeInterface(const XrNegotiateLoaderInfo* loaderInfo,
|
|||
|
||||
// TODO: properly define what we support
|
||||
uint16_t supported_major = XR_VERSION_MAJOR(XR_CURRENT_API_VERSION);
|
||||
uint16_t supported_minor = XR_VERSION_MINOR(XR_CURRENT_API_VERSION);
|
||||
|
||||
uint16_t requested_min_major =
|
||||
XR_VERSION_MAJOR(loaderInfo->minInterfaceVersion);
|
||||
uint16_t requested_min_minor =
|
||||
XR_VERSION_MINOR(loaderInfo->minInterfaceVersion);
|
||||
|
||||
uint16_t requested_max_major =
|
||||
XR_VERSION_MAJOR(loaderInfo->maxInterfaceVersion);
|
||||
uint16_t requested_max_minor =
|
||||
XR_VERSION_MINOR(loaderInfo->maxInterfaceVersion);
|
||||
uint32_t requested_min_major = loaderInfo->minInterfaceVersion;
|
||||
uint32_t requested_max_major = loaderInfo->maxInterfaceVersion;
|
||||
|
||||
if (supported_major > requested_max_major ||
|
||||
supported_major < requested_min_major) {
|
||||
PRINT_NEGOTIATE(
|
||||
"\tXRT - OpenXR doesn't support requested version %d.%d <= "
|
||||
"%d.%d <= %d.%d",
|
||||
requested_min_major, requested_min_minor, supported_major,
|
||||
supported_minor, requested_max_major, requested_max_minor);
|
||||
"\tXRT - OpenXR doesn't support requested version %d <= "
|
||||
"%d <= %d\n",
|
||||
requested_min_major, supported_major, requested_max_major);
|
||||
return XR_ERROR_INITIALIZATION_FAILED;
|
||||
}
|
||||
|
||||
runtimeRequest->getInstanceProcAddr = oxr_xrGetInstanceProcAddr;
|
||||
runtimeRequest->runtimeInterfaceVersion =
|
||||
XR_CURRENT_LOADER_RUNTIME_VERSION;
|
||||
runtimeRequest->runtimeXrVersion =
|
||||
XR_MAKE_VERSION(0, XR_HEADER_VERSION, 0);
|
||||
runtimeRequest->runtimeApiVersion = XR_CURRENT_API_VERSION;
|
||||
|
||||
PRINT_NEGOTIATE("\tall ok!\n");
|
||||
|
||||
|
|
Loading…
Reference in a new issue