Class FoveatedRenderingFeature
This OpenXRFeature enables the use of foveated rendering in OpenXR.
Inherited Members
Namespace: UnityEngine.XR.OpenXR.Features
Assembly: Unity.XR.OpenXR.dll
Syntax
public class FoveatedRenderingFeature : OpenXRFeature
Fields
featureId
The feature id string. This is used to give the feature a well known id for reference.
Declaration
public const string featureId = "com.unity.openxr.feature.foveatedrendering"
Field Value
| Type | Description |
|---|---|
| string |
Properties
DynamicFoveationEnabled
Gets or sets whether the OpenXR runtime is allowed to vary the amount of foveation it applies, up to the foveation level your application sets.
Declaration
public bool DynamicFoveationEnabled { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
The foveation level itself is not controlled by this property. Set it with foveatedRenderingLevel. When dynamic foveation is disabled, the runtime applies that level constantly. When it is enabled, the level becomes a maximum and the runtime applies less foveation when there is GPU headroom to spare.
Because the level acts as a maximum, dynamic foveation has no effect while the
foveation level is 0, which is the default.
Dynamic foveation requires the Vulkan graphics API, an OpenXR runtime that supports it, and the Foveated Rendering Method set to Foveated rendering (SRP API). It has no effect with the Legacy API or Quad Views.
UseEyeTracking
Gets or sets whether eye tracking is used for foveated rendering. When false, the eye tracking extension is not requested and eye tracking android permissions are not added to the manifest.
Declaration
public bool UseEyeTracking { get; }
Property Value
| Type | Description |
|---|---|
| bool |
isSubsampledLayoutEnabled
Get whether Vulkan subsampled layout is currently enabled.
Declaration
public static bool isSubsampledLayoutEnabled { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
GetValidationChecks(List<ValidationRule>, BuildTargetGroup)
Allows a feature to add to a list of validation rules which your feature will evaluate at build time. Details of the validation results can be found in OpenXRProjectValidation.
Declaration
protected override void GetValidationChecks(List<OpenXRFeature.ValidationRule> rules, BuildTargetGroup targetGroup)
Parameters
| Type | Name | Description |
|---|---|---|
| List<OpenXRFeature.ValidationRule> | rules | Your feature will check the rules in this list at build time. Add rules that you want your feature to check, and remove rules that you want your feature to ignore. |
| BuildTargetGroup | targetGroup | Build target group these validation rules will be evaluated for. |
Overrides
HookGetInstanceProcAddr(IntPtr)
Called to hook xrGetInstanceProcAddr. Returning a different function pointer allows intercepting any OpenXR method.
Declaration
protected override IntPtr HookGetInstanceProcAddr(IntPtr func)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | func | xrGetInstanceProcAddr native function pointer |
Returns
| Type | Description |
|---|---|
| IntPtr | Function pointer that Unity will use to look up OpenXR native functions. |
Overrides
OnInstanceCreate(ulong)
Called after xrCreateInstance. Override this method to validate that any necessary OpenXR extensions were
successfully enabled (OpenXRRuntime.IsExtensionEnabled)
and that any required system properties are supported. If this method returns false,
the feature's enabled property is set to false.
Declaration
protected override bool OnInstanceCreate(ulong instance)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | instance |
Returns
| Type | Description |
|---|---|
| bool | true if this feature successfully initialized. Otherwise, false. |
Overrides
Remarks
If this feature is a required feature of an enabled feature set, returning false here
causes the OpenXRLoader to fail, and XR Plug-in Management will fall back to another loader if enabled.
See Also
OnSessionCreate(ulong)
Called after xrCreateSession.
Declaration
protected override void OnSessionCreate(ulong xrSession)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | xrSession | Handle of the xrSession |
Overrides
OnSessionDestroy(ulong)
Called before xrDestroySession.
Declaration
protected override void OnSessionDestroy(ulong xrSession)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | xrSession | Handle of the xrSession |
Overrides
ShouldUseExtension(string)
Returns whether the given OpenXR extension string should be requested at runtime.
Called once per extension declared in OpenXRFeatureAttributeOpenxrExtensionStrings.
Override to conditionally suppress individual extensions.
Declaration
protected override bool ShouldUseExtension(string ext)
Parameters
| Type | Name | Description |
|---|---|---|
| string | ext | The extension name string to evaluate. |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
TrySetSubsampledLayoutEnabled(bool)
Attempts to set whether subsampled layout is enabled.
Declaration
public static bool TrySetSubsampledLayoutEnabled(bool enableSubsampling)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | enableSubsampling | Indicates whether to enable subsampling. |
Returns
| Type | Description |
|---|---|
| bool | Returns true if subsampling state was updated and returns false otherwise. |