Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [1.1.1] - 2021-04-06
* Oculus controller profile now exposes both grip and aim poses.
* Fixed issue where OpenXR layouts were not visible in the InputSystem bindings dialog.
* `OpenXRSettings.renderMode` and `OpenXrSettings.depthSubmissionMode` can now be changed via script outside of play mode.
* Fix for managed stripping levels of Medium and High
* Fixed bugs in `XR_KHR_VULKAN_ENABLE2` extension support
* Added support for `XR_VARJO_QUAD_VIEWS` extension
* Added `XR_COMPOSITION_LAYER_UNPREMULTIPLIED_ALPHA_BIT` and `XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT` bits to the composition layer flags
* Added `XrSecondaryViewConfigurationSwapchainCreateInfoMSFT` to to `XrSwapchainCreateInfo` when using a secondary view
* MockRuntime First Person Observer View support
* MockRuntime input support
* MockRuntime vulkan_enable2 support
* MockRuntime d3d11_enable support
  • Loading branch information
Unity Technologies committed Apr 6, 2021
1 parent 1e1aa05 commit 0b3648a
Show file tree
Hide file tree
Showing 145 changed files with 4,468 additions and 967 deletions.
16 changes: 13 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +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.0.3] - 2021-03-12
* Removed preview tag from documentation and UI
## [1.1.1] - 2021-04-06
* Oculus controller profile now exposes both grip and aim poses.
* Fixed issue where OpenXR layouts were not visible in the InputSystem bindings dialog.
* `OpenXRSettings.renderMode` and `OpenXrSettings.depthSubmissionMode` can now be changed via script outside of play mode.
* Fix for managed stripping levels of Medium and High
* Fixed bugs in `XR_KHR_VULKAN_ENABLE2` extension support
* Added support for `XR_VARJO_QUAD_VIEWS` extension
* Added `XR_COMPOSITION_LAYER_UNPREMULTIPLIED_ALPHA_BIT` and `XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT` bits to the composition layer flags
* Added `XrSecondaryViewConfigurationSwapchainCreateInfoMSFT` to to `XrSwapchainCreateInfo` when using a secondary view
* MockRuntime First Person Observer View support
* MockRuntime input support
* MockRuntime vulkan_enable2 support
* MockRuntime d3d11_enable support

## [1.0.2] - 2021-02-04
* Resolve further release verification issues.
Expand Down Expand Up @@ -41,4 +52,3 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [0.1.1-preview.1] - 2020-12-16

### This is the first release of *OpenXR Plugin \<com.unity.xr.openxr\>*.

12 changes: 6 additions & 6 deletions ConformanceAutomation/HelperTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ public XrVector3f(float x, float y, float z)
{
this.x = x;
this.y = y;
this.z = z;
this.z = -z;
}

public XrVector3f(Vector3 value)
{
x = value.x;
y = value.y;
z = value.z;
z = -value.z;
}
};

Expand All @@ -53,16 +53,16 @@ struct XrQuaternionf

public XrQuaternionf(float x, float y, float z, float w)
{
this.x = x;
this.y = y;
this.x = -x;
this.y = -y;
this.z = z;
this.w = w;
}

public XrQuaternionf(Quaternion quaternion)
{
this.x = quaternion.x;
this.y = quaternion.y;
this.x = -quaternion.x;
this.y = -quaternion.y;
this.z = quaternion.z;
this.w = quaternion.w;
}
Expand Down
15 changes: 15 additions & 0 deletions ConformanceAutomation/Native~/conformance_automation_ext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,18 @@ static IUnityXRTrace* s_Trace = nullptr;
extern "C" bool UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API
script_xrSetInputDeviceActiveEXT(XrSession session, XrPath interactionProfile, XrPath topLevelPath, XrBool32 isActive)
{
if (nullptr == unity_xrSetInputDeviceActiveEXT)
return false;

return XR_SUCCESS == unity_xrSetInputDeviceActiveEXT(session, interactionProfile, topLevelPath, isActive);
}

extern "C" bool UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API
script_xrSetInputDeviceStateBoolEXT(XrSession session, XrPath topLevelPath, XrPath inputSourcePath, XrBool32 state)
{
if (nullptr == unity_xrSetInputDeviceStateBoolEXT)
return false;

XrResult result = unity_xrSetInputDeviceStateBoolEXT(session, topLevelPath, inputSourcePath, state);
std::string traceString = "[ConformanceAutomationExt] - script_xrSetInputDeviceStateBoolEXT XrResult is ";

Expand All @@ -51,18 +57,27 @@ script_xrSetInputDeviceStateBoolEXT(XrSession session, XrPath topLevelPath, XrPa
extern "C" bool UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API
script_xrSetInputDeviceStateFloatEXT(XrSession session, XrPath topLevelPath, XrPath inputSourcePath, float state)
{
if (nullptr == unity_xrSetInputDeviceStateFloatEXT)
return false;

return XR_SUCCESS == unity_xrSetInputDeviceStateFloatEXT(session, topLevelPath, inputSourcePath, state);
}

extern "C" bool UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API
script_xrSetInputDeviceStateVector2fEXT(XrSession session, XrPath topLevelPath, XrPath inputSourcePath, XrVector2f state)
{
if (nullptr == unity_xrSetInputDeviceStateVector2fEXT)
return false;

return XR_SUCCESS == unity_xrSetInputDeviceStateVector2fEXT(session, topLevelPath, inputSourcePath, state);
}

extern "C" bool UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API
script_xrSetInputDeviceLocationEXT(XrSession session, XrPath topLevelPath, XrPath inputSourcePath, XrSpace space, XrPosef pose)
{
if (nullptr == unity_xrSetInputDeviceLocationEXT)
return false;

return XR_SUCCESS == unity_xrSetInputDeviceLocationEXT(session, topLevelPath, inputSourcePath, space, pose);
}

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.

8 changes: 8 additions & 0 deletions 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.

10 changes: 7 additions & 3 deletions Documentation~/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ A feature must also provide an `OpenXRFeature` attribute when running in the Edi

```c#
#if UNITY_EDITOR
[Unity.XR.OpenXR.Editor.OpenXRFeature(UiName = "Example Intercept Create Session",
[UnityEditor.XR.OpenXR.Features.OpenXRFeature(UiName = "Example Intercept Create Session",
BuildTargetGroups = new []{BuildTargetGroup.Standalone, BuildTargetGroup.WSA},
Company = "Unity",
Desc = "Example feature extension showing how to intercept a single OpenXR function.",
Expand Down Expand Up @@ -191,11 +191,15 @@ Any native libraries included in the same directory or a subdirectory of your fe

### Intercepting OpenXR function calls

To intercept OpenXR function calls, override `OpenXRFeature.xrGetInstanceProcAddr`. Returning a different function pointer allows intercepting any OpenXR method. For an example, see `InterceptCreateSessionExt`.
To intercept OpenXR function calls, override `OpenXRFeature.HookGetInstanceProcAddr`. Returning a different function pointer allows intercepting any OpenXR method. For an example, see the `Intercept Feature` sample.

### Calling OpenXR functions from a feature

To call an OpenXR function within a feature you first need to retreive a pointer to the function. To do this use the `OpenXRFeature.xrGetInstanceProcAddr` function pointer to request a pointer to the function you want to call. Using `OpenXRFeature.xrGetInstanceProcAddr` to retrieve the function pointer ensures that any intercepted calls set up by features using `OpenXRFeature.HookGetInstanceProcAddr` will be included.

### Providing a Unity subsystem implementation

`OpenXRFeature` provides several XR Loader callbacks where you can manage the lifecycle of Unity subsystems. For an example meshing subsystem feature, see the `MeshingTeapotExt` example (and the package sample that corresponds with it).
`OpenXRFeature` provides several XR Loader callbacks where you can manage the lifecycle of Unity subsystems. For an example meshing subsystem feature, see the `Meshing Subsystem Feature` sample.

Note that a `UnitySubsystemsManifest.json` file is required in order for Unity to discover any subsystems you define. At the moment, there are several restrictions around this file:

Expand Down
24 changes: 24 additions & 0 deletions MockDriver/MockDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ internal class MockDriver : OpenXRFeature
/// </summary>
public const string featureId = "com.unity.openxr.feature.mockdriver";

public delegate void EndFrameDelegate ();

public static event EndFrameDelegate onEndFrame;

[AOT.MonoPInvokeCallback(typeof(EndFrameDelegate))]
private static void ReceiveEndFrame() => onEndFrame?.Invoke();

/// <inheritdoc />
protected override bool OnInstanceCreate(ulong instance)
{
Expand All @@ -39,6 +46,9 @@ protected override bool OnInstanceCreate(ulong instance)
}

InitializeNative(xrGetInstanceProcAddr, instance, 0ul, 0ul);

MockDriver_RegisterEndFrameCallback(ReceiveEndFrame);

return true;
}

Expand All @@ -48,6 +58,14 @@ protected override void OnInstanceDestroy(ulong xrInstance)
ShutdownNative(0);
}

internal enum XrViewConfigurationType
{
PrimaryMono = 1,
PrimaryStereo = 2,
PrimaryQuadVarjo = 1000037000,
SecondaryMonoFirstPersonObserver = 1000054000
}

[Flags]
internal enum XrSpaceLocationFlags
{
Expand Down Expand Up @@ -223,5 +241,11 @@ internal enum XrReferenceSpaceType

[DllImport(extLib, EntryPoint = "MockDriver_GetEndFrameStats")]
internal static extern XrResult GetEndFrameStats(out int primaryLayerCount, out int secondaryLayerCount);

[DllImport(extLib, EntryPoint = "MockDriver_ActivateSecondaryView")]
internal static extern XrResult ActivateSecondaryView(XrViewConfigurationType viewConfigurationType, bool activate);

[DllImport(extLib, EntryPoint = "MockDriver_RegisterEndFrameCallback")]
private static extern XrResult MockDriver_RegisterEndFrameCallback (EndFrameDelegate callback);
}
}
10 changes: 10 additions & 0 deletions MockDriver/Native~/mock_driver/Include/openxr_mock_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,14 @@ typedef XrResult(XRAPI_PTR* PFN_xrSetViewPoseUNITY)(int viewIndex, XrPosef pose,
//
typedef XrResult(XRAPI_PTR* PFN_xrGetEndFrameStatsUNITY)(int* primaryLayerCount, int* secondaryLayerCount);

// Activate a secondary view configuration
//
typedef XrResult(XRAPI_PTR* PFN_xrActivateSecondaryViewUNITY)(XrViewConfigurationType viewConfigurationType, bool activate);

// Register a callback that gets called after every end frame
//
typedef void (*PFN_EndFrameCallback)();

typedef XrResult(XRAPI_PTR* PFN_xrRegisterEndFrameCallback)(PFN_EndFrameCallback callback);

#endif //OPENXR_MOCK_DRIVER
Loading

0 comments on commit 0b3648a

Please sign in to comment.