diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cbe0ea..b7671b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,19 @@ All notable changes to this package will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.5.3] - 2022-09-18 +### Fixed +* Fixed `XRInputSubsystem.TryGetBoundaryPoints` returning inaccurate values. If you have guardian/boundary setup in the headset, `TryGetBoundaryPoints` will return a List of size 4 representing the four vertices of the Play Area rectangle, which is centered at the origin and edges corresponding to the X and Z axes of the provided space. Not all systems or spaces may support boundaries. +* Fixed an issue that controllers position not getting updated and stuck to the floor level when Oculus Integration Asset installed in the project. +* Fixed an issue that OpenXR libraries were included in build when OpenXR SDK is not enabled. +* Improved domain reload performance by removing unnecessary checks when entering Playmode. + +### Updated +* Updated Input System dependency to 1.4.2. + +### Added +* Added support for Android cross-vendor loader. + ## [1.5.1] - 2022-08-11 ### Fixed * Fixed compilation errors on Game Core platforms where `ENABLE_VR` is not currently defined. Requires Input System 1.4.0 or newer. diff --git a/ConformanceAutomation/ConformanceAutomationFeature.cs b/ConformanceAutomation/ConformanceAutomationFeature.cs index aea9cdb..cf41184 100644 --- a/ConformanceAutomation/ConformanceAutomationFeature.cs +++ b/ConformanceAutomation/ConformanceAutomationFeature.cs @@ -14,7 +14,7 @@ namespace UnityEngine.XR.OpenXR.Features.ConformanceAutomation #if UNITY_EDITOR [OpenXRFeature(UiName = "Conformance Automation", Hidden = true, - BuildTargetGroups = new []{UnityEditor.BuildTargetGroup.Standalone, UnityEditor.BuildTargetGroup.Android, UnityEditor.BuildTargetGroup.WSA, }, + BuildTargetGroups = new []{UnityEditor.BuildTargetGroup.Standalone, UnityEditor.BuildTargetGroup.Android, UnityEditor.BuildTargetGroup.WSA }, Company = "Unity", Desc = "The XR_EXT_conformance_automation allows conformance test and runtime developers to provide hints to the underlying runtime as to what input the test is expecting. This enables runtime authors to automate the testing of their runtime conformance.", DocumentationLink = Constants.k_DocumentationURL, diff --git a/ConformanceAutomation/android.meta b/ConformanceAutomation/android.meta index 7b8ee67..aed5e72 100644 --- a/ConformanceAutomation/android.meta +++ b/ConformanceAutomation/android.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6dd73f2d0b73453481e690b03e0db5b7 +guid: 3d7049c088ed4536a962d278358b5b1b folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/ConformanceAutomation/android/arm64.meta b/ConformanceAutomation/android/arm64.meta index c383da2..8716791 100644 --- a/ConformanceAutomation/android/arm64.meta +++ b/ConformanceAutomation/android/arm64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: db48b52d7e984ee08765e84367375086 +guid: 3c6520f807674817837452369a96b637 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/ConformanceAutomation/android/arm64/ConformanceAutomationExt.so.meta b/ConformanceAutomation/android/arm64/ConformanceAutomationExt.so.meta index 7c78db8..0cf1178 100644 --- a/ConformanceAutomation/android/arm64/ConformanceAutomationExt.so.meta +++ b/ConformanceAutomation/android/arm64/ConformanceAutomationExt.so.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: dbbe1f5d0c33416e927e258c3137523c +guid: a556cc13c1ef448a8daaf9e2be4f489e PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/ConformanceAutomation/universalwindows.meta b/ConformanceAutomation/universalwindows.meta index 5695462..6d61649 100644 --- a/ConformanceAutomation/universalwindows.meta +++ b/ConformanceAutomation/universalwindows.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a55d186b01e94de49b345ca549bec276 +guid: a77de568682e48c6be72653dc06130f1 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/ConformanceAutomation/universalwindows/arm32.meta b/ConformanceAutomation/universalwindows/arm32.meta index 08ec06f..211e303 100644 --- a/ConformanceAutomation/universalwindows/arm32.meta +++ b/ConformanceAutomation/universalwindows/arm32.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 53b37a4fc91a4b72987e8ea6d0933f0a +guid: 7e0b41a8b86548d79509b9ad6b52c501 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/ConformanceAutomation/universalwindows/arm32/ConformanceAutomationExt.dll b/ConformanceAutomation/universalwindows/arm32/ConformanceAutomationExt.dll index 0647680..df5e81d 100644 Binary files a/ConformanceAutomation/universalwindows/arm32/ConformanceAutomationExt.dll and b/ConformanceAutomation/universalwindows/arm32/ConformanceAutomationExt.dll differ diff --git a/ConformanceAutomation/universalwindows/arm32/ConformanceAutomationExt.dll.meta b/ConformanceAutomation/universalwindows/arm32/ConformanceAutomationExt.dll.meta index 8fe727d..b943b70 100644 --- a/ConformanceAutomation/universalwindows/arm32/ConformanceAutomationExt.dll.meta +++ b/ConformanceAutomation/universalwindows/arm32/ConformanceAutomationExt.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: ecd18a8bbfcc420191cbd298d6644c90 +guid: 869ac712b7fa4f78b6484e27fe42f5ea PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/ConformanceAutomation/universalwindows/arm64.meta b/ConformanceAutomation/universalwindows/arm64.meta index f60a342..6eb1ed3 100644 --- a/ConformanceAutomation/universalwindows/arm64.meta +++ b/ConformanceAutomation/universalwindows/arm64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 54aef7164c62457083e1fa5aaf2e9c91 +guid: 1af3b598683d417184ed9f7a0ec75216 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/ConformanceAutomation/universalwindows/arm64/ConformanceAutomationExt.dll b/ConformanceAutomation/universalwindows/arm64/ConformanceAutomationExt.dll index d8d2293..b873291 100644 Binary files a/ConformanceAutomation/universalwindows/arm64/ConformanceAutomationExt.dll and b/ConformanceAutomation/universalwindows/arm64/ConformanceAutomationExt.dll differ diff --git a/ConformanceAutomation/universalwindows/arm64/ConformanceAutomationExt.dll.meta b/ConformanceAutomation/universalwindows/arm64/ConformanceAutomationExt.dll.meta index c781075..00e9591 100644 --- a/ConformanceAutomation/universalwindows/arm64/ConformanceAutomationExt.dll.meta +++ b/ConformanceAutomation/universalwindows/arm64/ConformanceAutomationExt.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 92d642e74b034656835b51e6216bd39d +guid: 816a9667ee354eb1bdcabcdd566b5564 PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/ConformanceAutomation/universalwindows/x64.meta b/ConformanceAutomation/universalwindows/x64.meta index 986d7bc..6856bdb 100644 --- a/ConformanceAutomation/universalwindows/x64.meta +++ b/ConformanceAutomation/universalwindows/x64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a254606afd6b4b1b9678ebe6f0a08b4b +guid: 202d37da9d6a4b2a94e65c6b95751b36 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/ConformanceAutomation/universalwindows/x64/ConformanceAutomationExt.dll b/ConformanceAutomation/universalwindows/x64/ConformanceAutomationExt.dll index 74356f0..e873a66 100644 Binary files a/ConformanceAutomation/universalwindows/x64/ConformanceAutomationExt.dll and b/ConformanceAutomation/universalwindows/x64/ConformanceAutomationExt.dll differ diff --git a/ConformanceAutomation/universalwindows/x64/ConformanceAutomationExt.dll.meta b/ConformanceAutomation/universalwindows/x64/ConformanceAutomationExt.dll.meta index 00d8e6b..b11a4ad 100644 --- a/ConformanceAutomation/universalwindows/x64/ConformanceAutomationExt.dll.meta +++ b/ConformanceAutomation/universalwindows/x64/ConformanceAutomationExt.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7a5129aaf4cd4edc8d8e5584ef5c339e +guid: 6c0f0b53185a49b992ed114e5278ad7c PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/ConformanceAutomation/windows.meta b/ConformanceAutomation/windows.meta index 6941f94..4360a5b 100644 --- a/ConformanceAutomation/windows.meta +++ b/ConformanceAutomation/windows.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9caf535700624c188d27366827b0eada +guid: 42eb63fba681453191ae6396799b7377 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/ConformanceAutomation/windows/x64.meta b/ConformanceAutomation/windows/x64.meta index 220c18c..4723c77 100644 --- a/ConformanceAutomation/windows/x64.meta +++ b/ConformanceAutomation/windows/x64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6e3f71bb8dca46f385e9d15498d55bae +guid: eda412960cc8447eb74eea96828bac4a folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/ConformanceAutomation/windows/x64/ConformanceAutomationExt.dll b/ConformanceAutomation/windows/x64/ConformanceAutomationExt.dll index c19a369..fa84182 100644 Binary files a/ConformanceAutomation/windows/x64/ConformanceAutomationExt.dll and b/ConformanceAutomation/windows/x64/ConformanceAutomationExt.dll differ diff --git a/ConformanceAutomation/windows/x64/ConformanceAutomationExt.dll.meta b/ConformanceAutomation/windows/x64/ConformanceAutomationExt.dll.meta index 558d83f..fc187aa 100644 --- a/ConformanceAutomation/windows/x64/ConformanceAutomationExt.dll.meta +++ b/ConformanceAutomation/windows/x64/ConformanceAutomationExt.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 390a0fabf6564ae7b005bcba7a44ab7e +guid: 331bfda581324cddbf4c2f05419f3cce PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/Documentation~/features/oculusquest.md b/Documentation~/features/oculusquest.md index 5307060..54a7dfe 100644 --- a/Documentation~/features/oculusquest.md +++ b/Documentation~/features/oculusquest.md @@ -1,5 +1,15 @@ # Oculus Quest Support -In order to deploy to Oculus Quest, enable the Oculus Quest Support feature on the Android build target. Android apks that are produced with this feature enabled will be able to run on the Quest family of devices. +In order to deploy to Oculus Quest, enable the Oculus Quest Support feature on the Android build target: -For details on what happens when this feature is enabled, see [Oculus' OpenXR Mobile SDK](https://developer.oculus.com/downloads/package/oculus-openxr-mobile-sdk/) +1. Open the Project Settings window (menu: **Edit > Project Settings**). +2. Select the **XR Plug-in Management** from the list of settings on the left. +3. If necessary, enable **OpenXR** in the list of **Plug-in Providers**. Unity installs the OpenXR plug-in, if not already installed. +4. Select the OpenXR settings page under XR Plug-in Management. +5. Add the **Oculus Touch Controller Profile** to the **Interaction Profiles** list. (You can have multiple profiles enabled in the list, the OpenXR chooses the one to use based on the current device at runtime.) +6. Enable **Oculus Quest Support** under **OpenXR Feature Groups**. + +The Android apks that are produced with Quest support enabled can be run on the Quest family of devices. +See the [XR](xref:XR) section of the Unity Manual for more information about developing VR games and applications. + +For information about Meta company's Oculus support development roadmap, see [Oculus All In on OpenXR: Deprecates Proprietary APIs](https://developer.oculus.com/blog/oculus-all-in-on-openxr-deprecates-proprietary-apis/). diff --git a/Documentation~/index.md b/Documentation~/index.md index 3737f66..74135e7 100644 --- a/Documentation~/index.md +++ b/Documentation~/index.md @@ -86,7 +86,7 @@ The most important part of the diagnostic log is the section marked `==== OpenXR ## Known issues * For projects targeting HoloLens 2 that are using Out of the Box Unity OpenXR support, **Project Settings - > Player - > Resolution and Presentation - > Run in Background** must be enabled. For projects that are using the Microsoft OpenXR extended support package this is not required. -* An issue with an invalid stage space during startup may cause problems with the XR Rig component from the `com.unity.xr.interaction.toolkit` package, or the camera offset component in the `com.unity.xr.legacyinputhelpers` package. These packages will be updated shortly to contain fixes for this issue. Until then the workaround is to use the `Floor` Device Tracking Option setting. +* An issue with an invalid stage space during startup may cause problems with the XR Origin component from the `com.unity.xr.interaction.toolkit` package, or the camera offset component in the `com.unity.xr.legacyinputhelpers` package. These packages will be updated shortly to contain fixes for this issue. Until then the workaround is to use the `Floor` Device Tracking Option setting. ## Upgrading a project to use OpenXR diff --git a/Documentation~/input.md b/Documentation~/input.md index bdae704..75ad8c1 100644 --- a/Documentation~/input.md +++ b/Documentation~/input.md @@ -10,7 +10,7 @@ For information on how to configure Unity to use OpenXR input, see the [Getting ## Overview -Initially, Unity will provide a controller-based approach to interfacing with OpenXR. This will allow existing games and applications that are using the Unity's [Input System](https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/) or the [Feature API](https://docs.unity3d.com/Manual/xr_input.html) to continue to use their existing input mechanisms. +Initially, Unity will provide a controller-based approach to interfacing with OpenXR. This will allow existing games and applications that are using Unity's [Input System](https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/) or the [Feature API](https://docs.unity3d.com/Manual/xr_input.html) to continue to use their existing input mechanisms. The Unity OpenXR package provides a set of controller layouts for various devices that you can bind to your actions when using the Unity Input System. For more information, see the [Interaction profile features](./index.md#interaction-profile-features) section. @@ -195,7 +195,7 @@ The HMD position reported by Unity when using OpenXR is calculated from the curr The Unity `Device Tracking Origin` is mapped to `Local Space`. The Unity `Floor Tracking Origin` is mapped to `Stage Space`. -By default, Unity attempts to attach the `Stage Space` where possible. To help manage the different tracking origins, use the `XR Rig` from the XR Interaction Package, or the `Camera Offset` component from the Legacy Input Helpers package. +By default, Unity attempts to attach the `Stage Space` where possible. To help manage the different tracking origins, use the `XR Origin` from the XR Interaction Package, or the `Camera Offset` component from the Legacy Input Helpers package. ### Interaction bindings diff --git a/Documentation~/project-configuration.md b/Documentation~/project-configuration.md index 8537e76..69e985a 100644 --- a/Documentation~/project-configuration.md +++ b/Documentation~/project-configuration.md @@ -35,7 +35,7 @@ The **XR Plug-in Management** settings page displays a tab for each platform bui To enable OpenXR: -1. Open the **Player Settings** window (menu: **Edit > Player Settings**). +1. Open the **Project Settings** window (menu: **Edit > Project Settings**). 2. Select **XR Plug-in Management** to view the plug-in management settings. 3. Select the tab for a platform build target to view the settings for that target. 4. Enable the **OpenXR** option in the **Plug-in Providers** list. @@ -55,7 +55,7 @@ Some features are organized as a *feature group*. You can enable a feature group To enable an OpenXR feature: -1. Open the **Player Settings** window (menu: **Edit > Player Settings**). +1. Open the **Project Settings** window (menu: **Edit > Project Settings**). 2. Click **XR Plug-in Management** to expand the plug-in section (if necessary). 3. Select **OpenXR** in the list of XR plug-ins. 4. Select the tab for a platform build target to view the features for that target. @@ -83,7 +83,7 @@ The **Render Mode** determines how OpenXR renders stereo graphics. Different plu To set the render mode: -1. Open the **Player Settings** window (menu: **Edit > Player Settings**). +1. Open the **Project Settings** window (menu: **Edit > Project Settings**). 2. Click **XR Plug-in Management** to expand the plug-in section (if necessary). 3. Select **OpenXR** in the list of XR plug-ins. 4. Select the tab for a platform build target to view the features for that target. @@ -116,7 +116,7 @@ A reasonable rule of thumb to use when choosing a setting is: To set the depth submission mode: -1. Open the **Player Settings** window (menu: **Edit > Player Settings**). +1. Open the **Project Settings** window (menu: **Edit > Project Settings**). 2. Click **XR Plug-in Management** to expand the plug-in section (if necessary). 3. Select **OpenXR** in the list of XR plug-ins. 4. Select the tab for a platform build target to view the features for that target. @@ -134,7 +134,7 @@ By default, Unity uses the OpenXR runtime that is setup as the active runtime fo To set the OpenXR runtime to use in Play mode: -1. Open the **Player Settings** window (menu: **Edit > Player Settings**). +1. Open the **Project Settings** window (menu: **Edit > Project Settings**). 2. Click **XR Plug-in Management** to expand the plug-in section (if necessary). 3. Select **OpenXR** in the list of XR plug-ins. 4. Select the Mac, Windows, Linux settings (PC) tab. @@ -160,7 +160,7 @@ When using an OpenXR plug-in, you must specify which interaction profile to use. To add an OpenXR interaction profile: -1. Open the **Player Settings** window (menu: **Edit > Player Settings**). +1. Open the **Project Settings** window (menu: **Edit > Project Settings**). 2. Click **XR Plug-in Management** to expand the plug-in section (if necessary). 3. Select **OpenXR** in the list of XR plug-ins. 4. In the **Interaction Profiles** section, click the **+** button to add a profile. @@ -177,7 +177,7 @@ When you use the OpenGL graphics API, you must set the Unity Editor to use the l To change the color space: -1. Open the **Player Settings** window (menu: **Edit > Player Settings**). +1. Open the **Project Settings** window (menu: **Edit > Project Settings**). 2. Select the **Player** settings category. 3. Scroll to the **Other Settings** section. (Click **Other Settings** to open the section, if necessary.) 4. Under the **Rendering** area, choose a **Color Space**. diff --git a/Editor/BuildHelperUtils.cs b/Editor/BuildHelperUtils.cs index f2364d3..35b563a 100644 --- a/Editor/BuildHelperUtils.cs +++ b/Editor/BuildHelperUtils.cs @@ -38,24 +38,19 @@ public static XRGeneralSettings MakeSureXRGeneralSettingsExists(BuildTargetGroup { string searchText = "t:XRGeneralSettings"; string[] assets = AssetDatabase.FindAssets(searchText); - if (assets.Length > 0) + for (int i = 0; i < assets.Length; ++i) { - string path = AssetDatabase.GUIDToAssetPath(assets[0]); + string path = AssetDatabase.GUIDToAssetPath(assets[i]); var allSettings = AssetDatabase.LoadAssetAtPath(path, typeof(XRGeneralSettingsPerBuildTarget)) as XRGeneralSettingsPerBuildTarget; - EditorBuildSettings.AddConfigObject(XRGeneralSettings.k_SettingsKey, allSettings, true); + if (allSettings != null) + { + EditorBuildSettings.AddConfigObject(XRGeneralSettings.k_SettingsKey, allSettings, true); + break; + } } } return settings; } - - static BuildHelperUtils() - { - EditorApplication.playModeStateChanged += (state) => - { - if (state == PlayModeStateChange.ExitingEditMode) - MakeSureXRGeneralSettingsExists(BuildTargetGroup.Standalone); - }; - } } } diff --git a/Editor/FeatureSupport/OpenXRChooseRuntimeLibraries.cs b/Editor/FeatureSupport/OpenXRChooseRuntimeLibraries.cs index 721f0ee..59b8cc3 100644 --- a/Editor/FeatureSupport/OpenXRChooseRuntimeLibraries.cs +++ b/Editor/FeatureSupport/OpenXRChooseRuntimeLibraries.cs @@ -4,6 +4,7 @@ using System.Linq; using UnityEditor.Build; using UnityEditor.Build.Reporting; +using UnityEngine.XR.OpenXR; namespace UnityEditor.XR.OpenXR.Features { @@ -72,6 +73,8 @@ private static string AssetPathToAbsolutePath(string assetPath) public void OnPreprocessBuild(BuildReport report) { + var enabled = BuildHelperUtils.HasLoader(report.summary.platformGroup, typeof(OpenXRLoaderBase)); + var extensions = FeatureHelpersInternal.GetAllFeatureInfo(report.summary.platformGroup); // Keep set of seen plugins, only disable plugins that haven't been seen. @@ -83,12 +86,19 @@ public void OnPreprocessBuild(BuildReport report) { if (!importer.GetCompatibleWithPlatform(report.summary.platform)) continue; + bool loader = false; if (importer.assetPath.Contains("openxr_loader")) { + loader = true; if (extensions.CustomLoaderBuildTargets?.Contains(report.summary.platform) ?? false) importer.SetIncludeInBuildDelegate(path => false); else - importer.SetIncludeInBuildDelegate(path => true); + importer.SetIncludeInBuildDelegate(path => enabled); + } + + if (importer.assetPath.Contains("UnityOpenXR")) + { + importer.SetIncludeInBuildDelegate(path => enabled); } var root = Path.GetDirectoryName(importer.assetPath); @@ -96,9 +106,10 @@ public void OnPreprocessBuild(BuildReport report) { if (root != null && root.Contains(extInfo.PluginPath)) { - if (extInfo.Feature.enabled) + if (extInfo.Feature.enabled && + (!loader || (extInfo.Attribute.CustomRuntimeLoaderBuildTargets?.Contains(report.summary.platform) ?? false))) { - importer.SetIncludeInBuildDelegate(path => true); + importer.SetIncludeInBuildDelegate(path => enabled); } else if (!seenPlugins.Contains(importer.assetPath)) { diff --git a/MockRuntime/MockRuntime.cs b/MockRuntime/MockRuntime.cs index 78e413f..76909eb 100644 --- a/MockRuntime/MockRuntime.cs +++ b/MockRuntime/MockRuntime.cs @@ -7,6 +7,7 @@ #if UNITY_EDITOR using UnityEditor; using UnityEditor.XR.OpenXR.Features; +using UnityEditor.Build; #endif [assembly:InternalsVisibleTo("Unity.XR.OpenXR.Tests")] @@ -15,12 +16,14 @@ namespace UnityEngine.XR.OpenXR.Features.Mock { #if UNITY_EDITOR [OpenXRFeature(UiName = "Mock Runtime", - BuildTargetGroups = new []{UnityEditor.BuildTargetGroup.Standalone}, + BuildTargetGroups = new []{UnityEditor.BuildTargetGroup.Standalone, UnityEditor.BuildTargetGroup.Android}, Company = "Unity", Desc = "Mock runtime extension for automated testing.", DocumentationLink = Constants.k_DocumentationURL, - CustomRuntimeLoaderBuildTargets = new [] { UnityEditor.BuildTarget.StandaloneWindows64, UnityEditor.BuildTarget.StandaloneOSX }, - OpenxrExtensionStrings = MockRuntime.XR_UNITY_null_gfx, +#if !OPENXR_USE_KHRONOS_LOADER + CustomRuntimeLoaderBuildTargets = new [] { UnityEditor.BuildTarget.StandaloneWindows64, UnityEditor.BuildTarget.StandaloneOSX, UnityEditor.BuildTarget.Android }, +#endif + OpenxrExtensionStrings = MockRuntime.XR_UNITY_null_gfx + " " + XR_UNITY_android_present, Version = "0.0.2", FeatureId = featureId)] #endif @@ -212,11 +215,16 @@ protected internal override void OnInstanceDestroy(ulong instance) #if UNITY_INCLUDE_TESTS TestCallback(MethodBase.GetCurrentMethod().Name, instance); XrInstance = 0ul; -#endif - // When the mock runtime instance shuts down we remove any callbacks that - // were set up to ensure they do not linger around for the next usage of the mock runtime. - ClearFunctionCallbacks(); + if (!KeepFunctionCallbacks) + { +#endif + // When the mock runtime instance shuts down we remove any callbacks that + // were set up to ensure they do not linger around for the next usage of the mock runtime. + ClearFunctionCallbacks(); +#if UNITY_INCLUDE_TESTS + } +#endif } @@ -227,10 +235,27 @@ protected internal override void OnInstanceDestroy(ulong instance) public const string XR_UNITY_null_gfx = "XR_UNITY_null_gfx"; + public const string XR_UNITY_android_present = "XR_UNITY_android_present"; + public ulong XrInstance { get; private set; } = 0ul; public ulong XrSession { get; private set; } = 0ul; + private static bool s_KeepFunctionCallbacks; + + internal static bool KeepFunctionCallbacks + { + get + { + return s_KeepFunctionCallbacks; + } + set + { + s_KeepFunctionCallbacks = value; + SetKeepFunctionCallbacks(value); + } + } + /// /// Return the current session state of the MockRuntime /// @@ -240,8 +265,8 @@ protected internal override IntPtr HookGetInstanceProcAddr(IntPtr func) { var ret = TestCallback(MethodBase.GetCurrentMethod().Name, func); if (!(ret is IntPtr)) - return func; - return (IntPtr)ret; + return HookCreateInstance(func); + return HookCreateInstance((IntPtr)ret); } protected internal override void OnSystemChange(ulong xrSystem) @@ -386,7 +411,13 @@ protected internal override void GetValidationChecks(List result #endif #endif - const string extLib = "mock_runtime"; + const string extLib = "mock_api"; + + [DllImport(extLib, EntryPoint = "MockRuntime_HookCreateInstance")] + public static extern IntPtr HookCreateInstance(IntPtr func); + + [DllImport(extLib, EntryPoint = "MockRuntime_SetKeepFunctionCallbacks")] + public static extern void SetKeepFunctionCallbacks(bool value); [DllImport(extLib, EntryPoint = "MockRuntime_SetView")] public static extern void SetViewPose(XrViewConfigurationType viewConfigurationType, int viewIndex, Vector3 position, Quaternion orientation, Vector4 fov); @@ -426,5 +457,22 @@ protected internal override void GetValidationChecks(List result [DllImport(extLib, EntryPoint = "MockRuntime_RegisterFunctionCallbacks")] private static extern void MockRuntime_RegisterFunctionCallbacks(BeforeFunctionDelegate hookBefore, AfterFunctionDelegate hookAfter); + + #if UNITY_EDITOR + static void UseGenericLoaderAndroid() + { +#if UNITY_2021_3_OR_NEWER + var defines = PlayerSettings.GetScriptingDefineSymbols(NamedBuildTarget.Android); +#else + var defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android); +#endif + defines += ";OPENXR_USE_KHRONOS_LOADER"; +#if UNITY_2021_3_OR_NEWER + PlayerSettings.SetScriptingDefineSymbols(NamedBuildTarget.Android, defines); +#else + PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, defines); +#endif + } + #endif } } diff --git a/MockRuntime/Native~/mock_runtime/Extensions/mock_vulkan_enable2.cpp b/MockRuntime/Native~/mock_runtime/Extensions/mock_vulkan_enable2.cpp index 2314a2a..e25d53b 100644 --- a/MockRuntime/Native~/mock_runtime/Extensions/mock_vulkan_enable2.cpp +++ b/MockRuntime/Native~/mock_runtime/Extensions/mock_vulkan_enable2.cpp @@ -224,6 +224,12 @@ extern "C" XrResult UNITY_INTERFACE_EXPORT XRAPI_PTR MockVulkan_xrCreateSwapchai return XR_SUCCESS; } +extern "C" XrResult UNITY_INTERFACE_EXPORT XRAPI_PTR MockVulkan_xrCreateSwapchainHook(XrSession session, const XrSwapchainCreateInfo* createInfo, XrSwapchain* swapchain) +{ + LOG_FUNC(); + MOCK_HOOK_NAMED("xrCreateSwapchain", MockVulkan_xrCreateSwapchain(session, createInfo, swapchain)); +} + extern "C" XrResult UNITY_INTERFACE_EXPORT XRAPI_PTR MockVulkan_xrDestroySwapChain(XrSwapchain swapchain) { s_MockVulkan.vkDestroyImage(s_MockVulkan.device, (VkImage)swapchain, nullptr); @@ -293,7 +299,7 @@ extern "C" XrResult UNITY_INTERFACE_EXPORT XRAPI_PTR MockVulkan_xrEndFrame(XrSes XrResult MockVulkan_GetInstanceProcAddr(const char* name, PFN_xrVoidFunction* function) { GET_PROC_ADDRESS_REMAP(xrCreateSession, MockVulkan_xrCreateSession) - GET_PROC_ADDRESS_REMAP(xrCreateSwapchain, MockVulkan_xrCreateSwapchain) + GET_PROC_ADDRESS_REMAP(xrCreateSwapchain, MockVulkan_xrCreateSwapchainHook) GET_PROC_ADDRESS_REMAP(xrDestroySwapChain, MockVulkan_xrDestroySwapChain) GET_PROC_ADDRESS_REMAP(xrEnumerateSwapchainFormats, MockVulkan_xrEnumerateSwapchainFormats) GET_PROC_ADDRESS_REMAP(xrEnumerateSwapchainImages, MockVulkan_xrEnumerateSwapchainImages) diff --git a/MockRuntime/Native~/mock_runtime/mock.h b/MockRuntime/Native~/mock_runtime/mock.h index abb9f53..996f960 100644 --- a/MockRuntime/Native~/mock_runtime/mock.h +++ b/MockRuntime/Native~/mock_runtime/mock.h @@ -9,6 +9,29 @@ #include #endif +#ifdef XR_USE_PLATFORM_ANDROID +#include +#include +#include +#include +#include + +namespace std +{ +template +std::string to_string(T value) +{ + std::ostringstream os; + os << value; + return os.str(); +} +} // namespace std +#endif + +#ifdef XR_USE_GRAPHICS_API_OPENGL_ES +#include +#endif + #include struct IUnityXRTrace; @@ -88,6 +111,8 @@ extern MockRuntime* s_runtime; #define LOG_FUNC() #endif +XrResult GetProcAddrMockAPI(XrInstance instance, const char* name, PFN_xrVoidFunction* function); + XrResult MockRuntime_BeforeFunction(const char* name); void MockRuntime_AfterFunction(const char* name, XrResult result); diff --git a/MockRuntime/Native~/mock_runtime/mock_api.cpp b/MockRuntime/Native~/mock_runtime/mock_api.cpp index 06b9b1a..b9d591c 100644 --- a/MockRuntime/Native~/mock_runtime/mock_api.cpp +++ b/MockRuntime/Native~/mock_runtime/mock_api.cpp @@ -1,10 +1,39 @@ #include "mock.h" +#ifndef TRAMPOLINE +#define TRAMPOLINE 0 +#endif + +static PFN_xrGetInstanceProcAddr s_GetInstanceProcAddr = nullptr; +static PFN_xrCreateInstance s_xrCreateInstance = nullptr; +static PFN_xrDestroyInstance s_xrDestroyInstance = nullptr; +static XrInstance s_Instance = XR_NULL_HANDLE; + typedef XrResult(XRAPI_PTR* PFN_BeforeFunctionCallback)(const char* name); typedef void(XRAPI_PTR* PFN_AfterFunctionCallback)(const char* name, XrResult result); -PFN_BeforeFunctionCallback s_BeforeFunctionCallback = nullptr; -PFN_AfterFunctionCallback s_AfterFunctionCallback = nullptr; +static PFN_BeforeFunctionCallback s_BeforeFunctionCallback = nullptr; +static PFN_AfterFunctionCallback s_AfterFunctionCallback = nullptr; +static bool s_KeepFunctionCallbacks = false; + +extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API MockRuntime_RegisterFunctionCallbacks(PFN_BeforeFunctionCallback before, PFN_AfterFunctionCallback after) +{ + s_BeforeFunctionCallback = before; + s_AfterFunctionCallback = after; + +#if TRAMPOLINE + if (s_Instance == nullptr || s_GetInstanceProcAddr == nullptr) + return; + void (*fptr)(PFN_BeforeFunctionCallback before, PFN_AfterFunctionCallback after) = nullptr; + s_GetInstanceProcAddr(s_Instance, __func__, (PFN_xrVoidFunction*)&fptr); + return fptr(before, after); +#endif +} + +extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API MockRuntime_SetKeepFunctionCallbacks(bool value) +{ + s_KeepFunctionCallbacks = value; +} XrResult MockRuntime_BeforeFunction(const char* name) { @@ -22,71 +51,184 @@ void MockRuntime_AfterFunction(const char* name, XrResult result) s_AfterFunctionCallback(name, result); } -extern "C" void UNITY_INTERFACE_EXPORT MockRuntime_SetView(XrViewConfigurationType viewConfigurationType, int viewIndex, UnityVector3 position, UnityVector4 orientation, UnityVector4 fov) +// Special handling of before / after function callbacks for xrCreateInstance and xrDestroyInstance +extern "C" PFN_xrGetInstanceProcAddr UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API MockRuntime_HookCreateInstance(PFN_xrGetInstanceProcAddr procAddr) +{ + s_GetInstanceProcAddr = procAddr; + return (PFN_xrGetInstanceProcAddr)[](XrInstance instance, const char* name, PFN_xrVoidFunction* function)->XrResult + { + XrResult ret = s_GetInstanceProcAddr(instance, name, function); + if (strcmp(name, "xrCreateInstance") == 0) + { + s_xrCreateInstance = (PFN_xrCreateInstance)*function; + *function = (PFN_xrVoidFunction)(PFN_xrCreateInstance)[](const XrInstanceCreateInfo* createInfo, XrInstance* instance)->XrResult + { + XrResult ret = XR_SUCCESS; + if (s_BeforeFunctionCallback != nullptr) + ret = s_BeforeFunctionCallback("xrCreateInstance"); + if (XR_FAILED(ret)) + return ret; + ret = s_xrCreateInstance(createInfo, instance); + s_Instance = *instance; + if (s_AfterFunctionCallback != nullptr) + s_AfterFunctionCallback("xrCreateInstance", ret); + MockRuntime_RegisterFunctionCallbacks(s_BeforeFunctionCallback, s_AfterFunctionCallback); + return ret; + }; + return ret; + } + else if (strcmp(name, "xrDestroyInstance") == 0) + { + s_xrDestroyInstance = (PFN_xrDestroyInstance)*function; + *function = (PFN_xrVoidFunction)(PFN_xrDestroyInstance)[](XrInstance instance)->XrResult + { + PFN_BeforeFunctionCallback before = s_BeforeFunctionCallback; + PFN_AfterFunctionCallback after = s_AfterFunctionCallback; + + if (!s_KeepFunctionCallbacks) + { + MockRuntime_RegisterFunctionCallbacks(nullptr, nullptr); + } + + XrResult ret = XR_SUCCESS; + if (before != nullptr) + ret = before("xrDestroyInstance"); + if (XR_FAILED(ret)) + return ret; + ret = s_xrDestroyInstance(instance); + s_Instance = XR_NULL_HANDLE; + if (after != nullptr) + after("xrDestroyInstance", ret); + return ret; + }; + return ret; + } + return ret; + }; +} + +#if TRAMPOLINE + +#define MOCK_API_TRAMPOLINE(API_RETURN, DEFAULT_VAL, API_NAME, API_ARGS, API_ARG_NAMES) \ + extern "C" API_RETURN UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API API_NAME API_ARGS \ + { \ + if (s_Instance == XR_NULL_HANDLE || s_GetInstanceProcAddr == nullptr) \ + return DEFAULT_VAL; \ + API_RETURN(*fptr) \ + API_ARGS = nullptr; \ + s_GetInstanceProcAddr(s_Instance, __func__, (PFN_xrVoidFunction*)&fptr); \ + return fptr API_ARG_NAMES; \ + } + +#else +#define MOCK_API_TRAMPOLINE(API_RETURN, DEFAULT_VAL, API_NAME, API_ARGS, API_ARG_NAMES) \ + extern "C" API_RETURN UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API API_NAME API_ARGS +#endif + +void NO_RETURN() +{ +} + +MOCK_API_TRAMPOLINE(void, NO_RETURN(), MockRuntime_SetView, + (XrViewConfigurationType viewConfigurationType, int viewIndex, UnityVector3 position, UnityVector4 orientation, UnityVector4 fov), + (viewConfigurationType, viewIndex, position, orientation, fov)) +#if !TRAMPOLINE { if (nullptr == s_runtime) return; s_runtime->SetViewPose(viewConfigurationType, viewIndex, {orientation, position}, fov); } +#endif -extern "C" void UNITY_INTERFACE_EXPORT MockRuntime_SetViewState(XrViewConfigurationType viewConfigurationType, XrViewStateFlags stateFlags) +MOCK_API_TRAMPOLINE(void, NO_RETURN(), MockRuntime_SetViewState, + (XrViewConfigurationType viewConfigurationType, XrViewStateFlags stateFlags), + (viewConfigurationType, stateFlags)) +#if !TRAMPOLINE { if (nullptr == s_runtime) return; s_runtime->SetViewStateFlags(viewConfigurationType, stateFlags); } +#endif -extern "C" void UNITY_INTERFACE_EXPORT MockRuntime_SetReferenceSpace(XrReferenceSpaceType referenceSpace, UnityVector3 position, UnityVector4 orientation, XrSpaceLocationFlags locationFlags) +MOCK_API_TRAMPOLINE(void, NO_RETURN(), MockRuntime_SetReferenceSpace, + (XrReferenceSpaceType referenceSpace, UnityVector3 position, UnityVector4 orientation, XrSpaceLocationFlags locationFlags), + (referenceSpace, position, orientation, locationFlags)) +#if !TRAMPOLINE { if (nullptr == s_runtime) return; s_runtime->SetSpace(referenceSpace, {orientation, position}, locationFlags); } +#endif -extern "C" void UNITY_INTERFACE_EXPORT MockRuntime_SetActionSpace(XrAction action, UnityVector3 position, UnityVector4 orientation, XrSpaceLocationFlags locationFlags) +MOCK_API_TRAMPOLINE(void, NO_RETURN(), MockRuntime_SetActionSpace, + (XrAction action, UnityVector3 position, UnityVector4 orientation, XrSpaceLocationFlags locationFlags), + (action, position, orientation, locationFlags)) +#if !TRAMPOLINE { if (nullptr == s_runtime) return; s_runtime->SetSpace(action, {orientation, position}, locationFlags); } +#endif -extern "C" XrSessionState UNITY_INTERFACE_EXPORT MockRuntime_GetSessionState() +MOCK_API_TRAMPOLINE(XrSessionState, XR_SESSION_STATE_UNKNOWN, MockRuntime_GetSessionState, + (), + ()) +#if !TRAMPOLINE { if (nullptr == s_runtime) return XR_SESSION_STATE_UNKNOWN; return s_runtime->GetSessionState(); } +#endif -extern "C" void UNITY_INTERFACE_EXPORT MockRuntime_RequestExitSession() +MOCK_API_TRAMPOLINE(void, NO_RETURN(), MockRuntime_RequestExitSession, + (), + ()) +#if !TRAMPOLINE { if (nullptr == s_runtime) return; s_runtime->RequestExitSession(); } +#endif -extern "C" void UNITY_INTERFACE_EXPORT MockRuntime_CauseInstanceLoss() +MOCK_API_TRAMPOLINE(void, NO_RETURN(), MockRuntime_CauseInstanceLoss, + (), + ()) +#if !TRAMPOLINE { if (nullptr == s_runtime) return; s_runtime->CauseInstanceLoss(); } +#endif -extern "C" void UNITY_INTERFACE_EXPORT MockRuntime_SetReferenceSpaceBounds(XrReferenceSpaceType referenceSpaceType, XrExtent2Df bounds) +MOCK_API_TRAMPOLINE(void, NO_RETURN(), MockRuntime_SetReferenceSpaceBounds, + (XrReferenceSpaceType referenceSpaceType, XrExtent2Df bounds), + (referenceSpaceType, bounds)) +#if !TRAMPOLINE { if (nullptr == s_runtime) return; s_runtime->SetExtentsForReferenceSpace(referenceSpaceType, bounds); } +#endif -extern "C" void UNITY_INTERFACE_EXPORT MockRuntime_GetEndFrameStats(int* primaryLayerCount, int* secondaryLayerCount) +MOCK_API_TRAMPOLINE(void, NO_RETURN(), MockRuntime_GetEndFrameStats, + (int* primaryLayerCount, int* secondaryLayerCount), + (primaryLayerCount, secondaryLayerCount)) +#if !TRAMPOLINE { *primaryLayerCount = 0; *secondaryLayerCount = 0; @@ -96,30 +238,36 @@ extern "C" void UNITY_INTERFACE_EXPORT MockRuntime_GetEndFrameStats(int* primary s_runtime->GetEndFrameStats(primaryLayerCount, secondaryLayerCount); } +#endif -extern "C" void UNITY_INTERFACE_EXPORT MockRuntime_ActivateSecondaryView(XrViewConfigurationType viewConfigurationType, bool activate) +MOCK_API_TRAMPOLINE(void, NO_RETURN(), MockRuntime_ActivateSecondaryView, + (XrViewConfigurationType viewConfigurationType, bool activate), + (viewConfigurationType, activate)) +#if !TRAMPOLINE { if (nullptr == s_runtime) return; s_runtime->ActivateSecondaryView(viewConfigurationType, activate); } +#endif -extern "C" void UNITY_INTERFACE_EXPORT MockRuntime_RegisterScriptEventCallback(PFN_ScriptEventCallback callback) +MOCK_API_TRAMPOLINE(void, NO_RETURN(), MockRuntime_RegisterScriptEventCallback, + (PFN_ScriptEventCallback callback), + (callback)) +#if !TRAMPOLINE { if (nullptr == s_runtime) return; s_runtime->RegisterScriptEventCallback(callback); } +#endif -extern "C" void UNITY_INTERFACE_EXPORT MockRuntime_RegisterFunctionCallbacks(PFN_BeforeFunctionCallback before, PFN_AfterFunctionCallback after) -{ - s_BeforeFunctionCallback = before; - s_AfterFunctionCallback = after; -} - -extern "C" bool UNITY_INTERFACE_EXPORT XRAPI_PTR MockRuntime_TransitionToState(XrSessionState requestedState, bool forceTransition) +MOCK_API_TRAMPOLINE(bool, false, MockRuntime_TransitionToState, + (XrSessionState requestedState, bool forceTransition), + (requestedState, forceTransition)) +#if !TRAMPOLINE { if (nullptr == s_runtime) return false; @@ -136,3 +284,25 @@ extern "C" bool UNITY_INTERFACE_EXPORT XRAPI_PTR MockRuntime_TransitionToState(X return true; } +#endif + +#if !TRAMPOLINE +XrResult GetProcAddrMockAPI(XrInstance instance, const char* name, PFN_xrVoidFunction* function) +{ + GET_PROC_ADDRESS(MockRuntime_SetView) + GET_PROC_ADDRESS(MockRuntime_SetViewState) + GET_PROC_ADDRESS(MockRuntime_SetReferenceSpace) + GET_PROC_ADDRESS(MockRuntime_SetActionSpace) + GET_PROC_ADDRESS(MockRuntime_GetSessionState) + GET_PROC_ADDRESS(MockRuntime_RequestExitSession) + GET_PROC_ADDRESS(MockRuntime_CauseInstanceLoss) + GET_PROC_ADDRESS(MockRuntime_SetReferenceSpaceBounds) + GET_PROC_ADDRESS(MockRuntime_GetEndFrameStats) + GET_PROC_ADDRESS(MockRuntime_ActivateSecondaryView) + GET_PROC_ADDRESS(MockRuntime_RegisterScriptEventCallback) + GET_PROC_ADDRESS(MockRuntime_RegisterFunctionCallbacks) + GET_PROC_ADDRESS(MockRuntime_TransitionToState) + + return XR_ERROR_FUNCTION_UNSUPPORTED; +} +#endif diff --git a/MockRuntime/Native~/mock_runtime/mock_loader.cpp b/MockRuntime/Native~/mock_runtime/mock_loader.cpp index 544b6d4..3786d7d 100644 --- a/MockRuntime/Native~/mock_runtime/mock_loader.cpp +++ b/MockRuntime/Native~/mock_runtime/mock_loader.cpp @@ -12,6 +12,9 @@ uint64_t s_nextInstanceId = 11; // Start at 11 because 10 is a special test case #define XR_UNITY_null_gfx_SPEC_VERSION 1 #define XR_UNITY_NULL_GFX_EXTENSION_NAME "XR_UNITY_null_gfx" +#define XR_UNITY_android_present_SPEC_VERSION 1 +#define XR_UNITY_ANDROID_PRESENT_EXTENSION_NAME "XR_UNITY_android_present" + #define ENUM_TO_STR(name, val) \ case val: \ strncpy(buffer, #name, XR_MAX_RESULT_STRING_SIZE - 1); \ @@ -31,6 +34,12 @@ uint64_t s_nextInstanceId = 11; // Start at 11 because 10 is a special test case XR_UNITY_NULL_GFX_EXTENSION_NAME, XR_UNITY_null_gfx_SPEC_VERSION }, + { + XR_TYPE_EXTENSION_PROPERTIES, + nullptr, + XR_UNITY_ANDROID_PRESENT_EXTENSION_NAME, + XR_UNITY_android_present_SPEC_VERSION + }, { XR_TYPE_EXTENSION_PROPERTIES, nullptr, @@ -764,6 +773,9 @@ extern "C" XrResult UNITY_INTERFACE_EXPORT XRAPI_PTR xrGetInstanceProcAddr(XrIns GET_PROC_ADDRESS(xrStopHapticFeedback) GET_PROC_ADDRESS(xrGetVisibilityMaskKHR) + if (XR_SUCCEEDED(GetProcAddrMockAPI(instance, name, function))) + return XR_SUCCESS; + return XR_ERROR_FUNCTION_UNSUPPORTED; } diff --git a/MockRuntime/Native~/mock_runtime/mock_runtime.cpp b/MockRuntime/Native~/mock_runtime/mock_runtime.cpp index cc6eb19..79cd67a 100644 --- a/MockRuntime/Native~/mock_runtime/mock_runtime.cpp +++ b/MockRuntime/Native~/mock_runtime/mock_runtime.cpp @@ -1254,7 +1254,7 @@ XrResult MockRuntime::GetActionStateFloat(const XrActionStateGetInfo* getInfo, X // OpenXR 1.0: The current state must be the state of the input with the largest absolute value float bindingValue = binding->GetFloat(); - if (abs(bindingValue) > abs(value)) + if (std::abs(bindingValue) > std::abs(value)) value = bindingValue; } diff --git a/MockRuntime/Native~/mock_runtime/mock_runtime.h b/MockRuntime/Native~/mock_runtime/mock_runtime.h index 01b0598..a68434c 100644 --- a/MockRuntime/Native~/mock_runtime/mock_runtime.h +++ b/MockRuntime/Native~/mock_runtime/mock_runtime.h @@ -352,7 +352,7 @@ class MockRuntime std::vector componentPathStrings; std::vector userPaths; - std::chrono::steady_clock::time_point startTime; + std::chrono::time_point startTime; bool instanceIsLost; bool nullGfx; diff --git a/MockRuntime/Native~/openxr_loader/mock_loader.cpp b/MockRuntime/Native~/openxr_loader/mock_loader.cpp index 5aa76c3..53fb1e6 100644 --- a/MockRuntime/Native~/openxr_loader/mock_loader.cpp +++ b/MockRuntime/Native~/openxr_loader/mock_loader.cpp @@ -7,6 +7,14 @@ #include #endif +#ifdef XR_USE_PLATFORM_ANDROID +#include +#endif + +#ifdef XR_USE_GRAPHICS_API_OPENGL_ES +#include +#endif + #include #define XR_NO_PROTOTYPES diff --git a/MockRuntime/android.meta b/MockRuntime/android.meta new file mode 100644 index 0000000..e3256de --- /dev/null +++ b/MockRuntime/android.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5ad068ceb0534c849ccb885f021b0751 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/MockRuntime/android/arm64.meta b/MockRuntime/android/arm64.meta new file mode 100644 index 0000000..194421d --- /dev/null +++ b/MockRuntime/android/arm64.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0b5f2d12bbe9482ebc5b5de3f7ea2e7b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/MockRuntime/android/arm64/libmock_api.so b/MockRuntime/android/arm64/libmock_api.so new file mode 100644 index 0000000..aa9b6f8 Binary files /dev/null and b/MockRuntime/android/arm64/libmock_api.so differ diff --git a/MockRuntime/android/arm64/libmock_api.so.meta b/MockRuntime/android/arm64/libmock_api.so.meta new file mode 100644 index 0000000..432857c --- /dev/null +++ b/MockRuntime/android/arm64/libmock_api.so.meta @@ -0,0 +1,82 @@ +fileFormatVersion: 2 +guid: 9a6aa3d989594da7b49e3e46a58519a7 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 0 + Exclude Editor: 1 + Exclude Linux64: 1 + Exclude OSXUniversal: 1 + Exclude Win: 1 + Exclude Win64: 1 + - first: + Android: Android + second: + enabled: 1 + settings: + CPU: ARM64 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/MockRuntime/android/arm64/libmock_runtime.so b/MockRuntime/android/arm64/libmock_runtime.so new file mode 100644 index 0000000..2cdffc9 Binary files /dev/null and b/MockRuntime/android/arm64/libmock_runtime.so differ diff --git a/MockRuntime/android/arm64/libmock_runtime.so.meta b/MockRuntime/android/arm64/libmock_runtime.so.meta new file mode 100644 index 0000000..e4c6288 --- /dev/null +++ b/MockRuntime/android/arm64/libmock_runtime.so.meta @@ -0,0 +1,82 @@ +fileFormatVersion: 2 +guid: 4ae41ee42e1646d28237f03158a39862 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 0 + Exclude Editor: 1 + Exclude Linux64: 1 + Exclude OSXUniversal: 1 + Exclude Win: 1 + Exclude Win64: 1 + - first: + Android: Android + second: + enabled: 1 + settings: + CPU: ARM64 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/MockRuntime/android/arm64/libopenxr_loader.so b/MockRuntime/android/arm64/libopenxr_loader.so new file mode 100644 index 0000000..bbcfab6 Binary files /dev/null and b/MockRuntime/android/arm64/libopenxr_loader.so differ diff --git a/MockRuntime/android/arm64/libopenxr_loader.so.meta b/MockRuntime/android/arm64/libopenxr_loader.so.meta new file mode 100644 index 0000000..1e4c54a --- /dev/null +++ b/MockRuntime/android/arm64/libopenxr_loader.so.meta @@ -0,0 +1,82 @@ +fileFormatVersion: 2 +guid: 7cba064fd4044b1ebfa1db4169244857 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 0 + Exclude Editor: 1 + Exclude Linux64: 1 + Exclude OSXUniversal: 1 + Exclude Win: 1 + Exclude Win64: 1 + - first: + Android: Android + second: + enabled: 1 + settings: + CPU: ARM64 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/MockRuntime/unity-mock-runtime.json b/MockRuntime/unity-mock-runtime.json index f56b11b..7303673 100644 --- a/MockRuntime/unity-mock-runtime.json +++ b/MockRuntime/unity-mock-runtime.json @@ -4,6 +4,6 @@ { "api_version": "1.0", "name": "Unity Mock Runtime", - "library_path": ".\\Windows\\x64\\openxr_loader.dll" + "library_path": ".\\windows\\x64\\mock_runtime.dll" } } diff --git a/MockRuntime/windows.meta b/MockRuntime/windows.meta index bfb5667..fb50c2d 100644 --- a/MockRuntime/windows.meta +++ b/MockRuntime/windows.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b66c9becfaa943fb8f67310c87dc9278 +guid: a68a8cf0a85741a08b9033e670baa95f folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/MockRuntime/windows/x64.meta b/MockRuntime/windows/x64.meta index fe20c1d..eb54934 100644 --- a/MockRuntime/windows/x64.meta +++ b/MockRuntime/windows/x64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 61681b50d9f740378deccb932f477128 +guid: 990c4a45da6045bf948df2f7990c2aaf folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/MockRuntime/windows/x64/mock_api.dll b/MockRuntime/windows/x64/mock_api.dll new file mode 100644 index 0000000..c2c9099 Binary files /dev/null and b/MockRuntime/windows/x64/mock_api.dll differ diff --git a/MockRuntime/windows/x64/mock_api.dll.meta b/MockRuntime/windows/x64/mock_api.dll.meta new file mode 100644 index 0000000..2401386 --- /dev/null +++ b/MockRuntime/windows/x64/mock_api.dll.meta @@ -0,0 +1,81 @@ +fileFormatVersion: 2 +guid: 354aeaca92a747408bc192b0c8d8e67a +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + : Any + second: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 0 + Exclude Linux64: 0 + Exclude OSXUniversal: 0 + Exclude Win: 1 + Exclude Win64: 0 + Exclude WindowsStoreApps: 1 + - first: + Android: Android + second: + enabled: 0 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + CPU: x86_64 + DefaultValueInitialized: true + OS: Windows + - first: + Standalone: Linux64 + second: + enabled: 1 + settings: + CPU: x86_64 + - first: + Standalone: OSXUniversal + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win64 + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + DontProcess: false + PlaceholderPath: + SDK: AnySDK + ScriptingBackend: AnyScriptingBackend + userData: + assetBundleName: + assetBundleVariant: diff --git a/MockRuntime/windows/x64/mock_runtime.dll b/MockRuntime/windows/x64/mock_runtime.dll index 96760f1..c52e665 100644 Binary files a/MockRuntime/windows/x64/mock_runtime.dll and b/MockRuntime/windows/x64/mock_runtime.dll differ diff --git a/MockRuntime/windows/x64/mock_runtime.dll.meta b/MockRuntime/windows/x64/mock_runtime.dll.meta index 5164da7..41c27e4 100644 --- a/MockRuntime/windows/x64/mock_runtime.dll.meta +++ b/MockRuntime/windows/x64/mock_runtime.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1e8a5bcae14749f2bac5b91fedc1b669 +guid: 06cb102cc8364229a4e0e69831216763 PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/MockRuntime/windows/x64/openxr_loader.dll b/MockRuntime/windows/x64/openxr_loader.dll index 32b9ee0..8f68a24 100644 Binary files a/MockRuntime/windows/x64/openxr_loader.dll and b/MockRuntime/windows/x64/openxr_loader.dll differ diff --git a/MockRuntime/windows/x64/openxr_loader.dll.meta b/MockRuntime/windows/x64/openxr_loader.dll.meta index d832db1..b2ee2a1 100644 --- a/MockRuntime/windows/x64/openxr_loader.dll.meta +++ b/MockRuntime/windows/x64/openxr_loader.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d68a6c589b894f42a84b58f7a57115c8 +guid: fe4293a4cfa74cf2b26ca5ef963834fb PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/Runtime/Features/Interactions/MicrosoftHandInteraction.cs b/Runtime/Features/Interactions/MicrosoftHandInteraction.cs index 744ca61..e16d96e 100644 --- a/Runtime/Features/Interactions/MicrosoftHandInteraction.cs +++ b/Runtime/Features/Interactions/MicrosoftHandInteraction.cs @@ -48,13 +48,13 @@ public class HoloLensHand : XRController public AxisControl select { get; private set; } /// - /// A [ButtonControl](xref:UnityEngine.InputSystem.Controls.ButtonControl) that represents the OpenXR binding. + /// A [ButtonControl](xref:UnityEngine.InputSystem.Controls.ButtonControl) that represents the OpenXR binding. /// [Preserve, InputControl(aliases = new[] { "Primary", "selectbutton" }, usages = new[] { "PrimaryButton" })] public ButtonControl selectPressed { get; private set; } /// - /// An [AxisControl](xref:UnityEngine.InputSystem.Controls.AxisControl) that represents the OpenXR binding. + /// An [AxisControl](xref:UnityEngine.InputSystem.Controls.AxisControl) that represents the OpenXR binding. /// [Preserve, InputControl(alias = "Secondary", usage = "Grip")] public AxisControl squeeze { get; private set; } diff --git a/Runtime/OpenXRLoader.cs b/Runtime/OpenXRLoader.cs index 84c5535..5df1a65 100644 --- a/Runtime/OpenXRLoader.cs +++ b/Runtime/OpenXRLoader.cs @@ -501,7 +501,7 @@ private void SetApplicationInfo() Internal_SetApplicationInfo(Application.productName, Application.version, applicationVersionHash, Application.unityVersion); } - private byte[] StringToWCHAR_T(string s) + internal static byte[] StringToWCHAR_T(string s) { var encoding = Environment.OSVersion.Platform == PlatformID.Unix ? Encoding.UTF32 : Encoding.Unicode; return encoding.GetBytes(s + '\0'); diff --git a/Runtime/OpenXRNativeTypes.cs b/Runtime/OpenXRNativeTypes.cs index 78fc4a3..702c1cb 100644 --- a/Runtime/OpenXRNativeTypes.cs +++ b/Runtime/OpenXRNativeTypes.cs @@ -7,7 +7,7 @@ namespace UnityEngine.XR.OpenXR.NativeTypes { /// - /// Runtime XR Environment Blend Mode. + /// Runtime XR Environment Blend Mode. /// public enum XrEnvironmentBlendMode { diff --git a/Runtime/OpenXRRestarter.cs b/Runtime/OpenXRRestarter.cs index 4d05d28..9c065b5 100644 --- a/Runtime/OpenXRRestarter.cs +++ b/Runtime/OpenXRRestarter.cs @@ -16,7 +16,7 @@ internal class OpenXRRestarter : MonoBehaviour internal Action onAfterShutdown; internal Action onQuit; internal Action onAfterCoroutine; - + internal Action onAfterSuccessfulRestart; static OpenXRRestarter() { @@ -34,6 +34,7 @@ static OpenXRRestarter() public void ResetCallbacks () { onAfterRestart = null; + onAfterSuccessfulRestart = null; onAfterShutdown = null; onAfterCoroutine = null; onQuit = null; @@ -188,6 +189,7 @@ private IEnumerator RestartCoroutine (bool shouldRestart) { Debug.Log("OpenXRLoader restart successful."); m_pauseAndRestartAttempts = 0; + onAfterSuccessfulRestart?.Invoke(); } onAfterRestart?.Invoke(); diff --git a/Runtime/UnitySubsystemsManifest.json b/Runtime/UnitySubsystemsManifest.json index 0d9aa9f..943ae2e 100644 --- a/Runtime/UnitySubsystemsManifest.json +++ b/Runtime/UnitySubsystemsManifest.json @@ -1,6 +1,6 @@ { "name": "OpenXR XR Plugin", - "version": "1.5.1", + "version": "1.5.3", "libraryName": "UnityOpenXR", "displays": [ { diff --git a/Runtime/android.meta b/Runtime/android.meta index 3f6af24..2d1b78f 100644 --- a/Runtime/android.meta +++ b/Runtime/android.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: cc2db97e0d6b4cb792c151146d64fc65 +guid: f2498b8bdff049b9bfd0d7c4816a8e45 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Runtime/android/arm64.meta b/Runtime/android/arm64.meta index 7bfd447..9038181 100644 --- a/Runtime/android/arm64.meta +++ b/Runtime/android/arm64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a9317cbc16de4a29ae6dd2580f9034a8 +guid: d9be85756b1d466fa1b0424fae39f858 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Runtime/android/arm64/libUnityOpenXR.so b/Runtime/android/arm64/libUnityOpenXR.so index dce796d..9d69e5f 100644 Binary files a/Runtime/android/arm64/libUnityOpenXR.so and b/Runtime/android/arm64/libUnityOpenXR.so differ diff --git a/Runtime/android/arm64/libUnityOpenXR.so.meta b/Runtime/android/arm64/libUnityOpenXR.so.meta index 4585950..4c7b983 100644 --- a/Runtime/android/arm64/libUnityOpenXR.so.meta +++ b/Runtime/android/arm64/libUnityOpenXR.so.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2c15b7c78e324a00801589e554c7b785 +guid: cf602e23a4fa4c3a933e35b48e44c41c PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/Runtime/universalwindows.meta b/Runtime/universalwindows.meta index 5569db1..34df19a 100644 --- a/Runtime/universalwindows.meta +++ b/Runtime/universalwindows.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 5675a06b556a44bc8b327ee55cb5b1dc +guid: 2afa5f905b7e4506b21751d0cae0dde7 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Runtime/universalwindows/arm32.meta b/Runtime/universalwindows/arm32.meta index 30def95..6ee15fd 100644 --- a/Runtime/universalwindows/arm32.meta +++ b/Runtime/universalwindows/arm32.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 94c128eb2b5b4ee0ab71aa81b3538ffa +guid: 31fe9a1d0bcc4e34886d14c811d77f75 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Runtime/universalwindows/arm32/UnityOpenXR.dll b/Runtime/universalwindows/arm32/UnityOpenXR.dll index de28a52..1dd5376 100644 Binary files a/Runtime/universalwindows/arm32/UnityOpenXR.dll and b/Runtime/universalwindows/arm32/UnityOpenXR.dll differ diff --git a/Runtime/universalwindows/arm32/UnityOpenXR.dll.meta b/Runtime/universalwindows/arm32/UnityOpenXR.dll.meta index a33a8a0..06c5667 100644 --- a/Runtime/universalwindows/arm32/UnityOpenXR.dll.meta +++ b/Runtime/universalwindows/arm32/UnityOpenXR.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d8bf454ba433466d865c46ee40de1880 +guid: 66bd2ce9f4704ea7962f8770a1c2bbd7 PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/Runtime/universalwindows/arm64.meta b/Runtime/universalwindows/arm64.meta index eb76570..8fd32a0 100644 --- a/Runtime/universalwindows/arm64.meta +++ b/Runtime/universalwindows/arm64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b4d2a07ccbe3407dbff7cb1d86db18ce +guid: 218cadeb762e4843b7c81de4a0e51fbe folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Runtime/universalwindows/arm64/UnityOpenXR.dll b/Runtime/universalwindows/arm64/UnityOpenXR.dll index 62bd91c..fd2796b 100644 Binary files a/Runtime/universalwindows/arm64/UnityOpenXR.dll and b/Runtime/universalwindows/arm64/UnityOpenXR.dll differ diff --git a/Runtime/universalwindows/arm64/UnityOpenXR.dll.meta b/Runtime/universalwindows/arm64/UnityOpenXR.dll.meta index f3abc70..c5badff 100644 --- a/Runtime/universalwindows/arm64/UnityOpenXR.dll.meta +++ b/Runtime/universalwindows/arm64/UnityOpenXR.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 866fe4d45aa64cf2af62927018762418 +guid: f57b9654038546ffa64772cff726aac1 PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/Runtime/universalwindows/x64.meta b/Runtime/universalwindows/x64.meta index 480a6bd..b4935df 100644 --- a/Runtime/universalwindows/x64.meta +++ b/Runtime/universalwindows/x64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 3abd0bba034340aca8d3c524df3319cd +guid: d6541e0fab304e30bf26bee11e992852 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Runtime/universalwindows/x64/UnityOpenXR.dll b/Runtime/universalwindows/x64/UnityOpenXR.dll index 6be9af1..de2df50 100644 Binary files a/Runtime/universalwindows/x64/UnityOpenXR.dll and b/Runtime/universalwindows/x64/UnityOpenXR.dll differ diff --git a/Runtime/universalwindows/x64/UnityOpenXR.dll.meta b/Runtime/universalwindows/x64/UnityOpenXR.dll.meta index 4784ee2..330bdc9 100644 --- a/Runtime/universalwindows/x64/UnityOpenXR.dll.meta +++ b/Runtime/universalwindows/x64/UnityOpenXR.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2444d345060742a1a0ac600a7f168dd6 +guid: dc18d0e076b04b8f9627d328f34f26d2 PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/Runtime/windows.meta b/Runtime/windows.meta index 4a69ca4..e4760e1 100644 --- a/Runtime/windows.meta +++ b/Runtime/windows.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 209f75d387504f839ea7c90e62d9a805 +guid: 05b75a3115a24087af22f27dbb52a3b4 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Runtime/windows/x64.meta b/Runtime/windows/x64.meta index 4c7bdb2..ca292d8 100644 --- a/Runtime/windows/x64.meta +++ b/Runtime/windows/x64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 79f4fec87c274a88be2136f5d30a89ea +guid: f1323ed491264112a3bd1b5c2bd744b8 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Runtime/windows/x64/UnityOpenXR.dll b/Runtime/windows/x64/UnityOpenXR.dll index 48ef6da..025c7cc 100644 Binary files a/Runtime/windows/x64/UnityOpenXR.dll and b/Runtime/windows/x64/UnityOpenXR.dll differ diff --git a/Runtime/windows/x64/UnityOpenXR.dll.meta b/Runtime/windows/x64/UnityOpenXR.dll.meta index f07dc05..e25ff14 100644 --- a/Runtime/windows/x64/UnityOpenXR.dll.meta +++ b/Runtime/windows/x64/UnityOpenXR.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b62cd65afecd4c4faec3ca43f197a1d1 +guid: 5755b3fcc62145f7943c4031c2df88b7 PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/RuntimeDebugger/Native~/openxr_runtime_debugger/runtime_debugger.cpp b/RuntimeDebugger/Native~/openxr_runtime_debugger/runtime_debugger.cpp index a6219fb..2e579fe 100644 --- a/RuntimeDebugger/Native~/openxr_runtime_debugger/runtime_debugger.cpp +++ b/RuntimeDebugger/Native~/openxr_runtime_debugger/runtime_debugger.cpp @@ -19,6 +19,7 @@ #include "openxr/openxr_reflection_full.h" +#include #include #include #include @@ -39,6 +40,18 @@ void SendToCSharp(const char* fieldname, T t) ; #endif +template +void SendToCSharp(const char* fieldname, T* t) +#if !CATCH_MISSING_TEMPLATES +{ + char buf[32]; + snprintf(buf, 32, "0x%p", t); + SendString(fieldname, buf); +} +#else + ; +#endif + // Arrays of base structs template bool SendToCSharpBaseStructArray(const char* fieldname, structType t, int lenParam) @@ -56,6 +69,7 @@ bool SendToCSharpBaseStructArray(const char* fieldname, structType t, int lenPar #include "serialize_handles.h" #include "serialize_atoms.h" #include "serialize_nextptr.h" +#include "serialize_external.h" #include "serialize_structs.h" #include "serialize_todo.h" #include "serialize_nextptr_impl.h" diff --git a/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_atoms.h b/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_atoms.h index 511dfc0..6231680 100644 --- a/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_atoms.h +++ b/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_atoms.h @@ -2,13 +2,13 @@ #if XR_TYPE_SAFE_HANDLES template <> -void SendToCSharp(const char* fieldname, XrSystemId t) +void SendToCSharp<>(const char* fieldname, XrSystemId t) { SendToCSharp(fieldname, (uint64_t)t); } template <> -void SendToCSharp(const char* fieldname, XrSystemId* t) +void SendToCSharp<>(const char* fieldname, XrSystemId* t) { SendToCSharp(fieldname, (uint64_t)*t); } diff --git a/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_data.h b/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_data.h index c788c19..c9fb474 100644 --- a/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_data.h +++ b/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_data.h @@ -217,7 +217,7 @@ static void SendXrPath(const char* fieldName, XrPath t) } template <> -void SendToCSharp(const char*, const XrActionCreateInfo*); +void SendToCSharp<>(const char*, const XrActionCreateInfo*); static void SendXrActionCreate(const char* funcName, XrAction action, const XrActionCreateInfo* createInfo) { s_ThreadLocalDataStore.Reset(); @@ -240,7 +240,7 @@ static void SendXrAction(const char* fieldName, XrAction t) } template <> -void SendToCSharp(const char*, const XrActionSetCreateInfo*); +void SendToCSharp<>(const char*, const XrActionSetCreateInfo*); static void SendXrActionSetCreate(const char* funcName, XrActionSet actionSet, const XrActionSetCreateInfo* createInfo) { s_ThreadLocalDataStore.Reset(); @@ -263,7 +263,7 @@ static void SendXrActionSet(const char* fieldName, XrActionSet t) } template <> -void SendToCSharp(const char*, const XrActionSpaceCreateInfo*); +void SendToCSharp<>(const char*, const XrActionSpaceCreateInfo*); static void SendXrActionSpaceCreate(const char* funcName, const XrActionSpaceCreateInfo* createInfo, XrSpace* space) { s_ThreadLocalDataStore.Reset(); @@ -291,7 +291,7 @@ static const char* GetReferenceSpaceString(XrReferenceSpaceType t) } template <> -void SendToCSharp(const char*, const XrReferenceSpaceCreateInfo*); +void SendToCSharp<>(const char*, const XrReferenceSpaceCreateInfo*); static void SendXrReferenceSpaceCreate(const char* funcName, const XrReferenceSpaceCreateInfo* createInfo, XrSpace* space) { s_ThreadLocalDataStore.Reset(); diff --git a/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_enums.h b/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_enums.h index 0471968..b0092b0 100644 --- a/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_enums.h +++ b/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_enums.h @@ -7,7 +7,7 @@ #define SEND_TO_CSHARP_ENUMS(enumname) \ template <> \ - void SendToCSharp(const char* fieldname, enumname t) \ + void SendToCSharp<>(const char* fieldname, enumname t) \ { \ switch (t) \ { \ @@ -19,7 +19,7 @@ XR_LIST_ENUM_TYPES(SEND_TO_CSHARP_ENUMS) #define SEND_TO_CSHARP_ENUMS_PTR(enumname) \ template <> \ - void SendToCSharp(const char* fieldname, enumname* t) \ + void SendToCSharp<>(const char* fieldname, enumname* t) \ { \ switch (*t) \ { \ diff --git a/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_external.h b/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_external.h new file mode 100644 index 0000000..fb0e1ee --- /dev/null +++ b/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_external.h @@ -0,0 +1,24 @@ +#pragma once + +#if XR_USE_GRAPHICS_API_D3D11 +//struct ID3D11Texture2D; +template <> +void SendToCSharp<>(const char* fieldname, LUID t) +{ + StartStruct(fieldname, "LUID"); + char buf[32]; + snprintf(buf, 32, "0x%x", t.LowPart); + SendToCSharp("LowPart", buf); + snprintf(buf, 32, "0x%x", t.HighPart); + SendToCSharp("HighPart", buf); + EndStruct(); +} + +template <> +void SendToCSharp<>(const char* fieldname, D3D_FEATURE_LEVEL t) +{ + char buf[32]; + snprintf(buf, 32, "0x%x", t); + SendToCSharp(fieldname, buf); +} +#endif \ No newline at end of file diff --git a/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_handles.h b/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_handles.h index 77f80ef..73ca99e 100644 --- a/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_handles.h +++ b/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_handles.h @@ -11,23 +11,23 @@ typedef struct XrActionSetSpecialize_t* XrActionSetSpecialize; typedef struct XrSpaceSpecialize_t* XrSpaceSpecialize; #define XrSpace XrSpaceSpecialize -#define SEND_TO_CSHARP_HANDLES(handlename) \ - template <> \ - void SendToCSharp(const char* fieldname, handlename t) \ - { \ - SendToCSharp(fieldname, (uint64_t)t); \ +#define SEND_TO_CSHARP_HANDLES(handlename) \ + template <> \ + void SendToCSharp<>(const char* fieldname, handlename t) \ + { \ + SendToCSharp(fieldname, (uint64_t)t); \ } XR_LIST_HANDLES(SEND_TO_CSHARP_HANDLES) -#define SEND_TO_CSHARP_HANDLES_PTRS(handlename) \ - template <> \ - void SendToCSharp(const char* fieldname, handlename* t) \ - { \ - if (t != nullptr) \ - SendToCSharp(fieldname, (uint64_t)*t); \ - else \ - SendToCSharp(fieldname, (uint64_t)0); \ +#define SEND_TO_CSHARP_HANDLES_PTRS(handlename) \ + template <> \ + void SendToCSharp<>(const char* fieldname, handlename* t) \ + { \ + if (t != nullptr) \ + SendToCSharp(fieldname, (uint64_t)*t); \ + else \ + SendToCSharp(fieldname, (uint64_t)0); \ } XR_LIST_HANDLES(SEND_TO_CSHARP_HANDLES_PTRS) diff --git a/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_nextptr.h b/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_nextptr.h index 055a1e7..5948d02 100644 --- a/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_nextptr.h +++ b/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_nextptr.h @@ -1,13 +1,13 @@ #pragma once template <> -void SendToCSharp(const char* fieldname, XrBaseOutStructure* t); +void SendToCSharp<>(const char* fieldname, XrBaseOutStructure* t); template <> -void SendToCSharp(const char* fieldname, XrBaseInStructure const* t); +void SendToCSharp<>(const char* fieldname, XrBaseInStructure const* t); template <> -void SendToCSharp(const char* fieldname, void* t) +void SendToCSharp<>(const char* fieldname, void* t) { if (t != nullptr && strcmp(fieldname, "next") == 0) { @@ -20,7 +20,7 @@ void SendToCSharp(const char* fieldname, void* t) } template <> -void SendToCSharp(const char* fieldname, void const* t) +void SendToCSharp<>(const char* fieldname, void const* t) { if (t != nullptr && strcmp(fieldname, "next") == 0) { diff --git a/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_nextptr_impl.h b/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_nextptr_impl.h index 95c4fcd..4b9f5a8 100644 --- a/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_nextptr_impl.h +++ b/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_nextptr_impl.h @@ -6,7 +6,7 @@ break; template <> -void SendToCSharp(const char* fieldname, XrBaseOutStructure* t) +void SendToCSharp<>(const char* fieldname, XrBaseOutStructure* t) { auto* next = t; do @@ -27,7 +27,7 @@ void SendToCSharp(const char* fieldname, XrBaseOutStructure break; template <> -void SendToCSharp(const char* fieldname, XrBaseInStructure const* t) +void SendToCSharp<>(const char* fieldname, XrBaseInStructure const* t) { auto* next = t; do diff --git a/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_primitives.h b/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_primitives.h index a167866..7002749 100644 --- a/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_primitives.h +++ b/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_primitives.h @@ -1,13 +1,13 @@ #pragma once template <> -void SendToCSharp(const char* fieldname, int32_t t) +void SendToCSharp<>(const char* fieldname, int32_t t) { SendInt32(fieldname, t); } template <> -void SendToCSharp(const char* fieldname, int32_t* t) +void SendToCSharp<>(const char* fieldname, int32_t* t) { if (t != nullptr) SendInt32(fieldname, *t); @@ -16,19 +16,19 @@ void SendToCSharp(const char* fieldname, int32_t* t) } template <> -void SendToCSharp(const char* fieldname, int64_t t) +void SendToCSharp<>(const char* fieldname, int64_t t) { SendInt64(fieldname, t); } template <> -void SendToCSharp(const char* fieldname, uint32_t t) +void SendToCSharp<>(const char* fieldname, uint32_t t) { SendUInt32(fieldname, t); } template <> -void SendToCSharp(const char* fieldname, uint32_t* t) +void SendToCSharp<>(const char* fieldname, uint32_t* t) { if (t != nullptr) SendUInt32(fieldname, *t); @@ -37,19 +37,19 @@ void SendToCSharp(const char* fieldname, uint32_t* t) } template <> -void SendToCSharp(const char* fieldname, uint64_t t) +void SendToCSharp<>(const char* fieldname, uint64_t t) { SendUInt64(fieldname, t); } template <> -void SendToCSharp(const char* fieldname, float t) +void SendToCSharp<>(const char* fieldname, float t) { SendFloat(fieldname, t); } template <> -void SendToCSharp(const char* fieldname, float* t) +void SendToCSharp<>(const char* fieldname, float* t) { if (t != nullptr) SendFloat(fieldname, *t); @@ -58,7 +58,7 @@ void SendToCSharp(const char* fieldname, float* t) } template <> -void SendToCSharp(const char* fieldname, char* t) +void SendToCSharp<>(const char* fieldname, char* t) { if (t != nullptr) SendString(fieldname, t); @@ -67,16 +67,7 @@ void SendToCSharp(const char* fieldname, char* t) } template <> -void SendToCSharp(const char* fieldname, char const* t) -{ - if (t != nullptr) - SendString(fieldname, t); - else - SendString(fieldname, "nullptr"); -} - -template <> -void SendToCSharp(const char* fieldname, char* const t) +void SendToCSharp<>(const char* fieldname, char const* t) { if (t != nullptr) SendString(fieldname, t); @@ -86,49 +77,49 @@ void SendToCSharp(const char* fieldname, char* const t) #if XR_TYPE_SAFE_HANDLES template <> -void SendToCSharp(const char* fieldname, XrPath t) +void SendToCSharp<>(const char* fieldname, XrPath t) { SendXrPath(fieldname, t); } template <> -void SendToCSharp(const char* fieldname, XrPath* t) +void SendToCSharp<>(const char* fieldname, XrPath* t) { SendXrPath(fieldname, *t); } template <> -void SendToCSharp(const char* fieldname, XrAction t) +void SendToCSharp<>(const char* fieldname, XrAction t) { SendXrAction(fieldname, t); } template <> -void SendToCSharp(const char* fieldname, XrAction* t) +void SendToCSharp<>(const char* fieldname, XrAction* t) { SendXrAction(fieldname, *t); } template <> -void SendToCSharp(const char* fieldname, XrActionSet t) +void SendToCSharp<>(const char* fieldname, XrActionSet t) { SendXrActionSet(fieldname, t); } template <> -void SendToCSharp(const char* fieldname, XrActionSet* t) +void SendToCSharp<>(const char* fieldname, XrActionSet* t) { SendXrActionSet(fieldname, *t); } template <> -void SendToCSharp(const char* fieldname, XrSpace t) +void SendToCSharp<>(const char* fieldname, XrSpace t) { SendXrSpace(fieldname, t); } template <> -void SendToCSharp(const char* fieldname, XrSpace* t) +void SendToCSharp<>(const char* fieldname, XrSpace* t) { SendXrSpace(fieldname, *t); } diff --git a/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_structs.h b/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_structs.h index d201bfc..414dcc6 100644 --- a/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_structs.h +++ b/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_structs.h @@ -20,15 +20,15 @@ XR_LIST_BASE_STRUCTS(SEND_TO_CSHARP_BASE_STRUCT_CONST_PTR_DECL) #define SEND_TO_CSHARP_STRUCT_DECL(structType, ...) \ template <> \ - void SendToCSharp(const char* fieldname, structType t); + void SendToCSharp<>(const char* fieldname, structType t); #define SEND_TO_CSHARP_STRUCT_PTR_DECL(structType, ...) \ template <> \ - void SendToCSharp(const char* fieldname, structType* t); + void SendToCSharp<>(const char* fieldname, structType* t); #define SEND_TO_CSHARP_STRUCT_CONST_PTR(structType, ...) \ template <> \ - void SendToCSharp(const char* fieldname, structType const* t); + void SendToCSharp<>(const char* fieldname, structType const* t); // Fwd declare base structs XR_LIST_BASE_STRUCTS(SEND_TO_CSHARP_STRUCT_DECL) @@ -73,7 +73,7 @@ XR_LIST_STRUCTURE_TYPES(SEND_TO_CSHARP_STRUCT_CONST_PTR) #define SEND_TO_CSHARP_STRUCTS(structname, ...) \ template <> \ - void SendToCSharp(const char* fieldname, structname t) \ + void SendToCSharp<>(const char* fieldname, structname t) \ { \ StartStruct(fieldname, #structname); \ XR_LIST_STRUCT_##structname(SEND_TO_CSHARP_INDIVIDUAL_FIELDS); \ @@ -83,7 +83,7 @@ XR_LIST_STRUCTURE_TYPES(SEND_TO_CSHARP_STRUCT_CONST_PTR) #define SEND_TO_CSHARP_STRUCTS_PTRS(structname, ...) \ template <> \ - void SendToCSharp(const char* fieldname, structname* t) \ + void SendToCSharp<>(const char* fieldname, structname* t) \ { \ StartStruct(fieldname, #structname); \ XR_LIST_STRUCT_##structname(SEND_TO_CSHARP_INDIVIDUAL_FIELDS_PTR); \ @@ -91,14 +91,14 @@ XR_LIST_STRUCTURE_TYPES(SEND_TO_CSHARP_STRUCT_CONST_PTR) EndStruct(); \ } -#define SEND_TO_CSHARP_STRUCTS_CONST_PTRS(structname, ...) \ - template <> \ - void SendToCSharp(const char* fieldname, const structname* t) \ - { \ - StartStruct(fieldname, #structname); \ - XR_LIST_STRUCT_##structname(SEND_TO_CSHARP_INDIVIDUAL_FIELDS_PTR); \ - XR_LIST_STRUCT_ARRAYS_##structname(SEND_TO_CSHARP_ARRAYS_PTR); \ - EndStruct(); \ +#define SEND_TO_CSHARP_STRUCTS_CONST_PTRS(structname, ...) \ + template <> \ + void SendToCSharp<>(const char* fieldname, const structname* t) \ + { \ + StartStruct(fieldname, #structname); \ + XR_LIST_STRUCT_##structname(SEND_TO_CSHARP_INDIVIDUAL_FIELDS_PTR); \ + XR_LIST_STRUCT_ARRAYS_##structname(SEND_TO_CSHARP_ARRAYS_PTR); \ + EndStruct(); \ } // Basic Structs diff --git a/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_structs_base.h b/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_structs_base.h index a20071d..49a688a 100644 --- a/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_structs_base.h +++ b/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_structs_base.h @@ -8,18 +8,18 @@ } \ break; -#define SEND_TO_CSHARP_BASE_STRUCT(structType) \ - template <> \ - void SendToCSharp(const char* fieldname, structType t) \ - { \ - switch (t.type) \ - { \ - XR_LIST_BASE_STRUCT_TYPES_##structType(BASE_TO_TYPE); \ - case XR_TYPE_UNKNOWN: \ - default: \ - SendToCSharp(fieldname, ""); \ - break; \ - } \ +#define SEND_TO_CSHARP_BASE_STRUCT(structType) \ + template <> \ + void SendToCSharp<>(const char* fieldname, structType t) \ + { \ + switch (t.type) \ + { \ + XR_LIST_BASE_STRUCT_TYPES_##structType(BASE_TO_TYPE); \ + case XR_TYPE_UNKNOWN: \ + default: \ + SendToCSharp(fieldname, ""); \ + break; \ + } \ } XR_LIST_BASE_STRUCTS(SEND_TO_CSHARP_BASE_STRUCT) @@ -32,18 +32,18 @@ XR_LIST_BASE_STRUCTS(SEND_TO_CSHARP_BASE_STRUCT) } \ break; -#define SEND_TO_CSHARP_BASE_STRUCT_PTR(structType) \ - template <> \ - void SendToCSharp(const char* fieldname, structType* t) \ - { \ - switch (t->type) \ - { \ - XR_LIST_BASE_STRUCT_TYPES_##structType(BASE_TO_TYPE_PTR); \ - case XR_TYPE_UNKNOWN: \ - default: \ - SendToCSharp(fieldname, t->type); \ - break; \ - } \ +#define SEND_TO_CSHARP_BASE_STRUCT_PTR(structType) \ + template <> \ + void SendToCSharp<>(const char* fieldname, structType* t) \ + { \ + switch (t->type) \ + { \ + XR_LIST_BASE_STRUCT_TYPES_##structType(BASE_TO_TYPE_PTR); \ + case XR_TYPE_UNKNOWN: \ + default: \ + SendToCSharp(fieldname, t->type); \ + break; \ + } \ } XR_LIST_BASE_STRUCTS(SEND_TO_CSHARP_BASE_STRUCT_PTR) @@ -56,18 +56,18 @@ XR_LIST_BASE_STRUCTS(SEND_TO_CSHARP_BASE_STRUCT_PTR) } \ break; -#define SEND_TO_CSHARP_BASE_STRUCT_CONST_PTR(structType) \ - template <> \ - void SendToCSharp(const char* fieldname, structType const* t) \ - { \ - switch (t->type) \ - { \ - XR_LIST_BASE_STRUCT_TYPES_##structType(BASE_TO_TYPE_CONST_PTR); \ - case XR_TYPE_UNKNOWN: \ - default: \ - SendToCSharp(fieldname, ""); \ - break; \ - } \ +#define SEND_TO_CSHARP_BASE_STRUCT_CONST_PTR(structType) \ + template <> \ + void SendToCSharp<>(const char* fieldname, structType const* t) \ + { \ + switch (t->type) \ + { \ + XR_LIST_BASE_STRUCT_TYPES_##structType(BASE_TO_TYPE_CONST_PTR); \ + case XR_TYPE_UNKNOWN: \ + default: \ + SendToCSharp(fieldname, ""); \ + break; \ + } \ } XR_LIST_BASE_STRUCTS(SEND_TO_CSHARP_BASE_STRUCT_CONST_PTR) @@ -111,8 +111,7 @@ XR_LIST_BASE_STRUCTS(SEND_TO_CSHARP_BASE_STRUCT_ARRAY) case typeType: \ { \ typeName** realTypeArray = reinterpret_cast(t); \ - for (int i = 0; i < lenParam; ++i) \ - SendToCSharp(fieldname, realTypeArray[i]); \ + SendToCSharp(fieldname, realTypeArray[i]); \ } \ break; @@ -126,13 +125,16 @@ XR_LIST_BASE_STRUCTS(SEND_TO_CSHARP_BASE_STRUCT_ARRAY) return true; \ } \ \ - switch (t[0]->type) \ + for (int i = 0; i < lenParam; ++i) \ { \ - XR_LIST_BASE_STRUCT_TYPES_##structType(BASE_TO_TYPE_ARRAY_PTR); \ - case XR_TYPE_UNKNOWN: \ - default: \ - SendToCSharp(fieldname, ""); \ - break; \ + switch (t[i]->type) \ + { \ + XR_LIST_BASE_STRUCT_TYPES_##structType(BASE_TO_TYPE_ARRAY_PTR); \ + case XR_TYPE_UNKNOWN: \ + default: \ + SendToCSharp(fieldname, ""); \ + break; \ + } \ } \ return true; \ } @@ -143,8 +145,7 @@ XR_LIST_BASE_STRUCTS(SEND_TO_CSHARP_BASE_STRUCT_ARRAY_PTR) case typeType: \ { \ typeName const* const* realTypeArray = reinterpret_cast(t); \ - for (int i = 0; i < lenParam; ++i) \ - SendToCSharp(fieldname, realTypeArray[i]); \ + SendToCSharp(fieldname, realTypeArray[i]); \ } \ break; @@ -158,13 +159,16 @@ XR_LIST_BASE_STRUCTS(SEND_TO_CSHARP_BASE_STRUCT_ARRAY_PTR) return true; \ } \ \ - switch (t[0]->type) \ + for (int i = 0; i < lenParam; ++i) \ { \ - XR_LIST_BASE_STRUCT_TYPES_##structType(BASE_TO_TYPE_ARRAY_CONST_PTR); \ - case XR_TYPE_UNKNOWN: \ - default: \ - SendToCSharp(fieldname, ""); \ - break; \ + switch (t[i]->type) \ + { \ + XR_LIST_BASE_STRUCT_TYPES_##structType(BASE_TO_TYPE_ARRAY_CONST_PTR); \ + case XR_TYPE_UNKNOWN: \ + default: \ + SendToCSharp(fieldname, ""); \ + break; \ + } \ } \ return true; \ } diff --git a/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_todo.h b/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_todo.h index 78c079f..2f28040 100644 --- a/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_todo.h +++ b/RuntimeDebugger/Native~/openxr_runtime_debugger/serialize_todo.h @@ -1,26 +1,26 @@ #pragma once template <> -void SendToCSharp(const char* fieldname, XrEventDataBuffer* t) +void SendToCSharp<>(const char* fieldname, XrEventDataBuffer* t) { XrEventDataBaseHeader* evt = reinterpret_cast(t); SendToCSharp("varying", evt); } template <> -void SendToCSharp(const char* fieldname, XrDebugUtilsMessengerCreateInfoEXT const* t) +void SendToCSharp<>(const char* fieldname, XrDebugUtilsMessengerCreateInfoEXT const* t) { SendToCSharp(fieldname, ""); } template <> -void SendToCSharp(const char* fieldname, XrSpatialGraphNodeSpaceCreateInfoMSFT const* t) +void SendToCSharp<>(const char* fieldname, XrSpatialGraphNodeSpaceCreateInfoMSFT const* t) { SendToCSharp(fieldname, ""); } template <> -void SendToCSharp(const char* fieldname, XrInteractionProfileAnalogThresholdVALVE* t) +void SendToCSharp<>(const char* fieldname, XrInteractionProfileAnalogThresholdVALVE* t) { SendToCSharp(fieldname, ""); } diff --git a/RuntimeDebugger/android.meta b/RuntimeDebugger/android.meta index 58eaad2..3f6fd09 100644 --- a/RuntimeDebugger/android.meta +++ b/RuntimeDebugger/android.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e88fa22f1e5e470a970455f4d4be4c65 +guid: 347e0423eb06486b8cde2fc279f68814 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/RuntimeDebugger/android/arm64.meta b/RuntimeDebugger/android/arm64.meta index 9aa9ab5..802d724 100644 --- a/RuntimeDebugger/android/arm64.meta +++ b/RuntimeDebugger/android/arm64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4d1e9d9124a34ef5a6e823b3db36652d +guid: b44ed3b92b7e4d5c832e739e9049b9f5 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/RuntimeDebugger/android/arm64/libopenxr_runtime_debugger.so b/RuntimeDebugger/android/arm64/libopenxr_runtime_debugger.so index be1c916..aeff88b 100644 Binary files a/RuntimeDebugger/android/arm64/libopenxr_runtime_debugger.so and b/RuntimeDebugger/android/arm64/libopenxr_runtime_debugger.so differ diff --git a/RuntimeDebugger/android/arm64/libopenxr_runtime_debugger.so.meta b/RuntimeDebugger/android/arm64/libopenxr_runtime_debugger.so.meta index 8498bbb..e85711a 100644 --- a/RuntimeDebugger/android/arm64/libopenxr_runtime_debugger.so.meta +++ b/RuntimeDebugger/android/arm64/libopenxr_runtime_debugger.so.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d6ac46323a6d439da254f21314c34cda +guid: a07d266c71264681bb1128a86646f4b1 PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/RuntimeDebugger/universalwindows.meta b/RuntimeDebugger/universalwindows.meta index b34608b..acbb757 100644 --- a/RuntimeDebugger/universalwindows.meta +++ b/RuntimeDebugger/universalwindows.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 03f5f2077db54a02bca5bb41f033bb29 +guid: 951bf2bb1a454f14a02a4a21d894224d folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/RuntimeDebugger/universalwindows/arm32.meta b/RuntimeDebugger/universalwindows/arm32.meta index 307b59c..1b72e88 100644 --- a/RuntimeDebugger/universalwindows/arm32.meta +++ b/RuntimeDebugger/universalwindows/arm32.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b7786b9e515e440b9ba5a13143feea04 +guid: 9b3724f0cafe49f3bf21efb5ecd58bae folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/RuntimeDebugger/universalwindows/arm32/openxr_runtime_debugger.dll b/RuntimeDebugger/universalwindows/arm32/openxr_runtime_debugger.dll index 18a0139..4dde095 100644 Binary files a/RuntimeDebugger/universalwindows/arm32/openxr_runtime_debugger.dll and b/RuntimeDebugger/universalwindows/arm32/openxr_runtime_debugger.dll differ diff --git a/RuntimeDebugger/universalwindows/arm32/openxr_runtime_debugger.dll.meta b/RuntimeDebugger/universalwindows/arm32/openxr_runtime_debugger.dll.meta index a496353..accc226 100644 --- a/RuntimeDebugger/universalwindows/arm32/openxr_runtime_debugger.dll.meta +++ b/RuntimeDebugger/universalwindows/arm32/openxr_runtime_debugger.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: ca2697ecf6084666a157185db4c860b7 +guid: 825967c79c854a91b9bbc570dbd89df2 PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/RuntimeDebugger/universalwindows/arm64.meta b/RuntimeDebugger/universalwindows/arm64.meta index 992cabc..ea2b6ba 100644 --- a/RuntimeDebugger/universalwindows/arm64.meta +++ b/RuntimeDebugger/universalwindows/arm64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 492edc3d4cd34768b48eb510e1313e54 +guid: 2bada0c9c97342c79b8534929c4acb3a folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/RuntimeDebugger/universalwindows/arm64/openxr_runtime_debugger.dll b/RuntimeDebugger/universalwindows/arm64/openxr_runtime_debugger.dll index 064fdde..97c4f17 100644 Binary files a/RuntimeDebugger/universalwindows/arm64/openxr_runtime_debugger.dll and b/RuntimeDebugger/universalwindows/arm64/openxr_runtime_debugger.dll differ diff --git a/RuntimeDebugger/universalwindows/arm64/openxr_runtime_debugger.dll.meta b/RuntimeDebugger/universalwindows/arm64/openxr_runtime_debugger.dll.meta index 37aaf97..eb45f27 100644 --- a/RuntimeDebugger/universalwindows/arm64/openxr_runtime_debugger.dll.meta +++ b/RuntimeDebugger/universalwindows/arm64/openxr_runtime_debugger.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: bf454617119d4aaeb73a186028f8309b +guid: d29d0812752f45b39757d7c0f55b25c3 PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/RuntimeDebugger/universalwindows/x64.meta b/RuntimeDebugger/universalwindows/x64.meta index 608dc3d..c2e4f27 100644 --- a/RuntimeDebugger/universalwindows/x64.meta +++ b/RuntimeDebugger/universalwindows/x64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d6222f4eb0ab4bb9864b6413df58cea3 +guid: 70ff30fee60145c093a9a0df08a0de4a folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/RuntimeDebugger/universalwindows/x64/openxr_runtime_debugger.dll b/RuntimeDebugger/universalwindows/x64/openxr_runtime_debugger.dll index 5ec3d47..6ac81e5 100644 Binary files a/RuntimeDebugger/universalwindows/x64/openxr_runtime_debugger.dll and b/RuntimeDebugger/universalwindows/x64/openxr_runtime_debugger.dll differ diff --git a/RuntimeDebugger/universalwindows/x64/openxr_runtime_debugger.dll.meta b/RuntimeDebugger/universalwindows/x64/openxr_runtime_debugger.dll.meta index b488c5e..fa838a4 100644 --- a/RuntimeDebugger/universalwindows/x64/openxr_runtime_debugger.dll.meta +++ b/RuntimeDebugger/universalwindows/x64/openxr_runtime_debugger.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 81406dd79b544ac2ad21d5de53898c90 +guid: 94c4be0866364d5485e039e8e5cacd0e PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/RuntimeDebugger/windows.meta b/RuntimeDebugger/windows.meta index 91b4cc7..fb39d00 100644 --- a/RuntimeDebugger/windows.meta +++ b/RuntimeDebugger/windows.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: dfa011a2da5846059c4edc0ef14f472e +guid: 0f2c49383bb0420caf37424709004e68 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/RuntimeDebugger/windows/x64.meta b/RuntimeDebugger/windows/x64.meta index 31fd6d5..14c5733 100644 --- a/RuntimeDebugger/windows/x64.meta +++ b/RuntimeDebugger/windows/x64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 35d1f951ced14db494c3d54ac8be6ef2 +guid: ab772ffa8f974215b7dca57c61b32e2a folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/RuntimeDebugger/windows/x64/openxr_runtime_debugger.dll b/RuntimeDebugger/windows/x64/openxr_runtime_debugger.dll index c3a711a..ddeb801 100644 Binary files a/RuntimeDebugger/windows/x64/openxr_runtime_debugger.dll and b/RuntimeDebugger/windows/x64/openxr_runtime_debugger.dll differ diff --git a/RuntimeDebugger/windows/x64/openxr_runtime_debugger.dll.meta b/RuntimeDebugger/windows/x64/openxr_runtime_debugger.dll.meta index 2ed445f..fd3e889 100644 --- a/RuntimeDebugger/windows/x64/openxr_runtime_debugger.dll.meta +++ b/RuntimeDebugger/windows/x64/openxr_runtime_debugger.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 85d6d035ebb249feb891479f8d13a740 +guid: 6acf90fb5ad746c4ab5d95c34b5627bb PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/RuntimeLoaders/android.meta b/RuntimeLoaders/android.meta new file mode 100644 index 0000000..937d8b4 --- /dev/null +++ b/RuntimeLoaders/android.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 40e816bced524f698250d15eefcf83ef +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RuntimeLoaders/android/openxr_loader.aar b/RuntimeLoaders/android/openxr_loader.aar new file mode 100644 index 0000000..c380e21 Binary files /dev/null and b/RuntimeLoaders/android/openxr_loader.aar differ diff --git a/RuntimeLoaders/android/openxr_loader.aar.meta b/RuntimeLoaders/android/openxr_loader.aar.meta new file mode 100644 index 0000000..c8262e9 --- /dev/null +++ b/RuntimeLoaders/android/openxr_loader.aar.meta @@ -0,0 +1,82 @@ +fileFormatVersion: 2 +guid: df647b2cfe2a4848ba177a3f1cbf8dc4 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 0 + Exclude Editor: 1 + Exclude Linux64: 1 + Exclude OSXUniversal: 1 + Exclude Win: 1 + Exclude Win64: 1 + - first: + Android: Android + second: + enabled: 1 + settings: + CPU: ARM64 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/RuntimeLoaders/universalwindows.meta b/RuntimeLoaders/universalwindows.meta index 6bd05cd..c8f303a 100644 --- a/RuntimeLoaders/universalwindows.meta +++ b/RuntimeLoaders/universalwindows.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4f1ce89de55845dd97c89f2df6cf0320 +guid: 92d8088221d742d0b99307f83425863c folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/RuntimeLoaders/universalwindows/arm32.meta b/RuntimeLoaders/universalwindows/arm32.meta index 7119574..ed6bcc3 100644 --- a/RuntimeLoaders/universalwindows/arm32.meta +++ b/RuntimeLoaders/universalwindows/arm32.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 3488a6b9bdd74e7b9d4ae7b6718e5b8f +guid: be5245234db24e48b141bcc9c6329eca folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/RuntimeLoaders/universalwindows/arm32/openxr_loader.dll.meta b/RuntimeLoaders/universalwindows/arm32/openxr_loader.dll.meta index 1797928..56244b4 100644 --- a/RuntimeLoaders/universalwindows/arm32/openxr_loader.dll.meta +++ b/RuntimeLoaders/universalwindows/arm32/openxr_loader.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e4036b4ff6174ef8995053573475f4ff +guid: 0d4ca59876ff4aa5966e33cb6ab1aeef PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/RuntimeLoaders/universalwindows/arm64.meta b/RuntimeLoaders/universalwindows/arm64.meta index 10d6275..5d65bbc 100644 --- a/RuntimeLoaders/universalwindows/arm64.meta +++ b/RuntimeLoaders/universalwindows/arm64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c891bbe19a9547e596df7f8c60cc727a +guid: d931c6e4eed04d3986f97641af13dd70 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/RuntimeLoaders/universalwindows/arm64/openxr_loader.dll.meta b/RuntimeLoaders/universalwindows/arm64/openxr_loader.dll.meta index d9d24de..7004c6f 100644 --- a/RuntimeLoaders/universalwindows/arm64/openxr_loader.dll.meta +++ b/RuntimeLoaders/universalwindows/arm64/openxr_loader.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a1e1dbf680264d4d80653e60b04c248b +guid: f6c8e5aa6f8d4eca8c6abd6fe656c80b PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/RuntimeLoaders/universalwindows/x64.meta b/RuntimeLoaders/universalwindows/x64.meta index 5a81b28..2846a1b 100644 --- a/RuntimeLoaders/universalwindows/x64.meta +++ b/RuntimeLoaders/universalwindows/x64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7d9d92087dc4433b8d86fe544c9b3514 +guid: 7a6f904775f74475a94191573e097cba folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/RuntimeLoaders/universalwindows/x64/openxr_loader.dll.meta b/RuntimeLoaders/universalwindows/x64/openxr_loader.dll.meta index d9d54a7..679d0c6 100644 --- a/RuntimeLoaders/universalwindows/x64/openxr_loader.dll.meta +++ b/RuntimeLoaders/universalwindows/x64/openxr_loader.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d265d5a8a49a48b09dc7357a7705f36a +guid: 2e4962be5441424393c130aae7f34156 PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/RuntimeLoaders/windows.meta b/RuntimeLoaders/windows.meta index c22dc78..f9d496d 100644 --- a/RuntimeLoaders/windows.meta +++ b/RuntimeLoaders/windows.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4ea927874df242509330f4f90879ce35 +guid: 163be923d84e4565943cf8046751b66d folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/RuntimeLoaders/windows/x64.meta b/RuntimeLoaders/windows/x64.meta index d0a7fab..ff95ba8 100644 --- a/RuntimeLoaders/windows/x64.meta +++ b/RuntimeLoaders/windows/x64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 3bff096d99cd44aea0a7634ec87dd7fc +guid: 3365c91ed34b4532bdc15119e61f02fe folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/RuntimeLoaders/windows/x64/openxr_loader.dll.meta b/RuntimeLoaders/windows/x64/openxr_loader.dll.meta index c7fe2ed..7427ca5 100644 --- a/RuntimeLoaders/windows/x64/openxr_loader.dll.meta +++ b/RuntimeLoaders/windows/x64/openxr_loader.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 543b2457309e47219349fa4ba1250481 +guid: 94a67ece839c420a84aa0d8c942719b4 PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/Samples~/InterceptFeature/InterceptFeaturePlugin/android.meta b/Samples~/InterceptFeature/InterceptFeaturePlugin/android.meta index 0e9e00a..b69f2da 100644 --- a/Samples~/InterceptFeature/InterceptFeaturePlugin/android.meta +++ b/Samples~/InterceptFeature/InterceptFeaturePlugin/android.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8ff395d83aec4a53948f725aa8f681ef +guid: f6bd463c93784b689b7b699552ee5ff0 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Samples~/InterceptFeature/InterceptFeaturePlugin/android/arm64.meta b/Samples~/InterceptFeature/InterceptFeaturePlugin/android/arm64.meta index b4912d4..2b38db7 100644 --- a/Samples~/InterceptFeature/InterceptFeaturePlugin/android/arm64.meta +++ b/Samples~/InterceptFeature/InterceptFeaturePlugin/android/arm64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9b2c136ba0c743f2be32fde69aa7bb23 +guid: 28f4a3e7c11c465f85067b6262e9e987 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Samples~/InterceptFeature/InterceptFeaturePlugin/universalwindows.meta b/Samples~/InterceptFeature/InterceptFeaturePlugin/universalwindows.meta index 02588dc..32e777e 100644 --- a/Samples~/InterceptFeature/InterceptFeaturePlugin/universalwindows.meta +++ b/Samples~/InterceptFeature/InterceptFeaturePlugin/universalwindows.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7d0a612a4c954bcf8060a90f496e1826 +guid: 274de476000b4539a4aca3a5454a2554 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Samples~/InterceptFeature/InterceptFeaturePlugin/universalwindows/arm32.meta b/Samples~/InterceptFeature/InterceptFeaturePlugin/universalwindows/arm32.meta index 63eec8f..162b329 100644 --- a/Samples~/InterceptFeature/InterceptFeaturePlugin/universalwindows/arm32.meta +++ b/Samples~/InterceptFeature/InterceptFeaturePlugin/universalwindows/arm32.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 98a5f340c4a742de94a820097e648554 +guid: bfbc84f533c648228f6aeb3983d8ef73 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Samples~/InterceptFeature/InterceptFeaturePlugin/universalwindows/arm64.meta b/Samples~/InterceptFeature/InterceptFeaturePlugin/universalwindows/arm64.meta index 7d7bed1..ce1a2b7 100644 --- a/Samples~/InterceptFeature/InterceptFeaturePlugin/universalwindows/arm64.meta +++ b/Samples~/InterceptFeature/InterceptFeaturePlugin/universalwindows/arm64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 5a0c42aa5e844f77aceccfe40660cfec +guid: 717f03e4aa2b4617b814688ab029b350 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Samples~/InterceptFeature/InterceptFeaturePlugin/universalwindows/x64.meta b/Samples~/InterceptFeature/InterceptFeaturePlugin/universalwindows/x64.meta index bf882d3..0b47d2f 100644 --- a/Samples~/InterceptFeature/InterceptFeaturePlugin/universalwindows/x64.meta +++ b/Samples~/InterceptFeature/InterceptFeaturePlugin/universalwindows/x64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 98d1aaf620c94017a55dec055b67da60 +guid: d80f6fa2fd9946a6911d9ea28529d833 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Samples~/InterceptFeature/InterceptFeaturePlugin/windows.meta b/Samples~/InterceptFeature/InterceptFeaturePlugin/windows.meta index ed00a22..617116b 100644 --- a/Samples~/InterceptFeature/InterceptFeaturePlugin/windows.meta +++ b/Samples~/InterceptFeature/InterceptFeaturePlugin/windows.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 3738abea8ee14c7683710d7a82d44dbd +guid: d00f2f9afa284b15a3f2e664e2d82b5e folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Samples~/InterceptFeature/InterceptFeaturePlugin/windows/x64.meta b/Samples~/InterceptFeature/InterceptFeaturePlugin/windows/x64.meta index a83aa42..da307bc 100644 --- a/Samples~/InterceptFeature/InterceptFeaturePlugin/windows/x64.meta +++ b/Samples~/InterceptFeature/InterceptFeaturePlugin/windows/x64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 3bb7f6e80a7f410192f68008bb662ef3 +guid: c07b72fababb488082d11f35865363a2 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Samples~/InterceptFeature/InterceptFeaturePlugin/windows/x64/InterceptFeaturePlugin.dll b/Samples~/InterceptFeature/InterceptFeaturePlugin/windows/x64/InterceptFeaturePlugin.dll index 5bb6ebe..58fd36f 100644 Binary files a/Samples~/InterceptFeature/InterceptFeaturePlugin/windows/x64/InterceptFeaturePlugin.dll and b/Samples~/InterceptFeature/InterceptFeaturePlugin/windows/x64/InterceptFeaturePlugin.dll differ diff --git a/Samples~/MeshingFeature/MeshingFeaturePlugin/android.meta b/Samples~/MeshingFeature/MeshingFeaturePlugin/android.meta index e904f31..ff80f9d 100644 --- a/Samples~/MeshingFeature/MeshingFeaturePlugin/android.meta +++ b/Samples~/MeshingFeature/MeshingFeaturePlugin/android.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: bed887e9884546eb8331d68f209bd577 +guid: 64d9f76f48be4870b7a130aabbddfd92 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Samples~/MeshingFeature/MeshingFeaturePlugin/android/arm64.meta b/Samples~/MeshingFeature/MeshingFeaturePlugin/android/arm64.meta index 0940e9c..4ff0b8e 100644 --- a/Samples~/MeshingFeature/MeshingFeaturePlugin/android/arm64.meta +++ b/Samples~/MeshingFeature/MeshingFeaturePlugin/android/arm64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8d6c041d960d461a96c533aff539a1ef +guid: d0a43efb866e4538861b2241252e94d4 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Samples~/MeshingFeature/MeshingFeaturePlugin/android/arm64/libMeshingFeaturePlugin.so.meta b/Samples~/MeshingFeature/MeshingFeaturePlugin/android/arm64/libMeshingFeaturePlugin.so.meta index 1d43d3b..6eccaa3 100644 --- a/Samples~/MeshingFeature/MeshingFeaturePlugin/android/arm64/libMeshingFeaturePlugin.so.meta +++ b/Samples~/MeshingFeature/MeshingFeaturePlugin/android/arm64/libMeshingFeaturePlugin.so.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9c2251efbf3448928b58d22182e43703 +guid: 6ad44671d7f44301816b420330e4bca4 PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/Samples~/MeshingFeature/MeshingFeaturePlugin/universalwindows.meta b/Samples~/MeshingFeature/MeshingFeaturePlugin/universalwindows.meta index 02920a8..bebabe4 100644 --- a/Samples~/MeshingFeature/MeshingFeaturePlugin/universalwindows.meta +++ b/Samples~/MeshingFeature/MeshingFeaturePlugin/universalwindows.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b41e96f8672344b6a4319a9b2b3cceaf +guid: 5835cb74ae1a41528a2025df8725ade7 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Samples~/MeshingFeature/MeshingFeaturePlugin/universalwindows/arm32.meta b/Samples~/MeshingFeature/MeshingFeaturePlugin/universalwindows/arm32.meta index 99e98dd..3c08eed 100644 --- a/Samples~/MeshingFeature/MeshingFeaturePlugin/universalwindows/arm32.meta +++ b/Samples~/MeshingFeature/MeshingFeaturePlugin/universalwindows/arm32.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6128c25054cf406a9ccb8033f93d1025 +guid: 28cbeac2524a48a4b52f55a47be1dcb4 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Samples~/MeshingFeature/MeshingFeaturePlugin/universalwindows/arm64.meta b/Samples~/MeshingFeature/MeshingFeaturePlugin/universalwindows/arm64.meta index 3f99768..08a0ee0 100644 --- a/Samples~/MeshingFeature/MeshingFeaturePlugin/universalwindows/arm64.meta +++ b/Samples~/MeshingFeature/MeshingFeaturePlugin/universalwindows/arm64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 523d2ef2c1064b49b3508e43065fe657 +guid: 1af20d0c158d4c0e9518191f3743c404 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Samples~/MeshingFeature/MeshingFeaturePlugin/universalwindows/x64.meta b/Samples~/MeshingFeature/MeshingFeaturePlugin/universalwindows/x64.meta index 85b9e94..76dda47 100644 --- a/Samples~/MeshingFeature/MeshingFeaturePlugin/universalwindows/x64.meta +++ b/Samples~/MeshingFeature/MeshingFeaturePlugin/universalwindows/x64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4983e14531c9443ea212221f36e58b74 +guid: b01e7ea29881433492668754b7411332 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Samples~/MeshingFeature/MeshingFeaturePlugin/universalwindows/x64/MeshingFeaturePlugin.dll b/Samples~/MeshingFeature/MeshingFeaturePlugin/universalwindows/x64/MeshingFeaturePlugin.dll index 2dae7a1..79c9bd7 100644 Binary files a/Samples~/MeshingFeature/MeshingFeaturePlugin/universalwindows/x64/MeshingFeaturePlugin.dll and b/Samples~/MeshingFeature/MeshingFeaturePlugin/universalwindows/x64/MeshingFeaturePlugin.dll differ diff --git a/Samples~/MeshingFeature/MeshingFeaturePlugin/windows.meta b/Samples~/MeshingFeature/MeshingFeaturePlugin/windows.meta index aa0db26..6e5d0c9 100644 --- a/Samples~/MeshingFeature/MeshingFeaturePlugin/windows.meta +++ b/Samples~/MeshingFeature/MeshingFeaturePlugin/windows.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8673992699c949dcac53a3a1e11393a2 +guid: 41a26e4e2050487b9db63a000db108f3 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Samples~/MeshingFeature/MeshingFeaturePlugin/windows/x64.meta b/Samples~/MeshingFeature/MeshingFeaturePlugin/windows/x64.meta index 6dec74f..64b7871 100644 --- a/Samples~/MeshingFeature/MeshingFeaturePlugin/windows/x64.meta +++ b/Samples~/MeshingFeature/MeshingFeaturePlugin/windows/x64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6384e4357e614c509e712ab93acce2d2 +guid: 5128967de9e8447295722341e9d3da74 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Samples~/MeshingFeature/MeshingFeaturePlugin/windows/x64/MeshingFeaturePlugin.dll b/Samples~/MeshingFeature/MeshingFeaturePlugin/windows/x64/MeshingFeaturePlugin.dll index d358a74..3f4cc3a 100644 Binary files a/Samples~/MeshingFeature/MeshingFeaturePlugin/windows/x64/MeshingFeaturePlugin.dll and b/Samples~/MeshingFeature/MeshingFeaturePlugin/windows/x64/MeshingFeaturePlugin.dll differ diff --git a/Samples~/MeshingFeature/MeshingFeaturePlugin/windows/x64/MeshingFeaturePlugin.dll.meta b/Samples~/MeshingFeature/MeshingFeaturePlugin/windows/x64/MeshingFeaturePlugin.dll.meta index 4064b01..f72203c 100644 --- a/Samples~/MeshingFeature/MeshingFeaturePlugin/windows/x64/MeshingFeaturePlugin.dll.meta +++ b/Samples~/MeshingFeature/MeshingFeaturePlugin/windows/x64/MeshingFeaturePlugin.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4509bf5f1c1a4b32b70573d1e6ea9ea5 +guid: 556d3136538a4c1b8572f0a13b83b40c PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/Tests/Editor/OpenXREditorTests.cs b/Tests/Editor/OpenXREditorTests.cs index ac2a980..bd2fe84 100644 --- a/Tests/Editor/OpenXREditorTests.cs +++ b/Tests/Editor/OpenXREditorTests.cs @@ -28,7 +28,7 @@ public void PluginVersion() if (ReleaseVersion.IsMatch(version)) { var tag = OpenXRRuntime.pluginVersion; - Assert.AreEqual(0, String.Compare(version, tag)); + Assert.AreEqual(0, String.Compare(version, tag), "Tag in github must match the package version number."); return; } //check for non-release build package version number supposed to be x.x.x-pre.x(pre-release) or x.x.x-exp.x(experimental) diff --git a/Tests/Editor/zBuildHookTests.cs b/Tests/Editor/zBuildHookTests.cs index 9a0a1b4..6a71363 100644 --- a/Tests/Editor/zBuildHookTests.cs +++ b/Tests/Editor/zBuildHookTests.cs @@ -1,10 +1,13 @@ using System; +using System.Collections.Generic; using System.IO; +using System.Linq; using System.Reflection; using NUnit.Framework; using UnityEditor.XR.OpenXR.Features; using UnityEngine.XR.OpenXR.Features.Mock; using UnityEditor.Build.Reporting; +using UnityEngine.XR.Management; using UnityEngine.XR.OpenXR.Tests; using Assert = UnityEngine.Assertions.Assert; @@ -64,6 +67,87 @@ public void PrePostCallbacksAreReceived() Assert.IsTrue(postprocessCalled); } + [Test] + public void NoBuildCallbacksFeatureDisabled() + { + bool preprocessCalled = false; + bool postprocessCalled = false; + + BuildCallbacks.TestCallback = (methodName, param) => + { + if (methodName == "OnPreprocessBuildExt") + { + preprocessCalled = true; + } + + if (methodName == "OnPostprocessBuildExt") + { + postprocessCalled = true; + } + + return true; + }; + + // Disable mock runtime, no callbacks should occur during build + EnableFeature(false); + BuildMockPlayer(); + Assert.IsFalse(preprocessCalled); + Assert.IsFalse(postprocessCalled); + } + + [Test] + public void NoBuildCallbacksOpenXRDisabled() + { + bool preprocessCalled = false; + bool postprocessCalled = false; + + BuildCallbacks.TestCallback = (methodName, param) => + { + if (methodName == "OnPreprocessBuildExt") + { + preprocessCalled = true; + } + + if (methodName == "OnPostprocessBuildExt") + { + postprocessCalled = true; + } + + return true; + }; + + // Remove OpenXR Loader, no callbacks should occur during build + var loaders = XRGeneralSettings.Instance.Manager.activeLoaders; + XRGeneralSettings.Instance.Manager.TrySetLoaders(new List()); + BuildMockPlayer(); + XRGeneralSettings.Instance.Manager.TrySetLoaders(new List(loaders)); + Assert.IsFalse(preprocessCalled); + Assert.IsFalse(postprocessCalled); + } + + private bool HasOpenXRLibraries(BuildReport report) + { + var path = Path.GetDirectoryName(report.summary.outputPath); + var dir = new DirectoryInfo(path); + var dlls = dir.EnumerateFiles("*.dll", SearchOption.AllDirectories).Select(s => s.Name).ToList(); + return dlls.Contains("openxr_loader.dll") || dlls.Contains("UnityOpenXR.dll"); + } + + [Test] + public void VerifyBuildOutputLibraries() + { + var resultWithOpenXR = BuildMockPlayer(); + // Disable this test if we're not running our openxr yamato infrastructure + if (resultWithOpenXR.summary.result != BuildResult.Succeeded && Environment.GetEnvironmentVariable("UNITY_OPENXR_YAMATO") != "1") + return; + Assert.IsTrue(HasOpenXRLibraries(resultWithOpenXR)); + + // Remove OpenXR Loader + XRGeneralSettings.Instance.Manager.TrySetLoaders(new List()); + var resultWithoutOpenXR = BuildMockPlayer(); + Assert.IsFalse(HasOpenXRLibraries(resultWithoutOpenXR)); + } + internal class BuildCallbacks : OpenXRFeatureBuildHooks { [NonSerialized] internal static Func TestCallback = (methodName, param) => true; diff --git a/Tests/Runtime/ManagementTestSetup.cs b/Tests/Runtime/ManagementTestSetup.cs index 65a4793..0de940c 100644 --- a/Tests/Runtime/ManagementTestSetup.cs +++ b/Tests/Runtime/ManagementTestSetup.cs @@ -74,6 +74,7 @@ public virtual void SetupTest() xrGeneralSettings.Manager = testManager; buildTargetSettings.SetSettingsForBuildTarget(BuildTargetGroup.Standalone, xrGeneralSettings); + buildTargetSettings.SetSettingsForBuildTarget(BuildPipeline.GetBuildTargetGroup(UnityEditor.EditorUserBuildSettings.activeBuildTarget), xrGeneralSettings); AssetDatabase.CreateAsset(xrGeneralSettings, testPathToSettings); AssetDatabase.AddObjectToAsset(testManager, xrGeneralSettings); diff --git a/Tests/Runtime/MockInteractionFeature.cs b/Tests/Runtime/MockInteractionFeature.cs index 8514d29..fad78d9 100644 --- a/Tests/Runtime/MockInteractionFeature.cs +++ b/Tests/Runtime/MockInteractionFeature.cs @@ -22,7 +22,7 @@ namespace UnityEngine.XR.OpenXR.Tests /// #if UNITY_EDITOR [UnityEditor.XR.OpenXR.Features.OpenXRFeature(UiName = "Mock Interaction Feature", - BuildTargetGroups = new[] { BuildTargetGroup.Standalone}, + BuildTargetGroups = new[] { BuildTargetGroup.Standalone, BuildTargetGroup.Android }, Company = "Unity", Desc = "Mock interaction feature used for testing interactions", DocumentationLink = Constants.k_DocumentationManualURL + "features/khrsimplecontrollerprofile.html", diff --git a/Tests/Runtime/MockRuntimeTests.cs b/Tests/Runtime/MockRuntimeTests.cs index 63bae90..0f7d795 100644 --- a/Tests/Runtime/MockRuntimeTests.cs +++ b/Tests/Runtime/MockRuntimeTests.cs @@ -297,10 +297,10 @@ public IEnumerator BoundaryPoints() var comparer = new Vector3EqualityComparer(10e-6f); - Assert.That(points[0], Is.EqualTo(new Vector3 {x = -1.0f, y = 0.0f, z = -3.0f}).Using(comparer)); - Assert.That(points[1], Is.EqualTo(new Vector3 {x = -1.0f, y = 0.0f, z = 3.0f}).Using(comparer)); - Assert.That(points[2], Is.EqualTo(new Vector3 {x = 1.0f, y = 0.0f, z = 3.0f}).Using(comparer)); - Assert.That(points[3], Is.EqualTo(new Vector3 {x = 1.0f, y = 0.0f, z = -3.0f}).Using(comparer)); + Assert.That(points[0], Is.EqualTo(new Vector3 {x = -0.5f, y = 0.0f, z = -1.5f}).Using(comparer)); + Assert.That(points[1], Is.EqualTo(new Vector3 {x = -0.5f, y = 0.0f, z = 1.5f}).Using(comparer)); + Assert.That(points[2], Is.EqualTo(new Vector3 {x = 0.5f, y = 0.0f, z = 1.5f}).Using(comparer)); + Assert.That(points[3], Is.EqualTo(new Vector3 {x = 0.5f, y = 0.0f, z = -1.5f}).Using(comparer)); } [UnityTest] diff --git a/Tests/Runtime/NativeTests.cs b/Tests/Runtime/NativeTests.cs index 6be13bc..6f82105 100644 --- a/Tests/Runtime/NativeTests.cs +++ b/Tests/Runtime/NativeTests.cs @@ -1,6 +1,7 @@ using NUnit.Framework; using UnityEngine.XR.OpenXR.Input; using System.Text; +using UnityEngine.TestTools; namespace UnityEngine.XR.OpenXR.Tests { @@ -21,7 +22,7 @@ public void OpenXRLoader_LoadOpenXRLibrary_NullLoaderPath() [Test] public void OpenXRLoader_LoadOpenXRLibrary_InvalidLoaderPath() { - Assert.IsFalse(OpenXRLoaderBase.Internal_LoadOpenXRLibrary(Encoding.Unicode.GetBytes("abababab"))); + Assert.IsFalse(OpenXRLoaderBase.Internal_LoadOpenXRLibrary(OpenXRLoaderBase.StringToWCHAR_T("abababab"))); } [Test] diff --git a/Tests/Runtime/NoRuntimeTests.cs b/Tests/Runtime/NoRuntimeTests.cs index eef7952..aad207a 100644 --- a/Tests/Runtime/NoRuntimeTests.cs +++ b/Tests/Runtime/NoRuntimeTests.cs @@ -51,6 +51,7 @@ public IEnumerator LoadRuntimeAfterNoRuntime() Assert.IsNull(activeLoader); + #if !OPENXR_USE_KHRONOS_LOADER Environment.SetEnvironmentVariable("XR_RUNTIME_JSON", ""); EnableMockRuntime(); @@ -61,6 +62,7 @@ public IEnumerator LoadRuntimeAfterNoRuntime() Assert.IsNotNull(activeLoader); Assert.AreEqual(OpenXRRuntime.name, "Unity Mock Runtime"); + #endif } } } \ No newline at end of file diff --git a/Tests/Runtime/OpenXRInputTests.cs b/Tests/Runtime/OpenXRInputTests.cs index 7c1b051..05e12a8 100644 --- a/Tests/Runtime/OpenXRInputTests.cs +++ b/Tests/Runtime/OpenXRInputTests.cs @@ -35,11 +35,13 @@ protected static bool IsNodeTracked(XRNode node) protected static readonly (Type featureType, Type layoutType, string layoutNameOverride) [] s_InteractionFeatureLayouts = { (typeof(OculusTouchControllerProfile), typeof(OculusTouchControllerProfile.OculusTouchController), null), (typeof(EyeGazeInteraction), typeof(EyeGazeInteraction.EyeGazeDevice), "EyeGaze"), - (typeof(HTCViveControllerProfile), typeof(HTCViveControllerProfile.ViveController), null), (typeof(MicrosoftHandInteraction), typeof(MicrosoftHandInteraction.HoloLensHand), null), - (typeof(MicrosoftMotionControllerProfile), typeof(MicrosoftMotionControllerProfile.WMRSpatialController), null), (typeof(KHRSimpleControllerProfile), typeof(KHRSimpleControllerProfile.KHRSimpleController), null), +#if !UNITY_ANDROID + (typeof(HTCViveControllerProfile), typeof(HTCViveControllerProfile.ViveController), null), + (typeof(MicrosoftMotionControllerProfile), typeof(MicrosoftMotionControllerProfile.WMRSpatialController), null), (typeof(ValveIndexControllerProfile), typeof(ValveIndexControllerProfile.ValveIndexController), null) +#endif }; /// diff --git a/Tests/Runtime/OpenXRLoaderSetup.cs b/Tests/Runtime/OpenXRLoaderSetup.cs index ab0042c..8909b6e 100644 --- a/Tests/Runtime/OpenXRLoaderSetup.cs +++ b/Tests/Runtime/OpenXRLoaderSetup.cs @@ -1,10 +1,15 @@ using System; using System.Collections; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Runtime.CompilerServices; using System.Text.RegularExpressions; using NUnit.Framework; +using UnityEditor; +#if UNITY_EDITOR +using UnityEditor.XR.OpenXR.Features; +#endif using UnityEngine; using UnityEngine.TestTools; using UnityEngine.XR.Management; @@ -15,7 +20,7 @@ using Assert = UnityEngine.Assertions.Assert; [assembly: InternalsVisibleTo("Unity.XR.OpenXR.Tests.Editor")] -[assembly:UnityPlatform(RuntimePlatform.WindowsPlayer, RuntimePlatform.WindowsEditor)] +[assembly:UnityPlatform(RuntimePlatform.WindowsPlayer, RuntimePlatform.WindowsEditor, RuntimePlatform.Android)] namespace UnityEngine.XR.OpenXR.Tests { @@ -31,7 +36,7 @@ internal class OpenXRLoaderSetup : LoaderTestSetup /// Feature type /// Reference to the requested feature or null if not found protected OpenXRFeature GetFeature(Type featureType) => - OpenXRSettings.Instance.GetFeature(featureType); + OpenXRSettings.ActiveBuildTargetInstance.GetFeature(featureType); /// /// Helper method to return a feature of the given type @@ -70,7 +75,7 @@ protected bool EnableMockRuntime(bool enable = true) return true; feature.enabled = enable; - feature.openxrExtensionStrings = MockRuntime.XR_UNITY_null_gfx; + feature.openxrExtensionStrings = MockRuntime.XR_UNITY_null_gfx + " " + MockRuntime.XR_UNITY_android_present; feature.priority = 0; feature.required = false; feature.ignoreValidationErrors = true; @@ -85,7 +90,7 @@ protected void AddExtension(string extensionName) private void DisableAllFeatures() { - foreach (var ext in OpenXRSettings.Instance.features) + foreach (var ext in OpenXRSettings.ActiveBuildTargetInstance.features) { ext.enabled = false; } @@ -101,14 +106,15 @@ public override void SetupTest() base.SetupTest(); #if UNITY_EDITOR - UnityEditor.XR.OpenXR.Features.FeatureHelpers.RefreshFeatures(UnityEditor.BuildTargetGroup.Standalone); + UnityEditor.XR.OpenXR.Features.FeatureHelpers.RefreshFeatures(BuildTargetGroup.Standalone); + UnityEditor.XR.OpenXR.Features.FeatureHelpers.RefreshFeatures(BuildPipeline.GetBuildTargetGroup(UnityEditor.EditorUserBuildSettings.activeBuildTarget)); #endif // Enable all build features var featureTypes = new List(); QueryBuildFeatures(featureTypes); featureTypes.Add(typeof(MockRuntime)); - foreach (var feature in featureTypes.Select(featureType => OpenXRSettings.Instance.GetFeature(featureType)).Where(feature => null != feature)) + foreach (var feature in featureTypes.Select(featureType => OpenXRSettings.ActiveBuildTargetInstance.GetFeature(featureType)).Where(feature => null != feature)) { feature.enabled = true; } @@ -128,11 +134,11 @@ protected virtual void QueryBuildFeatures(List featureTypes) public virtual void BeforeTest() { // Make sure we are not running - if(OpenXRLoaderBase.Instance != null) + if (OpenXRLoaderBase.Instance != null) StopAndShutdown(); // Cache off the features before we start - savedFeatures = (OpenXRFeature[])OpenXRSettings.Instance.features.Clone(); + savedFeatures = (OpenXRFeature[])OpenXRSettings.ActiveBuildTargetInstance.features.Clone(); // Disable all features to make sure the feature list is clean before tests start. DisableAllFeatures(); @@ -141,11 +147,23 @@ public virtual void BeforeTest() Assert.IsTrue(EnableMockRuntime()); MockRuntime.ResetDefaults(); OpenXRRuntime.ClearEvents(); - OpenXRRestarter.Instance.ResetCallbacks (); + OpenXRRestarter.Instance.ResetCallbacks(); #pragma warning disable CS0618 loader = XRGeneralSettings.Instance?.Manager?.loaders[0] as OpenXRLoader; #pragma warning restore CS0618 + + #if UNITY_EDITOR && OPENXR_USE_KHRONOS_LOADER + var features = FeatureHelpersInternal.GetAllFeatureInfo(BuildTargetGroup.Standalone); + foreach (var f in features.Features) + { + if (f.Feature.nameUi == "Mock Runtime") + { + var path = Path.GetFullPath(f.PluginPath + "/unity-mock-runtime.json"); + Environment.SetEnvironmentVariable("XR_RUNTIME_JSON", path); + } + } + #endif } [UnityTearDown] @@ -166,16 +184,21 @@ public IEnumerator TearDown () public virtual void AfterTest() { #pragma warning disable CS0618 - loader = XRGeneralSettings.Instance?.Manager?.loaders[0] as OpenXRLoader; + var curLoader = XRGeneralSettings.Instance?.Manager?.activeLoader; + // Restore the original loader if it got removed during the test + if (curLoader == null) + XRGeneralSettings.Instance?.Manager?.TryAddLoader(loader); #pragma warning restore CS0618 OpenXRRestarter.Instance.ResetCallbacks(); StopAndShutdown(); EnableMockRuntime(false); MockRuntime.Instance.TestCallback = (methodName, param) => true; + MockRuntime.KeepFunctionCallbacks = false; + MockRuntime.ClearFunctionCallbacks(); // Replace the features with the saved features - OpenXRSettings.Instance.features = savedFeatures; + OpenXRSettings.ActiveBuildTargetInstance.features = savedFeatures; } public override void Setup() diff --git a/Tests/Runtime/OpenXRRuntimeTests.cs b/Tests/Runtime/OpenXRRuntimeTests.cs index 6b6865a..fdedcdd 100644 --- a/Tests/Runtime/OpenXRRuntimeTests.cs +++ b/Tests/Runtime/OpenXRRuntimeTests.cs @@ -419,6 +419,7 @@ public IEnumerator CheckSpecExtensionEnabled() }; [UnityTest] + [UnityPlatform(exclude=new[] {RuntimePlatform.Android})] // Vulkan doesn't have depth on earlier versions of unity public IEnumerator CheckDepthSubmissionMode([ValueSource("depthModes")] OpenXRSettings.DepthSubmissionMode depthMode) { base.InitializeAndStart(); @@ -810,55 +811,50 @@ public void InitializeException() Assert.IsTrue(OpenXRLoaderBase.Instance == null); } -#if false - //Disable instable tests that rely on time [UnityTest] public IEnumerator RestartLoopTest() { float initialTimeBetweenRestarts = OpenXRRestarter.TimeBetweenRestartAttempts; + bool initialKeepFunctionCallbacks = MockRuntime.KeepFunctionCallbacks; + var initialXRGetSystemCallback = MockRuntime.GetBeforeFunctionCallback("xrGetSystem"); try { - float timeBetweenRestarts = 1.0f; - - // Wait 10% extra time to ensure that the restart was triggered. - float timeToWait = 1.1f * timeBetweenRestarts; + MockRuntime.KeepFunctionCallbacks = true; + float timeBetweenRestarts = 0.5f; yield return null; - // Should have 0 restart attempts before starting. - Debug.Log("Restart Attempts:" + OpenXRRestarter.PauseAndRestartAttempts.ToString()); - Assert.AreEqual(0, OpenXRRestarter.PauseAndRestartAttempts); - // Reduce the time between restarts to reduce the time of this test. OpenXRRestarter.TimeBetweenRestartAttempts = timeBetweenRestarts; - // Trigger initialize, which should throw the first form factor unavailable error. - MockRuntime.SetFunctionCallback("xrGetSystem", (name) => XrResult.FormFactorUnavailable); - LogAssert.Expect(LogType.Error, "Failure to restart OpenXRLoader after shutdown."); + int resetAttempts = 0; + MockRuntime.SetFunctionCallback("xrGetSystem", (name) => + { + MockRuntime.KeepFunctionCallbacks = true; + resetAttempts += 1; + if (resetAttempts <= 2) + { + return XrResult.FormFactorUnavailable; + } + else + { + return XrResult.Success; + } + }); + + // Trigger initialize, which should throw an error from xrGetSystem, + // This will trigger a restart, which should trigger another error from xrGetSystem, + // Which should trigger another restart, etc. until xrGetSystem returns a success. + LogAssert.ignoreFailingMessages = true; base.InitializeAndStart(); - // Make sure the first retry attempt (second time xrGetSystem is called) also returns a form factor error. - MockRuntime.SetFunctionCallback("xrGetSystem", (name) => XrResult.FormFactorUnavailable); - LogAssert.Expect(LogType.Error, "Failure to restart OpenXRLoader after shutdown."); - yield return new WaitForSeconds(timeToWait); - Debug.Log("Restart Attempts:" + OpenXRRestarter.PauseAndRestartAttempts.ToString()); - Assert.AreEqual(1, OpenXRRestarter.PauseAndRestartAttempts); - - // Make sure the second retry attempt (third time xrGetSystem is called) also returns a form factor error. - MockRuntime.SetFunctionCallback("xrGetSystem", (name) => XrResult.FormFactorUnavailable); - LogAssert.Expect(LogType.Error, "Failure to restart OpenXRLoader after shutdown."); - yield return new WaitForSeconds(timeToWait); - Debug.Log("Restart Attempts:" + OpenXRRestarter.PauseAndRestartAttempts.ToString()); - Assert.AreEqual(2, OpenXRRestarter.PauseAndRestartAttempts); - - // Don't return a form factor error on the third retry attempt. - // This restart attempt should have succeeded so the restart attempts should have been reset to 0. - yield return new WaitForSeconds(timeToWait); - Debug.Log("Restart Attempts:" + OpenXRRestarter.PauseAndRestartAttempts.ToString()); - Assert.AreEqual(0, OpenXRRestarter.PauseAndRestartAttempts); + yield return new WaitForLoaderRestart(10, true); + Assert.AreEqual(3, resetAttempts); } finally { + MockRuntime.KeepFunctionCallbacks = initialKeepFunctionCallbacks; + MockRuntime.SetFunctionCallback("xrGetSystem", initialXRGetSystemCallback); OpenXRRestarter.TimeBetweenRestartAttempts = initialTimeBetweenRestarts; } } @@ -867,14 +863,13 @@ public IEnumerator RestartLoopTest() public IEnumerator RestartLoopDisabledTest() { OpenXRRuntime.wantsToRestart += () => false; + OpenXRRuntime.wantsToQuit += () => true; float initialTimeBetweenRestarts = OpenXRRestarter.TimeBetweenRestartAttempts; + var initialXRGetSystemCallback = MockRuntime.GetBeforeFunctionCallback("xrGetSystem"); try { float timeBetweenRestarts = 1.0f; - // Wait 10% extra time to ensure that the restart was triggered. - float timeToWait = 1.5f * timeBetweenRestarts; - yield return null; // Should have 0 restart attempts before starting. @@ -889,15 +884,17 @@ public IEnumerator RestartLoopDisabledTest() base.InitializeAndStart(); // This retry attempt should not succeed since we manually set wantsToRestart = false. - yield return new WaitForSeconds(timeToWait); + yield return new WaitForLoaderShutdown(); Assert.IsTrue(OpenXRLoader.Instance == null, "OpenXR should not be initialized"); } finally { OpenXRRestarter.TimeBetweenRestartAttempts = initialTimeBetweenRestarts; + OpenXRRuntime.wantsToRestart -= () => false; + OpenXRRuntime.wantsToQuit -= () => true; + MockRuntime.SetFunctionCallback("xrGetSystem", initialXRGetSystemCallback); } } -#endif [UnityTest] public IEnumerator WantsToRestartTrue () @@ -1010,19 +1007,15 @@ public IEnumerator CreateSwapChainRuntimeError() Assert.IsTrue(OpenXRLoader.Instance == null, "OpenXR should not be initialized"); } -#if false - //Disable instable tests that rely on time [UnityTest] public IEnumerator CreateSwapChainSessionLostError() { float initialTimeBetweenRestarts = OpenXRRestarter.TimeBetweenRestartAttempts; + var initialXRCreateSwapchainCallback = MockRuntime.GetBeforeFunctionCallback("xrCreateSwapchain"); try { float timeBetweenRestarts = 1.0f; - // Wait 50% extra time to ensure that the restart was triggered. - float timeToWait = 1.5f * timeBetweenRestarts; - // Reduce the time between restarts to reduce the time of this test. OpenXRRestarter.TimeBetweenRestartAttempts = timeBetweenRestarts; @@ -1030,16 +1023,16 @@ public IEnumerator CreateSwapChainSessionLostError() LogAssert.Expect(LogType.Log, "OpenXRLoader restart successful."); InitializeAndStart(); - yield return new WaitForSeconds(timeToWait); + yield return new WaitForLoaderRestart(10, true); Assert.IsTrue(OpenXRLoader.Instance != null, "OpenXR should be initialized"); } finally { OpenXRRestarter.TimeBetweenRestartAttempts = initialTimeBetweenRestarts; + MockRuntime.SetFunctionCallback("xrCreateSwapchain", initialXRCreateSwapchainCallback); } } -#endif [UnityTest] public IEnumerator CreateSessionRuntimeFailure () diff --git a/Tests/Runtime/WaitForLoaderRestart.cs b/Tests/Runtime/WaitForLoaderRestart.cs index 5ea4a75..38c72a7 100644 --- a/Tests/Runtime/WaitForLoaderRestart.cs +++ b/Tests/Runtime/WaitForLoaderRestart.cs @@ -13,19 +13,33 @@ internal sealed class WaitForLoaderRestart : CustomYieldInstruction private float m_Timeout = 0; private Action m_OldAfterRestart; private Action m_OldAfterCoroutine; - private bool m_Restarted; + private Action m_OldAfterSuccessfulRestart; private bool m_Done; - public WaitForLoaderRestart(float timeout = 5.0f) + public WaitForLoaderRestart(float timeout = 5.0f, bool mustBeSuccessfulRestart = false) { m_Timeout = Time.realtimeSinceStartup + timeout; var restarter = OpenXRRestarter.Instance; m_OldAfterRestart = restarter.onAfterRestart; m_OldAfterCoroutine = restarter.onAfterCoroutine; + m_OldAfterSuccessfulRestart = restarter.onAfterSuccessfulRestart; - restarter.onAfterRestart = () => m_Restarted = true; - restarter.onAfterCoroutine = () => m_Done = true; + if (mustBeSuccessfulRestart) + { + // Wait for a successful restart, then wait for that particular coroutine to finish. + restarter.onAfterSuccessfulRestart = () => + { + restarter.onAfterCoroutine = () => m_Done = true; + }; + } + else + { + restarter.onAfterRestart = () => + { + restarter.onAfterCoroutine = () => m_Done = true; + }; + } } private void RestoreCallbacks () @@ -33,6 +47,7 @@ private void RestoreCallbacks () var restarter = OpenXRRestarter.Instance; restarter.onAfterRestart = m_OldAfterRestart; restarter.onAfterCoroutine = m_OldAfterCoroutine; + restarter.onAfterSuccessfulRestart = m_OldAfterSuccessfulRestart; } public override bool keepWaiting @@ -43,12 +58,6 @@ public override bool keepWaiting if (m_Done) { RestoreCallbacks(); - - if (!m_Restarted) - { - Assert.Fail("WaitForLoaderRestart: Coroutine finished without restarting"); - } - return false; } diff --git a/Tests/Runtime/WaitForLoaderShutdown.cs b/Tests/Runtime/WaitForLoaderShutdown.cs index 11b2579..0f3d284 100644 --- a/Tests/Runtime/WaitForLoaderShutdown.cs +++ b/Tests/Runtime/WaitForLoaderShutdown.cs @@ -28,9 +28,12 @@ public WaitForLoaderShutdown(float timeout = 5.0f) m_OldAfterRestart = restarter.onAfterRestart; m_OldAfterCoroutine = restarter.onAfterCoroutine; - restarter.onAfterShutdown = () => m_Shutdown = true; - restarter.onAfterRestart = () => m_Restarted = true; - restarter.onAfterCoroutine = () => m_Done = true; + restarter.onAfterShutdown = () => + { + m_Shutdown = true; + restarter.onAfterRestart = () => m_Restarted = true; + restarter.onAfterCoroutine = () => m_Done = true; + }; } private void RestoreCallbacks () diff --git a/package.json b/package.json index 3f4f24f..90a16b2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "com.unity.xr.openxr", "displayName": "OpenXR Plugin", - "version": "1.5.1", + "version": "1.5.3", "unity": "2020.3", "unityRelease": "0b14", "description": "OpenXR is an open, royalty-free standard developed by Khronos that aims to simplify AR/VR development by allowing developers to target a wide range of AR/VR devices. Use this plug-in to enable OpenXR in XR Plug-in Management.", @@ -14,7 +14,7 @@ "dependencies": { "com.unity.xr.management": "4.0.1", "com.unity.xr.legacyinputhelpers": "2.1.2", - "com.unity.inputsystem": "1.4.1" + "com.unity.inputsystem": "1.4.2" }, "samples": [ { @@ -34,11 +34,11 @@ } ], "upmCi": { - "footprint": "a63d752051b9b39db9ff026ac9f2e298dd45f37d" + "footprint": "acf062eef3bb75da1de36c2c8508fa7afb431f9d" }, "repository": { "url": "https://github.cds.internal.unity3d.com/unity/xr.sdk.openxr.git", "type": "git", - "revision": "4a5c45fe4e8656318b571f257f3dc1632aff19aa" + "revision": "f465b6468dde9034f804c326cd531c81dcb8e2c3" } }