Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [1.3.0] - 2021-10-20
### Added
* Added API `OpenXRInput.SendHapticImpulse`
* Added API `OpenXRInput.StopHaptics`
* Added API `OpenXRInput.TryGetInputSourceName`
* Added event `OpenXRRuntime.wantsToRestart`
* Added event `OpenXRRuntime.wantsToQuit`
* Added support for `XR_OCULUS_audio_device_guid
` extension.
* Added `Haptic` control to OpenXR Controller Profile layouts that can be bound to an action and used to trigger haptics using the new `OpenXRInput.SendHapticImpulse` API.

### Fixed
* Fixed ARM32 crash when OpenXR API layers were present
  * [ISSUE-1355859](https://issuetracker.unity3d.com/issues/xr-uwp-any-openxr-layer-will-crash-unityopenxr-dot-dll-on-hololens2-when-compiling-with-arm32)
* Fixed issue that would cause console errors if `OpenXRFeature.enable` was changed while  the OpenXR Projects Settings windows was open.
* Fixed potential Android crash when shutting down.
* Fixed potential crash with `XR_MSFT_SECONDARY_VIEW_CONFIGURATION_EXTENSION_NAME`
* Fixed issue with alpha channel on Projection layer causing visual artifacts.
  * [ISSUE-1338699](https://issuetracker.unity3d.com/issues/xr-openxr-a-black-background-is-rendered-in-hmd-when-using-solid-color-camera-clear-flags)
  * [ISSUE-1349271](https://issuetracker.unity3d.com/issues/xr-sdk-openxr-post-processing-postexposure-effect-has-visual-artifacts)
  * [ISSUE-1346455](https://issuetracker.unity3d.com/issues/xr-sdk-openxr-right-eye-contains-artifacts-when-taa-anti-aliasing-is-used-with-multi-pass-rendering-mode)
  * [ISSUE-1336968](https://issuetracker.unity3d.com/issues/xr-openxr-oculus-post-processing-view-in-hmd-is-darker-and-sometimes-flickers-when-changing-depth-of-field-focus-distance)
  * [ISSUE-1338696](https://issuetracker.unity3d.com/issues/xr-sdk-openxr-black-edges-are-rendered-on-the-game-objects-when-fxaa-anti-aliasing-is-used)
* Fixed bug that caused Vulkan support on Oculus to stop working.
* Fixed missing usages on `HoloLensHand` layout.
* Fixed vulkan shared depth buffer on versions `2021.2.0b15` and `2022.1.0a8` or higher.

### Updated
* Improved `OpenXRFeatureSetManager.SetFeaturesFromEnabledFeatureSets` so that no internal methods are required after calling this.
* Updated `Controller` sample to improve the visuals and use the new APIs
  • Loading branch information
Unity Technologies committed Oct 20, 2021
1 parent 0abaa89 commit 7ce9a18
Show file tree
Hide file tree
Showing 235 changed files with 15,168 additions and 16,938 deletions.
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,37 @@ 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.3.0] - 2021-10-20
### Added
* Added API `OpenXRInput.SendHapticImpulse`
* Added API `OpenXRInput.StopHaptics`
* Added API `OpenXRInput.TryGetInputSourceName`
* Added event `OpenXRRuntime.wantsToRestart`
* Added event `OpenXRRuntime.wantsToQuit`
* Added support for `XR_OCULUS_audio_device_guid
` extension.
* Added `Haptic` control to OpenXR Controller Profile layouts that can be bound to an action and used to trigger haptics using the new `OpenXRInput.SendHapticImpulse` API.

### Fixed
* Fixed ARM32 crash when OpenXR API layers were present
* [ISSUE-1355859](https://issuetracker.unity3d.com/issues/xr-uwp-any-openxr-layer-will-crash-unityopenxr-dot-dll-on-hololens2-when-compiling-with-arm32)
* Fixed issue that would cause console errors if `OpenXRFeature.enable` was changed while the OpenXR Projects Settings windows was open.
* Fixed potential Android crash when shutting down.
* Fixed potential crash with `XR_MSFT_SECONDARY_VIEW_CONFIGURATION_EXTENSION_NAME`
* Fixed issue with alpha channel on Projection layer causing visual artifacts.
* [ISSUE-1338699](https://issuetracker.unity3d.com/issues/xr-openxr-a-black-background-is-rendered-in-hmd-when-using-solid-color-camera-clear-flags)
* [ISSUE-1349271](https://issuetracker.unity3d.com/issues/xr-sdk-openxr-post-processing-postexposure-effect-has-visual-artifacts)
* [ISSUE-1346455](https://issuetracker.unity3d.com/issues/xr-sdk-openxr-right-eye-contains-artifacts-when-taa-anti-aliasing-is-used-with-multi-pass-rendering-mode)
* [ISSUE-1336968](https://issuetracker.unity3d.com/issues/xr-openxr-oculus-post-processing-view-in-hmd-is-darker-and-sometimes-flickers-when-changing-depth-of-field-focus-distance)
* [ISSUE-1338696](https://issuetracker.unity3d.com/issues/xr-sdk-openxr-black-edges-are-rendered-on-the-game-objects-when-fxaa-anti-aliasing-is-used)
* Fixed bug that caused Vulkan support on Oculus to stop working.
* Fixed missing usages on `HoloLensHand` layout.
* Fixed vulkan shared depth buffer on versions `2021.2.0b15` and `2022.1.0a8` or higher.

### Updated
* Improved `OpenXRFeatureSetManager.SetFeaturesFromEnabledFeatureSets` so that no internal methods are required after calling this.
* Updated `Controller` sample to improve the visuals and use the new APIs

## [1.2.8] - 2021-07-29
* Fixed an issue that was causing Oculus Android OpenGL builds to stop working after v31 of the oculus software was installed.
* Fixed a bug that would cause Asset Bundles to fail building in some circumstances when OpenXR was included in the project.
Expand Down
36 changes: 31 additions & 5 deletions ConformanceAutomation/ConformanceAutomationFeature.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.Runtime.InteropServices;
using UnityEngine.XR.OpenXR.Input;
using UnityEngine.XR.OpenXR.NativeTypes;
#if UNITY_EDITOR
using UnityEditor.XR.OpenXR.Features;
#endif
Expand Down Expand Up @@ -33,7 +33,7 @@ public class ConformanceAutomationFeature : OpenXRFeature
private static ulong xrSession = 0ul;

/// <inheritdoc/>
protected override bool OnInstanceCreate(ulong instance)
protected internal override bool OnInstanceCreate(ulong instance)
{
if (!OpenXRRuntime.IsExtensionEnabled("XR_EXT_conformance_automation"))
{
Expand All @@ -49,21 +49,21 @@ protected override bool OnInstanceCreate(ulong instance)
}

/// <inheritdoc/>
protected override void OnInstanceDestroy(ulong xrInstance)
protected internal override void OnInstanceDestroy(ulong xrInstance)
{
base.OnInstanceDestroy(xrInstance);
ConformanceAutomationFeature.xrInstance = 0ul;
}

/// <inheritdoc/>
protected override void OnSessionCreate(ulong xrSessionId)
protected internal override void OnSessionCreate(ulong xrSessionId)
{
ConformanceAutomationFeature.xrSession = xrSessionId;
base.OnSessionCreate(xrSession);
}

/// <inheritdoc/>
protected override void OnSessionDestroy(ulong xrSessionId)
protected internal override void OnSessionDestroy(ulong xrSessionId)
{
base.OnSessionDestroy(xrSessionId);
ConformanceAutomationFeature.xrSession = 0ul;
Expand Down Expand Up @@ -156,6 +156,29 @@ public static bool ConformanceAutomationSetPose(string topLevelPath, string inpu
new XrPosef(position, orientation));
}

/// <summary>
/// Set the angular and linear velocity of a pose
/// </summary>
/// <param name="topLevelPath">An OpenXRPath that specifies the OpenXR User Path of the value to be changed (e.g. /user/hand/left).</param>
/// <param name="inputSourcePath">An OpenXRPath that specifies the full path of the input component whose state you wish to set (e.g. /user/hand/left/input/select/click).</param>
/// <param name="linearValid">True if the linear velocity is valid</param>
/// <param name="linear">Linear velocity value</param>
/// <param name="angularValid">True if the angular velocity is valid</param>
/// <param name="angular">Angular velocity value</param>
/// <returns></returns>
public static bool ConformanceAutomationSetVelocity(string topLevelPath, string inputSourcePath, bool linearValid, Vector3 linear, bool angularValid, Vector3 angular)
{
return xrSetInputDeviceVelocityUNITY(
xrSession,
StringToPath(topLevelPath),
StringToPath(inputSourcePath),
linearValid,
new XrVector3f(-1.0f * linear), // Linear velocity is multiplied by -1 in the OpenXR plugin so it must be negated here as well
angularValid,
new XrVector3f(-1.0f * angular) // Angular velocity is multiplied by -1 in the OpenXR plugin so it must be negated here as well
);
}

// Dll imports

private const string ExtLib = "ConformanceAutomationExt";
Expand All @@ -182,5 +205,8 @@ public static bool ConformanceAutomationSetPose(string topLevelPath, string inpu

[DllImport(ExtLib, EntryPoint = "script_xrSetInputDeviceLocationEXT")]
private static extern bool xrSetInputDeviceLocationEXT(ulong xrSession, ulong topLevelPath, ulong inputSourcePath, ulong space, XrPosef pose);

[DllImport(ExtLib, EntryPoint = "script_xrSetInputDeviceVelocityUNITY")]
private static extern bool xrSetInputDeviceVelocityUNITY(ulong xrSession, ulong topLevelPath, ulong inputSourcePath, bool linearValid, XrVector3f linear, bool angularValid, XrVector3f angular);
}
}
82 changes: 0 additions & 82 deletions ConformanceAutomation/HelperTypes.cs

This file was deleted.

13 changes: 13 additions & 0 deletions ConformanceAutomation/Native~/conformance_automation_ext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@
assert(ret == XR_SUCCESS); \
}

typedef XrResult(XRAPI_PTR* PFN_xrSetInputDeviceVelocityUNITY)(XrSession session, XrPath topLevelPath, XrPath inputSourcePath, bool linearValid, XrVector3f linear, bool angularValid, XrVector3f angular);

// OpenXR runtime functions
PFN_xrSetInputDeviceActiveEXT unity_xrSetInputDeviceActiveEXT = nullptr;
PFN_xrSetInputDeviceStateBoolEXT unity_xrSetInputDeviceStateBoolEXT = nullptr;
PFN_xrSetInputDeviceStateFloatEXT unity_xrSetInputDeviceStateFloatEXT = nullptr;
PFN_xrSetInputDeviceStateVector2fEXT unity_xrSetInputDeviceStateVector2fEXT = nullptr;
PFN_xrSetInputDeviceLocationEXT unity_xrSetInputDeviceLocationEXT = nullptr;
PFN_xrSetInputDeviceVelocityUNITY unity_xrSetInputDeviceVelocityUNITY = nullptr;

// Trace for Debug
static IUnityXRTrace* s_Trace = nullptr;
Expand Down Expand Up @@ -81,6 +84,15 @@ script_xrSetInputDeviceLocationEXT(XrSession session, XrPath topLevelPath, XrPat
return XR_SUCCESS == unity_xrSetInputDeviceLocationEXT(session, topLevelPath, inputSourcePath, space, pose);
}

extern "C" bool UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API
script_xrSetInputDeviceVelocityUNITY(XrSession session, XrPath topLevelPath, XrPath inputSourcePath, bool linearValid, XrVector3f linear, bool angularValid, XrVector3f angular)
{
if (nullptr == unity_xrSetInputDeviceVelocityUNITY)
return false;

return XR_SUCCESS == unity_xrSetInputDeviceVelocityUNITY(session, topLevelPath, inputSourcePath, linearValid, linear, angularValid, angular);
}

// Init

extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API
Expand All @@ -93,6 +105,7 @@ script_initialize(PFN_xrGetInstanceProcAddr xrGetInstanceProcAddr, XrInstance in
CHECK_XRCMD(xrGetInstanceProcAddr(instance, "xrSetInputDeviceStateFloatEXT", (PFN_xrVoidFunction*)&unity_xrSetInputDeviceStateFloatEXT));
CHECK_XRCMD(xrGetInstanceProcAddr(instance, "xrSetInputDeviceStateVector2fEXT", (PFN_xrVoidFunction*)&unity_xrSetInputDeviceStateVector2fEXT));
CHECK_XRCMD(xrGetInstanceProcAddr(instance, "xrSetInputDeviceLocationEXT", (PFN_xrVoidFunction*)&unity_xrSetInputDeviceLocationEXT));
CHECK_XRCMD(xrGetInstanceProcAddr(instance, "xrSetInputDeviceVelocityUNITY", (PFN_xrVoidFunction*)&unity_xrSetInputDeviceVelocityUNITY));

XR_TRACE_LOG(s_Trace, "[ConformanceAutomationExt] - script_initialize complete");
}
Expand Down
2 changes: 1 addition & 1 deletion ConformanceAutomation/android.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ConformanceAutomation/android/arm64.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified ConformanceAutomation/android/arm64/ConformanceAutomationExt.so
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ConformanceAutomation/universalwindows.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ConformanceAutomation/universalwindows/arm32.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ConformanceAutomation/universalwindows/arm64.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ConformanceAutomation/universalwindows/x64.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ConformanceAutomation/windows.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ConformanceAutomation/windows/x64.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified ConformanceAutomation/windows/x64/ConformanceAutomationExt.dll
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Documentation~/input.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ If you use OpenXR input with controllers or interactions such as eye gaze, Unity
|Eye Gaze Interaction|`<EyeGaze>`|[EyeGazeInteraction](./features/eyegazeinteraction.md)|
|Microsoft Hand Interaction|`<HololensHand>`|[MicrosoftHandInteraction](./features/microsofthandinteraction.md)|

## Haptics

OpenXR Controllers that support haptics contain a Haptic control that you can bind to an action in the [Unity Input System](https://docs.unity3d.com/Packages/com.unity.inputsystem@latest). Set the action type to Haptic when binding an InputAction to a haptic. To send a haptic impulse, call the [OpenXRInput.SendHapticImpulse](xref:UnityEngine.XR.OpenXR.Input.OpenXRInput.SendHapticImpulse*) method and specify the InputAction that you bound to the Haptic control. You can cancel the haptic impulse by calling the [OpenXRInput.StopHaptics](UnityEngine.XR.OpenXR.Input.OpenXRInput.StopHaptics*) method.

## Debugging

For more information on debugging OpenXR input, see the [Input System Debugging](https://docs.unity3d.com/Packages/[email protected]/manual/Debugging.html) documentation.
Expand Down
17 changes: 12 additions & 5 deletions Editor/FeatureSupport/OpenXRFeatureEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ internal class OpenXRFeatureEditor
/// Path of the OpenXR settings in the Settings window. Uses "/" as separator. The last token becomes the settings label if none is provided.
/// </summary>
public const string k_FeatureSettingsPathUI =
#if XR_MGMT_320
#if XR_MGMT_3_2_0_OR_NEWER
"Project/XR Plug-in Management/OpenXR/Features";
#else
"Project/XR Plugin Management/OpenXR/Features";
Expand Down Expand Up @@ -333,11 +333,8 @@ void DrawSelectionList()
var newToggleState = EditorGUILayout.ToggleLeft("", currentToggleState, GUILayout.ExpandWidth(false), GUILayout.Width(Styles.k_IconWidth), GUILayout.Height(lineHeight));
if (newToggleState != currentToggleState)
{
item.wasChanged = true;
item.isEnabled = newToggleState;
OpenXREditorSettings.Instance.SetFeatureSetSelected(activeBuildTarget, item.featureSetId, item.isEnabled);
OpenXRFeatureSetManager.SetFeaturesFromEnabledFeatureSets(activeBuildTarget);
mustInitializeFeatures = true;
}
}

Expand Down Expand Up @@ -474,11 +471,13 @@ public void OnGUI(BuildTargetGroup buildTargetGroup)

if (buildTargetGroup != activeBuildTarget || mustInitializeFeatures)
{
mustInitializeFeatures = false;
InitializeFeatures(buildTargetGroup);
OpenXRFeatureSetManager.activeBuildTarget = buildTargetGroup;
OpenXRFeatureSetManager.SetFeaturesFromEnabledFeatureSets(buildTargetGroup);

// This must be done after SetFeaturesFromEnabledFeatureSets to ensure we dont get an infinite update loop
mustInitializeFeatures = false;

if (EditorWindow.HasOpenInstances<OpenXRFeatureSettingsEditor>())
{
featureSetSettingsEditor = EditorWindow.GetWindow<OpenXRFeatureSettingsEditor>();
Expand Down Expand Up @@ -643,5 +642,13 @@ public static OpenXRFeatureEditor CreateFeatureEditor()
return new OpenXRFeatureEditor();
return null;
}

internal void OnFeatureSetStateChanged(BuildTargetGroup buildTargetGroup)
{
if (activeBuildTarget != buildTargetGroup)
return;

mustInitializeFeatures = true;
}
}
}
Loading

0 comments on commit 7ce9a18

Please sign in to comment.