Class XRSystem
Used by render pipelines to communicate with XR SDK.
Inherited Members
Namespace: UnityEngine .Experimental.Rendering
Assembly: Unity.RenderPipelines.Core.Runtime.dll
Syntax
public static class XRSystem
Fields
emptyPass
Valid empty pass when a camera is not using XR.
Declaration
public static readonly XRPass emptyPass
Field Value
Type | Description |
---|---|
XRPass |
Properties
displayActive
Returns true if a XR device is connected and running.
Declaration
public static bool displayActive { get; }
Property Value
Type | Description |
---|---|
bool |
dumpDebugInfo
If true, the system will log some information about the layout to the console.
Declaration
public static bool dumpDebugInfo { get; set; }
Property Value
Type | Description |
---|---|
bool |
foveatedRenderingCaps
Cached value of SystemInfo.foveatedRenderingCaps.
Declaration
public static FoveatedRenderingCaps foveatedRenderingCaps { get; set; }
Property Value
Type | Description |
---|---|
Foveated |
isHDRDisplayOutputActive
Returns if the XR display is running in HDR mode.
Declaration
public static bool isHDRDisplayOutputActive { get; }
Property Value
Type | Description |
---|---|
bool |
singlePassAllowed
If true, the system will try to create a layout compatible with single-pass rendering.
Declaration
public static bool singlePassAllowed { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
Dispose()
Free up resources used by the system.
Declaration
public static void Dispose()
EndLayout()
Used by the render pipeline to complete the XR layout at the end of the frame.
Declaration
public static void EndLayout()
GetActiveDisplay()
Returns the active XR display.
Declaration
public static XRDisplaySubsystem GetActiveDisplay()
Returns
Type | Description |
---|---|
XRDisplay |
GetDisplayMSAASamples()
Returns the number of samples (MSAA) currently configured on the XR device.
Declaration
public static MSAASamples GetDisplayMSAASamples()
Returns
Type | Description |
---|---|
MSAASamples | Returns current active msaa samples. |
GetRenderViewportScale()
Used by the render pipeline to retrieve the renderViewportScale value from the XR display. One use case for retriving this value is that render pipeline can properly sync some SRP owned textures to scale accordingly
Declaration
public static float GetRenderViewportScale()
Returns
Type | Description |
---|---|
float | Returns current scaleOfAllViewports value from the XRDisplaySubsystem. |
Initialize(Func<XRPassCreateInfo, XRPass>, Shader, Shader)
Use this method to assign the shaders that will be used to render occlusion mesh for each XRPass and the final mirror view.
Declaration
public static void Initialize(Func<XRPassCreateInfo, XRPass> passAllocator, Shader occlusionMeshPS, Shader mirrorViewPS)
Parameters
Type | Name | Description |
---|---|---|
Func<XRPass |
passAllocator | Delegate funcion used to allocate XRPasses. |
Shader | occlusionMeshPS | Fragement shader used for rendering occlusion mesh. |
Shader | mirrorViewPS | Fragement shader used for rendering mirror view. |
NewLayout()
Used by the render pipeline to initiate a new rendering frame through a XR layout.
Declaration
public static XRLayout NewLayout()
Returns
Type | Description |
---|---|
XRLayout | Returns a new default layout. |
RenderMirrorView(CommandBuffer, Camera)
Used by the render pipeline to render the mirror view to the gameview, as configured by the XR device.
Declaration
public static void RenderMirrorView(CommandBuffer cmd, Camera camera)
Parameters
Type | Name | Description |
---|---|---|
Command |
cmd | CommandBuffer on which to perform the mirror view draw. |
Camera | camera | Camera that has XR device connected to. The connected XR device determines how to perform the mirror view draw. |
SetDisplayMSAASamples(MSAASamples)
Used by the render pipeline to communicate to the XR device how many samples are used by MSAA.
Declaration
public static void SetDisplayMSAASamples(MSAASamples msaaSamples)
Parameters
Type | Name | Description |
---|---|---|
MSAASamples | msaaSamples | The active msaa samples the XRDisplay to set to. The eye texture surfaces are reallocated when necessary to work with the active msaa samples. |
SetRenderScale(float)
Used by the render pipeline to scale the render target on the XR device.
Declaration
public static void SetRenderScale(float renderScale)
Parameters
Type | Name | Description |
---|---|---|
float | renderScale | A value of 1.0f represents 100% of the original resolution. |