Commit da10794f authored by Patrick To's avatar Patrick To Committed by Commit Bot

Specify OpenXR API version when inializing the OpenXR runtime

The API version currently isn't passed into xrCreateInstance. This works
on today's OpenXR runtime from the Microsoft Store, but future runtimes
will throw an error if the version is not specified.

Bug: 1006428
Change-Id: I7243e848027957f2a4a51c3d564a3444fbc28ab5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1817023Reviewed-by: default avatarAlexander Cooper <alcooper@chromium.org>
Commit-Queue: Patrick To <patrto@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#699091}
parent 30d05d5f
...@@ -33,6 +33,7 @@ constexpr uint32_t kNumViews = 2; ...@@ -33,6 +33,7 @@ constexpr uint32_t kNumViews = 2;
XrResult CreateInstance(XrInstance* instance) { XrResult CreateInstance(XrInstance* instance) {
XrInstanceCreateInfo instance_create_info = {XR_TYPE_INSTANCE_CREATE_INFO}; XrInstanceCreateInfo instance_create_info = {XR_TYPE_INSTANCE_CREATE_INFO};
strcpy_s(instance_create_info.applicationInfo.applicationName, "Chromium"); strcpy_s(instance_create_info.applicationInfo.applicationName, "Chromium");
instance_create_info.applicationInfo.apiVersion = XR_CURRENT_API_VERSION;
// xrCreateInstance validates the list of extensions and returns // xrCreateInstance validates the list of extensions and returns
// XR_ERROR_EXTENSION_NOT_PRESENT if an extension is not supported, // XR_ERROR_EXTENSION_NOT_PRESENT if an extension is not supported,
......
...@@ -121,6 +121,9 @@ XrResult xrCreateInstance(const XrInstanceCreateInfo* create_info, ...@@ -121,6 +121,9 @@ XrResult xrCreateInstance(const XrInstanceCreateInfo* create_info,
XrInstance* instance) { XrInstance* instance) {
DLOG(INFO) << __FUNCTION__; DLOG(INFO) << __FUNCTION__;
RETURN_IF(create_info->applicationInfo.apiVersion != XR_CURRENT_API_VERSION,
XR_ERROR_API_VERSION_UNSUPPORTED, "apiVersion unsupported");
RETURN_IF(create_info->type != XR_TYPE_INSTANCE_CREATE_INFO, RETURN_IF(create_info->type != XR_TYPE_INSTANCE_CREATE_INFO,
XR_ERROR_VALIDATION_FAILURE, "XrInstanceCreateInfo type invalid"); XR_ERROR_VALIDATION_FAILURE, "XrInstanceCreateInfo type invalid");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment