Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [1.12.0-exp.1] - 2024-06-28

### Fixed
* Fixed Custom Composition Layer Feature not showing up in the OpenXR feature setting UI after importing into project.
* Fixed a crash with composition layers in scene due to race condition.

### Changed
* Implements the construction and maintenance of native composition layers in C# via our LayerProvider classes inheriting from OpenXRCustomLayerHandler.
  • Loading branch information
Unity Technologies committed Jun 28, 2024
1 parent fa5ced1 commit 22a004f
Show file tree
Hide file tree
Showing 188 changed files with 3,961 additions and 160 deletions.
20 changes: 14 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
> **Notes**
> When updating the Changelog, please ensure we follow the standards for ordering headers as outlined here: [US-0039](https://standards.ds.unity3d.com/Standards/US-0039/). Specifically: Under ## headers, ### \<type\> headers are listed in this order: Added, Changed, Deprecated, Removed, Fixed, Security
-->

## [1.12.0-exp.1] - 2024-06-28

### Fixed
* Fixed Custom Composition Layer Feature not showing up in the OpenXR feature setting UI after importing into project.
* Fixed a crash with composition layers in scene due to race condition.

### Changed
* Implements the construction and maintenance of native composition layers in C# via our LayerProvider classes inheriting from OpenXRCustomLayerHandler.

## [1.11.1-exp.1] - 2024-06-12

### Fixed
* Fixed Metal API initialization.
* Fixed Metal API initialization.

## [1.11.0] - 2024-05-01

Expand Down Expand Up @@ -42,12 +52,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
* Fixed crash that occurs while cleaning up destroyed swapchains in OpenXR.
* Fixed Depth Texture flag disparity between the OpenXR and Oculus providers.

### Added
* Added `OpenXRUtility.IsSessionFocused` to return if the current session is in the focused state.
* Added `OpenXRUtility.IsUserPresent` to return the change of user presence, such as when the user has taken off or put on an XR headset. If the system does not support user presence sensing, runtime assumes that the user is always present and IsUserPresent always returns True. If the system supports the sensing of user presence, returns true when detected the presence of a user and returns false when detected the absence of a user.
## [1.11.0-exp.1] - 2024-02-25

### Changed
* When retrieving input feature from [CommonUsages.userPresence](https://docs.unity3d.com/ScriptReference/XR.CommonUsages-userPresence.html), if XR_EXT_user_presence is supported by the current system, retrieved value will be the same as `OpenXRUtility.IsUserPresent`. If `XR_EXT_user_presence` is not supported, retrieved value will be based on `OpenXRUtility.IsSessionFocused`, which is the default return value before 1.11.0.
### Added
* Added XR Composition Layers support - Experimental. Install Composition Layer Experimental package - com.unity.xr.compositionlayers 0.5.0 to pair with.

## [1.10.0] - 2024-01-26

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.

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/x64.meta

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

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

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

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

Binary file modified ConformanceAutomation/osx/ConformanceAutomationExt.dylib
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.

3 changes: 3 additions & 0 deletions Documentation~/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"DefineConstants": "XR_COMPOSITION_LAYERS"
}
2 changes: 1 addition & 1 deletion Documentation~/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ OpenXR is an open, royalty-free standard developed by Khronos that aims to simpl

This version of OpenXR is compatible with the following versions of the Unity Editor:

* 2020 LTS+
* 2021 LTS+

## Runtimes

Expand Down
7 changes: 7 additions & 0 deletions Documentation~/projectMetadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"hideGlobalNamespace": false,
"_noIndex": false,
"useMemberPages": false,
"showScriptRef": true,
"pmdt-additional-preprocessors": "XR_COMPOSITION_LAYERS"
}
27 changes: 27 additions & 0 deletions MockRuntime/MockRuntime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -589,5 +589,32 @@ static void UseGenericLoaderAndroid()
}

#endif

#if UNITY_ANDROID
[DllImport(extLib, EntryPoint = "MockRuntime_IsAndroidThreadTypeRegistered")]
[return: MarshalAs(UnmanagedType.U1)]
private static extern bool Internal_IsAndroidThreadTypeRegistered(uint threadType);

[DllImport(extLib, EntryPoint = "MockRuntime_GetRegisteredAndroidThreadsCount")]
private static extern ulong Internal_GetRegisteredAndroidThreadsCount();
#endif

internal static bool IsAndroidThreadTypeRegistered(uint threadType)
{
#if UNITY_ANDROID
return Internal_IsAndroidThreadTypeRegistered(threadType);
#else
return false;
#endif
}

internal static ulong GetRegisteredAndroidThreadsCount()
{
#if UNITY_ANDROID
return Internal_GetRegisteredAndroidThreadsCount();
#else
return 0;
#endif
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#include "mock_khr_android_thread_settings.h"

#ifdef XR_USE_PLATFORM_ANDROID

#define CHECK_EXT_INIT() \
if (nullptr == MockAndroidThreadSettings::Instance()) \
return XR_ERROR_FUNCTION_UNSUPPORTED;

std::unique_ptr<MockAndroidThreadSettings> MockAndroidThreadSettings::s_Instance;

MockAndroidThreadSettings* MockAndroidThreadSettings::Instance()
{
return s_Instance.get();
}

void MockAndroidThreadSettings::Init(MockRuntime& runtime)
{
s_Instance.reset(new MockAndroidThreadSettings(runtime));
}

void MockAndroidThreadSettings::Deinit()
{
s_Instance.reset();
}

MockAndroidThreadSettings::MockAndroidThreadSettings(MockRuntime& runtime)
: m_Runtime{runtime}
{
}

XrResult MockAndroidThreadSettings::SetAndroidApplicationThread(XrAndroidThreadTypeKHR threadType, uint32_t threadId)
{
m_AssignedThreadTypes[threadId] = threadType;
return XR_SUCCESS;
}

bool MockAndroidThreadSettings::IsAndroidThreadTypeRegistered(XrAndroidThreadTypeKHR threadType) const
{
for (auto i = m_AssignedThreadTypes.cbegin(); i != m_AssignedThreadTypes.cend(); ++i)
{
if (i->second == threadType)
{
return true;
}
}
return false;
}

uint32_t MockAndroidThreadSettings::GetRegisteredAndroidThreadsCount() const
{
return m_AssignedThreadTypes.size();
}

extern "C" XrResult UNITY_INTERFACE_EXPORT XRAPI_PTR
xrSetAndroidApplicationThreadKHR(
XrSession session,
XrAndroidThreadTypeKHR threadType,
uint32_t threadId)
{
LOG_FUNC();
CHECK_SESSION(session);
CHECK_EXT_INIT();
MOCK_HOOK_BEFORE();

const XrResult result =
MockAndroidThreadSettings::Instance()->SetAndroidApplicationThread(
threadType,
threadId);

MOCK_HOOK_AFTER(result);

return result;
}

XrResult MockAndroidThreadSettings_GetInstanceProcAddr(const char* name, PFN_xrVoidFunction* function)
{
GET_PROC_ADDRESS(xrSetAndroidApplicationThreadKHR)
return XR_ERROR_FEATURE_UNSUPPORTED;
}

#undef CHECK_EXT_INIT
#endif // XR_USE_PLATFORM_ANDROID
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#pragma once

#include "../mock.h"
#include <map>
#include <memory>

#ifdef XR_USE_PLATFORM_ANDROID
class MockAndroidThreadSettings
{
public:
static MockAndroidThreadSettings* Instance();
static void Init(MockRuntime& runtime);
static void Deinit();

MockAndroidThreadSettings(MockRuntime& runtime);

XrResult SetAndroidApplicationThread(XrAndroidThreadTypeKHR threadType, uint32_t threadId);
bool IsAndroidThreadTypeRegistered(XrAndroidThreadTypeKHR threadType) const;
uint32_t GetRegisteredAndroidThreadsCount() const;

private:
static std::unique_ptr<MockAndroidThreadSettings> s_Instance;

MockRuntime& m_Runtime;
std::map<uint32_t, XrAndroidThreadTypeKHR> m_AssignedThreadTypes{};
};

XrResult MockAndroidThreadSettings_GetInstanceProcAddr(const char* name, PFN_xrVoidFunction* function);
#endif
28 changes: 28 additions & 0 deletions MockRuntime/Native~/mock_runtime/mock_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,30 @@ MOCK_API_TRAMPOLINE(XrPerfSettingsLevelEXT, XR_PERF_SETTINGS_LEVEL_SUSTAINED_HIG
}
#endif

#ifdef XR_USE_PLATFORM_ANDROID
MOCK_API_TRAMPOLINE(bool, false, MockRuntime_IsAndroidThreadTypeRegistered,
(uint32_t threadTypeValue),
(threadTypeValue))
#if !TRAMPOLINE
{
LOG_FUNC();
auto threadType = static_cast<XrAndroidThreadTypeKHR>(threadTypeValue);
return MockAndroidThreadSettings::Instance()->IsAndroidThreadTypeRegistered(threadType);
}
#endif // !TRAMPOLINE

MOCK_API_TRAMPOLINE(uint32_t, 0, MockRuntime_GetRegisteredAndroidThreadsCount,
(),
())
#if !TRAMPOLINE
{
LOG_FUNC();
MOCK_TRACE_DEBUG("Session is valid");
return MockAndroidThreadSettings::Instance()->GetRegisteredAndroidThreadsCount();
}
#endif // !TRAMPOLINE
#endif // XR_USE_PLATFORM_ANDROID

#if !TRAMPOLINE
XrResult GetProcAddrMockAPI(XrInstance instance, const char* name, PFN_xrVoidFunction* function)
{
Expand All @@ -357,6 +381,10 @@ XrResult GetProcAddrMockAPI(XrInstance instance, const char* name, PFN_xrVoidFun
GET_PROC_ADDRESS(MockRuntime_MetaPerformanceMetrics_SeedCounterOnce_Float)
GET_PROC_ADDRESS(MockRuntime_PerformanceSettings_CauseNotification)
GET_PROC_ADDRESS(MockRuntime_PerformanceSettings_GetPerformanceLevelHint)
#ifdef XR_USE_PLATFORM_ANDROID
GET_PROC_ADDRESS(MockRuntime_IsAndroidThreadTypeRegistered)
GET_PROC_ADDRESS(MockRuntime_GetRegisteredAndroidThreadsCount)
#endif // XR_USE_PLATFORM_ANDROID

return XR_ERROR_FUNCTION_UNSUPPORTED;
}
Expand Down
1 change: 1 addition & 0 deletions MockRuntime/Native~/mock_runtime/mock_extensions.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include "Extensions/mock_khr_android_thread_settings.h"
#include "Extensions/mock_meta_performance_metrics.h"
#include "Extensions/mock_performance_settings.h"

Expand Down
Loading

0 comments on commit 22a004f

Please sign in to comment.