Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [4.1.1] - 2023-09-05
### Added
- Added Quest 3 target device checkbox
- Updated the `SystemHeadset` enum to include `Meta_Quest_3` and `Meta_Link_Quest_3` entries

### Changed
- Added project validation rule and soft dependency to xr.core.utils package
- Bumped up required XR Management version to 4.4.0 to fix issues with Android Manifest cleanup
- Updated Oculus plugins to v56
- Updated documentation to inform users that Phase Sync is always active when using the Oculus OpenXR Runtime
- Bumped minimum Unity version from 2022.2 to 2022.3

### Fixed
- Removed Android manifest cleanup that removed the manifest file, existing projects need to do a clean build to completely remove the issue
- Fixed Android app issues that arise when setting the entry point to GameActivity

### Known Issues
- `Unity.XR.Oculus.Stats.PerfMetrics` entries currently return `0` when using the OpenXR runtime
- `Unity.XR.Oculus.Stats.AppMetrics` entries return `0` on all Oculus runtimes
- For both of the above, the suggested replacement is to use the profiling tools available via the Oculus Developer Hub: https://developer.oculus.com/documentation/unity/ts-odh-logs-metrics/
  • Loading branch information
Unity Technologies committed Sep 5, 2023
1 parent 7ce6390 commit 8fcd3b2
Show file tree
Hide file tree
Showing 18 changed files with 187 additions and 62 deletions.
30 changes: 24 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,41 @@ 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).

## [4.0.0] - 2023-04-24
## [4.1.1] - 2023-09-05
### Added
- Added Quest 3 target device checkbox
- Updated the `SystemHeadset` enum to include `Meta_Quest_3` and `Meta_Link_Quest_3` entries

### Changed
- Updated Oculus plugins to v51. V51 plugins no longer provide support for Quest 1 devices or 32-bit Windows builds
- Moved Late Latching settings out of the Experimental section
- Added project validation rule and soft dependency to xr.core.utils package
- Bumped up required XR Management version to 4.4.0 to fix issues with Android Manifest cleanup
- Updated Oculus plugins to v56
- Updated documentation to inform users that Phase Sync is always active when using the Oculus OpenXR Runtime
- Bumped minimum Unity version from 2022.2 to 2022.3

### Removed
- Removed Quest 1 as a target device in the Oculus XR Plugin settings and manifest entries
### Fixed
- Removed Android manifest cleanup that removed the manifest file, existing projects need to do a clean build to completely remove the issue
- Fixed Android app issues that arise when setting the entry point to GameActivity

### Known Issues
- `Unity.XR.Oculus.Stats.PerfMetrics` entries currently return `0` when using the OpenXR runtime
- `Unity.XR.Oculus.Stats.AppMetrics` entries return `0` on all Oculus runtimes
- For both of the above, the suggested replacement is to use the profiling tools available via the Oculus Developer Hub: https://developer.oculus.com/documentation/unity/ts-odh-logs-metrics/

## [4.0.0] - 2023-04-24
### Changed
- Updated Oculus plugins to v51. V51 plugins no longer provide support for Quest 1 devices or 32-bit Windows builds
- Moved Late Latching settings out of the Experimental section

### Removed
- Removed Quest 1 as a target device in the Oculus XR Plugin settings and manifest entries

## [3.3.0] - 2023-03-13
### Added
- Updated the `SystemHeadset` enum to include `Meta_Quest_Pro` and `Meta_Link_Quest_Pro` entries

### Changed
- Modified how foveated rendering (ETFR and FFR) is enabled and configured from script to make it more consistent
- Updated the `SystemHeadset` enum to include `Meta_Quest_Pro` and `Meta_Link_Quest_Pro` entries

### Fixed
- Reverted deferred eye texture deletion as we only needed to defer layer deletion
Expand Down
6 changes: 3 additions & 3 deletions Documentation~/com.unity.xr.oculus.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# About the Oculus XR Plugin

The Oculus XR Plugin enables you to build applications for a variety of Oculus devices including the Rift, Rift S, Quest 2, and Quest Pro.
The Oculus XR Plugin enables you to build applications for a variety of Oculus devices including the Rift, Rift S, Quest 2, Quest Pro, and Quest 3.

## Supported XR plugin subsystems

Expand Down Expand Up @@ -42,7 +42,7 @@ The Oculus XR Plugin integration with XR Management provides the following funct
* *Multiview* - Multiview is essentially the same as the *Single Pass Instanced* option described above, except the graphics driver does the draw call conversion, requiring less work from the Unity engine. As with *Single Pass Instanced*, shaders need to be authored to enable Multiview. Using Unity's XR shader macros will simplify custom shader development.
* **Low Overhead Mode** - If enabled, the GLES graphics driver will bypass validation code, potentially running faster. Disable this if you experience graphics instabilities. GLES only.
* **Optimize Buffer Discards** - If enabled, the depth buffer contents will be discarded rather than resolved and the MSAA color buffer will be resolved rather than stored after rendering. This is a performance optimization that can possibly break rendering effects that sample from the depth buffer, such as camera stacking. Vulkan only.
* **Phase Sync** - This enables a latency optimization technique which can reduce simulation latency by several ms, depending on application workload. This is currently disabled by default, but we encourage trying it with your projects.
* **Phase Sync** - This enables a latency optimization technique which can reduce simulation latency by several ms, depending on application workload. Note: this is always enabled when using the Oculus OpenXR Runtime.
* **Symmetric Projection** - If enabled, this allows the application to render with symmetric projection matrices. This can improve GPU performance when using multiview due to more common workloads between the left and right eye. Supported when using Vulkan and Multiview.
* **Subsampled Layout** - If enabled, the eye textures will use a subsampled layout. When using FFR, the subsampled layout will improve app GPU performance and reduce FFR-related visual artifacts. However, this feature will slightly increase the GPU cost of Timewarp. Therefore, we only recommend enabling it if the app is using FFR level 2 or higher, in which case, the app GPU performance improvement should outweigh the extra Timewarp cost. Vulkan only.
* **Foveated Rendering Method** - Choose which foveated rendering method is used when foveation is enabled.
Expand All @@ -59,6 +59,6 @@ The Oculus XR Plugin integration with XR Management provides the following funct

### Fixed-Foveated Rendering (FFR)

Quest 2, and Quest Pro support [fixed-foveated rendering](https://developer.oculus.com/documentation/quest/latest/concepts/mobile-ffr/) to provide better performance for [pixel-fill limited](https://en.wikipedia.org/wiki/Fillrate) applications. Controlling the level of foveation is made available through APIs in the Oculus XR Plugin.
Support for [fixed-foveated rendering](https://developer.oculus.com/documentation/quest/latest/concepts/mobile-ffr/) to provide better performance for [pixel-fill limited](https://en.wikipedia.org/wiki/Fillrate) applications. Controlling the level of foveation is made available through APIs in the Oculus XR Plugin.

FFR works best when rendering directly into the *eye textures* using the [foward rendering mode](https://docs.unity3d.com/Manual/RenderTech-ForwardRendering.html). [*Deferred rendering* mode](https://docs.unity3d.com/Manual/RenderTech-DeferredShading.html), which is characterized by rendering into an intermediate render texture, is not recommended for use with FFR. This situation arises often when using the default *Universal Rendering Pipeline*, which includes a blit operation by default at the end of the frame.
68 changes: 37 additions & 31 deletions Editor/OculusBuildProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,17 @@ internal class OculusBuildHooks : IPreprocessBuildWithReport, IPostprocessBuildW
{
public int callbackOrder { get; }

internal static string s_AndroidManifestPath = "";

private static readonly Dictionary<string, string> AndroidBootConfigVars = new Dictionary<string, string>()
{
{ "xr-meta-enabled", "1" }
{ "xr-usable-core-mask-enabled", "1" },
{ "xr-vulkan-extension-fragment-density-map-enabled", "1" },
{ "xr-low-latency-audio-enabled", "1"},
{ "xr-require-backbuffer-textures", "0" },
{ "xr-keyboard-overlay-enabled", "1" },
{ "xr-pipeline-cache-enabled", "1" },
{ "xr-skip-B10G11R11-special-casing", "1" },
{ "xr-hide-memoryless-render-texture", "1" },
{ "xr-skip-audio-buffer-size-check", "1" }
};

public void OnPreprocessBuild(BuildReport report)
Expand All @@ -189,7 +195,7 @@ public void OnPreprocessBuild(BuildReport report)
return;

var settings = OculusBuildTools.GetSettings();

if (report.summary.platformGroup == BuildTargetGroup.Android)
{
GraphicsDeviceType firstGfxType = PlayerSettings.GetGraphicsAPIs(report.summary.platform)[0];
Expand All @@ -199,7 +205,7 @@ public void OnPreprocessBuild(BuildReport report)
{
throw new BuildFailedException("OpenGLES3 and Vulkan are currently the only graphics APIs compatible with the Oculus XR Plugin on mobile platforms.");
}

if (PlayerSettings.colorSpace != ColorSpace.Linear && (firstGfxType == GraphicsDeviceType.OpenGLES3))
{
throw new BuildFailedException("Only Linear Color Space is supported when using OpenGLES. Please set Color Space to Linear in Player Settings, or switch to Vulkan.");
Expand All @@ -209,7 +215,7 @@ public void OnPreprocessBuild(BuildReport report)
{
throw new BuildFailedException("OpenGLES2, OpenGLES3, and Vulkan are currently the only graphics APIs compatible with the Oculus XR Plugin on mobile platforms.");
}

if (PlayerSettings.colorSpace != ColorSpace.Linear && (firstGfxType == GraphicsDeviceType.OpenGLES3 || firstGfxType == GraphicsDeviceType.OpenGLES2))
{
throw new BuildFailedException("Only Linear Color Space is supported when using OpenGLES. Please set Color Space to Linear in Player Settings, or switch to Vulkan.");
Expand Down Expand Up @@ -262,7 +268,7 @@ public void OnPostprocessBuild(BuildReport report)
{
if(!OculusBuildTools.OculusLoaderPresentInSettingsForBuildTarget(report.summary.platformGroup))
return;

if (report.summary.platformGroup == BuildTargetGroup.Android)
{
// clean up Android Meta boot settings after build
Expand All @@ -276,36 +282,20 @@ public void OnPostprocessBuild(BuildReport report)

bootConfig.WriteBootConfig();

// clean up Android manifest after build
if (!string.IsNullOrEmpty(s_AndroidManifestPath))
{
try
{
File.Delete(s_AndroidManifestPath);
}
catch (Exception e)
{
// this only fails if the file can't be deleted; it is quiet if the file does not exist
Debug.LogWarning("Failed to clean up AndroidManifest.xml file located at " + s_AndroidManifestPath + " : " + e.ToString());
}
}

s_AndroidManifestPath = "";

// verify settings
var settings = OculusBuildTools.GetSettings();
if (settings != null)
{
GraphicsDeviceType firstGfxType = PlayerSettings.GetGraphicsAPIs(report.summary.platform)[0];

if (settings.SymmetricProjection && (!(settings.TargetQuest2 || settings.TargetQuestPro) || settings.m_StereoRenderingModeAndroid != OculusSettings.StereoRenderingModeAndroid.Multiview || firstGfxType != GraphicsDeviceType.Vulkan))
if (settings.SymmetricProjection && (settings.m_StereoRenderingModeAndroid != OculusSettings.StereoRenderingModeAndroid.Multiview || firstGfxType != GraphicsDeviceType.Vulkan))
{
Debug.LogWarning("Symmetric Projection is only supported on Quest 2 and Quest Pro with Vulkan and Multiview.");
Debug.LogWarning("Symmetric Projection is only supported with Vulkan and Multiview.");
}

if (settings.SubsampledLayout && (!(settings.TargetQuest2 || settings.TargetQuestPro) || firstGfxType != GraphicsDeviceType.Vulkan))
if (settings.SubsampledLayout && (firstGfxType != GraphicsDeviceType.Vulkan))
{
Debug.LogWarning("Subsampled Layout is only supported on Quest 2 and Quest Pro with Vulkan.");
Debug.LogWarning("Subsampled Layout is only supported with Vulkan.");
}

if (settings.DepthSubmission && (settings.m_StereoRenderingModeAndroid != OculusSettings.StereoRenderingModeAndroid.Multiview || firstGfxType != GraphicsDeviceType.Vulkan))
Expand Down Expand Up @@ -559,7 +549,23 @@ public void OnPostGenerateGradleAndroidProject(string path)

nodePath = "/manifest/application";
UpdateOrCreateAttributeInTag(manifestDoc, nodePath, "activity", "screenOrientation", "landscape");
UpdateOrCreateAttributeInTag(manifestDoc, nodePath, "activity", "theme", "@android:style/Theme.Black.NoTitleBar.Fullscreen");

var styleTheme = string.Empty;
#if UNITY_2023_1_OR_NEWER
switch (PlayerSettings.Android.applicationEntry)
{
case AndroidApplicationEntry.GameActivity:
styleTheme = "@style/BaseUnityGameActivityTheme";
break;

case AndroidApplicationEntry.Activity:
styleTheme = "@style/UnityThemeSelector";
break;
}
#else
styleTheme = "@android:style/Theme.Black.NoTitleBar.Fullscreen";
#endif
UpdateOrCreateAttributeInTag(manifestDoc, nodePath, "activity", "theme", styleTheme);

var configChangesValue = "keyboard|keyboardHidden|navigation|orientation|screenLayout|screenSize|uiMode";
configChangesValue = ((sdkVersion >= 24) ? configChangesValue + "|density" : configChangesValue);
Expand Down Expand Up @@ -594,6 +600,9 @@ public void OnPostGenerateGradleAndroidProject(string path)
if (settings.TargetQuestPro)
deviceList.Add("cambria");

if (settings.TargetQuest3)
deviceList.Add("eureka");

if (deviceList.Count > 0)
{
StringBuilder sb = new StringBuilder();
Expand Down Expand Up @@ -660,9 +669,6 @@ public void OnPostGenerateGradleAndroidProject(string path)
RemoveNameValueElementInTag(manifestDoc, nodePath, "uses-permission", "android:name", "android.permission.BLUETOOTH");

manifestDoc.Save(manifestPath);

// let OnPostprocessBuild() know which intermediate manifest to delete
OculusBuildHooks.s_AndroidManifestPath = manifestPath;
}

public int callbackOrder { get { return 10000; } }
Expand Down
1 change: 1 addition & 0 deletions Editor/OculusMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public bool PopulateNewSettingsInstance(ScriptableObject obj)
settings.SpaceWarp = false;
settings.TargetQuest2 = true;
settings.TargetQuestPro = false;
settings.TargetQuest3 = false;
settings.DepthSubmission = false;

return true;
Expand Down
64 changes: 64 additions & 0 deletions Editor/OculusProjectValidator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#if XR_CORE_UTILS && UNITY_EDITOR

using System.Linq;
using Unity.XR.CoreUtils.Editor;
using Unity.XR.Oculus;
using UnityEditor.XR.Management;
using UnityEngine.Rendering;

namespace UnityEditor.XR.Oculus
{
[InitializeOnLoad]
internal static class OculusProjectValidator
{
private const string ambientOcclusionScriptName = "ScreenSpaceAmbientOcclusion";
private static readonly BuildTargetGroup[] buildTargetGroups = new BuildTargetGroup[] { BuildTargetGroup.Standalone, BuildTargetGroup.Android };

static OculusProjectValidator() => AddValidationRules();

private static void AddValidationRules()
{
foreach (var buildTargetGroup in buildTargetGroups)
{
var buildTargetRules = new BuildValidationRule[]
{
new BuildValidationRule()
{
Message = "Using the Screen Space Ambient Occlusion render feature results in significant performance overhead when the application is running natively on device. Disabling or removing that render feature is recommended.",
Category = "Oculus",
HelpText = "Only removing the Screen Space Ambient Occlusion render feature from all UniversalRenderer assets that may be used will make this warning go away, but just disabling the render feature will still prevent the performance overhead.",
FixItAutomatic = false,
IsRuleEnabled = () =>
{
var settings = XRGeneralSettingsPerBuildTarget.XRGeneralSettingsForBuildTarget(buildTargetGroup);

if (settings)
return settings.Manager.activeLoaders.Any(typeof(OculusLoader).IsInstanceOfType);

return false;
},
CheckPredicate = () =>
{
// Checks the dependencies of all configured render pipeline assets.
foreach(var renderPipeline in GraphicsSettings.allConfiguredRenderPipelines)
{
var dependencies = AssetDatabase.GetDependencies(AssetDatabase.GetAssetPath(renderPipeline));
foreach(var dependency in dependencies)
{
if (dependency.Contains(ambientOcclusionScriptName))
return false;
}
}

return true;
}
}
};

BuildValidator.AddRules(buildTargetGroup, buildTargetRules);
}

}
}
}
#endif
11 changes: 11 additions & 0 deletions Editor/OculusProjectValidator.cs.meta

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

Loading

0 comments on commit 8fcd3b2

Please sign in to comment.