-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Oculus Quest 2 support at RHI level (#14)
Signed-off-by: moraaar <[email protected]> - OpenXRVk uses Oculus's version of OpenXR library when built with `--oculus-project` option. If not present it will error whiule building with instruction of how to obtain Oculus OpenXR Mobile SDK. - Also added instructions under `OpenXRVk/External/OculusOpenXRMobileSDK/` folder with how to download Oculus OpenXR Mobile SDK. - Added `OpenXRVk/3rdParty/Platform/Android/FindOpenXROculus.cmake` which adds the 3rdparty target and checks if the Oculus OpenXR Mobile SDK has been downloaded to the external folder. - On Android platform it needs to initialize the loader before calling XR functions, otherwise it crashes. - Added functions to obtain xr swap chain format, necessary when creating the swapchains from Atom Vulkan side. These changes go together with these changes o3de/o3de#11310 Tests done: Built ASV project on PC and Android. Run `RHI/OpenXr` sample on ASV on PC and Android. Available here: https://github.com/aws-lumberyard-dev/o3de-atom-sampleviewer/tree/openxr. Run on Android passing the options `-openxr=enable -sample=RHI/OpenXr`. Built android with and without `--oculus-project` option and checked the manifest and OpenXR 3rdparty used are correct in each case. NOTE: At the moment there is this bug when running `RHI/OpenXr` sample on Quest 2 natively: o3de/o3de#11254
- Loading branch information
Showing
13 changed files
with
156 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
Gems/OpenXRVk/3rdParty/Platform/Android/FindOpenXROculus.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# | ||
# Copyright (c) Contributors to the Open 3D Engine Project. | ||
# For complete copyright and license terms please see the LICENSE at the root of this distribution. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 OR MIT | ||
# | ||
# | ||
|
||
# this file actually ingests the library and defines targets. | ||
set(TARGET_WITH_NAMESPACE "3rdParty::OpenXROculus") | ||
if (TARGET ${TARGET_WITH_NAMESPACE}) | ||
return() | ||
endif() | ||
|
||
set(MY_NAME "OpenXROculus") | ||
|
||
get_property(openxrvk_gem_root GLOBAL PROPERTY "@GEMROOT:OpenXRVk@") | ||
|
||
set(OculusOpenXRSDKPath ${openxrvk_gem_root}/External/OculusOpenXRMobileSDK) | ||
|
||
set(${MY_NAME}_INCLUDE_DIR | ||
${OculusOpenXRSDKPath}/3rdParty/khronos/openxr/OpenXR-SDK/include | ||
${OculusOpenXRSDKPath}/OpenXR/Include) | ||
|
||
set(PATH_TO_SHARED_LIBS ${OculusOpenXRSDKPath}/OpenXR/Libs/Android/arm64-v8a) | ||
|
||
if(NOT EXISTS ${PATH_TO_SHARED_LIBS}/Release/libopenxr_loader.so) | ||
message(FATAL_ERROR | ||
"Oculus OpenXR loader library not found at ${PATH_TO_SHARED_LIBS}/Release. " | ||
"Oculus OpenXR Mobile SDK needs to be downloaded via https://developer.oculus.com/downloads/native-android/ " | ||
"and uncompressed into OpenXRVk/External/OculusOpenXRMobileSDK folder.") | ||
return() | ||
endif() | ||
|
||
add_library(${TARGET_WITH_NAMESPACE} SHARED IMPORTED GLOBAL) | ||
ly_target_include_system_directories(TARGET ${TARGET_WITH_NAMESPACE} INTERFACE ${${MY_NAME}_INCLUDE_DIR}) | ||
set_target_properties(${TARGET_WITH_NAMESPACE} | ||
PROPERTIES | ||
IMPORTED_LOCATION ${PATH_TO_SHARED_LIBS}/Release/libopenxr_loader.so | ||
IMPORTED_LOCATION_DEBUG ${PATH_TO_SHARED_LIBS}/Debug/libopenxr_loader.so) | ||
|
||
set(${MY_NAME}_FOUND True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Oculus OpenXR Mobile SDK | ||
|
||
The Oculus OpenXR Mobile SDK is not included as part of O3DE. | ||
|
||
When enabling OpenXRVk Gem, download the SDK and uncompress it in the following folder within the gem: `OpenXRVk\External\OculusOpenXRMobileSDK` | ||
|
||
The Oculus OpenXR Mobile SDK can be found in the following link: https://developer.oculus.com/downloads/native-android/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters