Class UpscalingIO
Defines the inputs and outputs required for an upscaling pass.
Inherited Members
Namespace: UnityEngine.Rendering
Assembly: Unity.RenderPipelines.Core.Runtime.dll
Syntax
public class UpscalingIO : ContextItem
Properties
blueNoiseTextureSet
A set of blue noise textures used for dithering or other stochastic effects during upscaling.
Declaration
public Texture2D[] blueNoiseTextureSet { get; set; }
Property Value
| Type | Description |
|---|---|
| Texture2D[] |
cameraColor
The input color texture to be upscaled.
Declaration
public TextureHandle cameraColor { get; set; }
Property Value
| Type | Description |
|---|---|
| TextureHandle |
cameraDepth
The depth texture associated with the camera color.
Declaration
public TextureHandle cameraDepth { get; set; }
Property Value
| Type | Description |
|---|---|
| TextureHandle |
cameraInstanceID
The unique instance ID of the camera rendering this frame.
Declaration
public ulong cameraInstanceID { get; set; }
Property Value
| Type | Description |
|---|---|
| ulong |
context
The per-camera context for the active upscaler. Populated by the pipeline before calling RecordRenderGraph(). Temporal upscalers read this to access their history buffers. Spatial upscalers that don't need context will have this set to null.
Declaration
public IUpscalerContext context { get; set; }
Property Value
| Type | Description |
|---|---|
| IUpscalerContext |
deltaTime
The time elapsed since the last frame.
Declaration
public float deltaTime { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
dynamicResolution
The active Dynamic Resolution Scaling state for this frame, or null when DRS is inactive.
null— no DRS; the render resolution is fixed this frame (fixed-ratio upscaling).- Hardware — render targets are allocated at display resolution and scaled via hardware memory aliasing; history/RTHandles should be sized at postUpscaleResolution.
- Software — the render resolution may vary frame-to-frame with the target allocated at the render resolution.
Convenience: dynamicResolution.HasValue means DRS is active; dynamicResolution == DynamicResolutionType.Hardware
gates display-resolution history allocation. Upscalers using native plugin-managed history (DLSS, FSR2) can ignore the distinction.
Declaration
public DynamicResolutionType? dynamicResolution { get; set; }
Property Value
| Type | Description |
|---|---|
| DynamicResolutionType? |
enableMotionScaling
Indicates if motion vector scaling is enabled.
Declaration
public bool enableMotionScaling { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
enableTexArray
Indicates if texture arrays are enabled/supported for input textures.
Declaration
public bool enableTexArray { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
exposureTexture
The texture containing exposure data, typically 1x1.
Declaration
public TextureHandle exposureTexture { get; set; }
Property Value
| Type | Description |
|---|---|
| TextureHandle |
farClipPlane
The distance to the far clipping plane.
Declaration
public float farClipPlane { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
fieldOfViewDegrees
The vertical field of view in degrees.
Declaration
public float fieldOfViewDegrees { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
flippedX
Indicates if the X-axis is flipped (right to left).
Declaration
public bool flippedX { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
flippedY
Indicates if the Y-axis is flipped (upside down).
Declaration
public bool flippedY { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
frameIndex
The current frame index.
Declaration
public int frameIndex { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
hdrDisplayInformation
Information required to convert HDR color gamuts to SDR. This is used because some upscalers do not natively support specific HDR color gamuts.
Declaration
public HDROutputUtils.HDRDisplayInformation hdrDisplayInformation { get; set; }
Property Value
| Type | Description |
|---|---|
| HDROutputUtils.HDRDisplayInformation |
hdrInput
Indicates if the input color texture contains HDR data.
Declaration
public bool hdrInput { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
invertedDepth
Indicates if the depth buffer is inverted (Near: 1.0, Far: 0.0).
Declaration
public bool invertedDepth { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
jitteredMotionVectors
Indicates if the motion vectors include the camera jitter offset.
Declaration
public bool jitteredMotionVectors { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
maxPreUpscaleResolution
The maximum render resolution the source image can reach (the allocation size), set by the pipeline. Stable across the dynamic-resolution range, so upscalers should allocate per-camera history/native contexts at this size and dispatch at preUpscaleResolution — this avoids per-frame reallocation when the render size varies. Equals preUpscaleResolution when dynamic resolution is inactive. (Note: DLSS is an exception — its feature must be created at the SDK's recommended optimal, not this max.)
Declaration
public Vector2Int maxPreUpscaleResolution { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2Int |
motionVectorColor
The texture containing per-pixel motion vectors.
Declaration
public TextureHandle motionVectorColor { get; set; }
Property Value
| Type | Description |
|---|---|
| TextureHandle |
motionVectorDirection
Specifies the temporal direction of the motion vectors.
Declaration
public UpscalingIO.MotionVectorDirection motionVectorDirection { get; set; }
Property Value
| Type | Description |
|---|---|
| UpscalingIO.MotionVectorDirection |
motionVectorDomain
Specifies the coordinate space used within the motion vector texture.
Declaration
public UpscalingIO.MotionVectorDomain motionVectorDomain { get; set; }
Property Value
| Type | Description |
|---|---|
| UpscalingIO.MotionVectorDomain |
motionVectorTextureSize
The actual size of the motion vector texture, which may differ from the render resolution.
Declaration
public Vector2Int motionVectorTextureSize { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2Int |
nearClipPlane
The distance to the near clipping plane.
Declaration
public float nearClipPlane { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
numActiveViews
The number of active views (e.g., 2 for stereo rendering). This is the authoritative per-view count: the
per-view arrays below (positions/matrices) may be longer than this, so always iterate
[0, numActiveViews) and never rely on array.Length.
Declaration
public int numActiveViews { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
options
The current upscaler options for this frame/camera. Populated by the pipeline before calling RecordRenderGraph(). Upscalers should read per-frame settings (sharpness, etc.) from this property. Context-creation settings (quality mode, presets) are stored in the context itself.
Declaration
public UpscalerOptions options { get; set; }
Property Value
| Type | Description |
|---|---|
| UpscalerOptions |
Remarks
This separation enables dynamic settings changes without context recreation:
- Quality mode changes: Invalidate context via IsValidForOptions(), recreate
- Sharpness changes: Context stays valid, read new value from io.options
postUpscaleResolution
The target resolution after upscaling.
Declaration
public Vector2Int postUpscaleResolution { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2Int |
preExposureValue
The pre-exposure value applied to the lighting accumulation buffer. Some implementations (e.g., HDRP) apply exposure before tonemapping. Upscalers (DLSS/FSR) need this value to reconstruct the current frame without ghosting artifacts, usually obtained via a CPU readback on the 1x1 exposure texture.
Declaration
public float preExposureValue { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
preUpscaleResolution
The resolution of the source image rendered this frame (the actual render size; under dynamic resolution this varies frame to frame). Upscalers use this as the per-frame dispatch/subrect size.
Declaration
public Vector2Int preUpscaleResolution { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2Int |
previousDeltaTime
The time elapsed between the previous frame and the one before it.
Declaration
public float previousDeltaTime { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
previousPreUpscaleResolution
The resolution of the source image from the previous frame.
Declaration
public Vector2Int previousPreUpscaleResolution { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2Int |
previousPreviousProjectionMatrices
The projection matrices for the frame before the previous one.
Declaration
public Matrix4x4[] previousPreviousProjectionMatrices { get; set; }
Property Value
| Type | Description |
|---|---|
| Matrix4x4[] |
previousPreviousViewMatrices
The view matrices for the frame before the previous one.
Declaration
public Matrix4x4[] previousPreviousViewMatrices { get; set; }
Property Value
| Type | Description |
|---|---|
| Matrix4x4[] |
previousPreviousWorldSpaceCameraPositions
The camera positions in world space for the frame before the previous one.
Declaration
public Vector3[] previousPreviousWorldSpaceCameraPositions { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3[] |
previousProjectionMatrices
The projection matrices for the previous frame.
Declaration
public Matrix4x4[] previousProjectionMatrices { get; set; }
Property Value
| Type | Description |
|---|---|
| Matrix4x4[] |
previousViewMatrices
The view matrices for the previous frame.
Declaration
public Matrix4x4[] previousViewMatrices { get; set; }
Property Value
| Type | Description |
|---|---|
| Matrix4x4[] |
previousWorldSpaceCameraPositions
The camera positions in world space for the previous frame.
Declaration
public Vector3[] previousWorldSpaceCameraPositions { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3[] |
projectionMatrices
The projection matrices for the current frame.
Declaration
public Matrix4x4[] projectionMatrices { get; set; }
Property Value
| Type | Description |
|---|---|
| Matrix4x4[] |
reactiveMask
The texture containing reactive mask data.
Declaration
public TextureHandle reactiveMask { get; set; }
Property Value
| Type | Description |
|---|---|
| TextureHandle |
resetHistory
Indicates whether the upscaler history should be cleared (e.g., on camera cuts).
Declaration
public bool resetHistory { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
subpixelJitter
The sub-pixel jitter offset for this frame, in the same convention your CalculateJitter(int, float, out Vector2, out bool) returns. Pass it to your native upscaler's jitter-offset input unchanged. Values are typically in the range [-0.5, 0.5].
Declaration
public Vector2 subpixelJitter { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
Remarks
The pipeline derives this from your CalculateJitter(int, float, out Vector2, out bool) result and applies it to the projection before handing it back here. Read it in RecordRenderGraph; do not recompute jitter there.
viewMatrices
View matrices per view, current frame, in the pipeline's render space — these may be CAMERA-RELATIVE (camera translation removed, e.g. HDRP) for precision. Use worldSpaceCameraPositions for the absolute camera position; do not derive world position from the view-matrix translation. Length: use numActiveViews.
Declaration
public Matrix4x4[] viewMatrices { get; set; }
Property Value
| Type | Description |
|---|---|
| Matrix4x4[] |
worldSpaceCameraPositions
Absolute world-space camera position per view, current frame (length: use numActiveViews). These are always absolute, even when viewMatrices are camera-relative (camera translation stripped from the matrix, e.g. HDRP). Reconstruct an absolute view matrix by combining the two; do not assume the view matrix carries the world translation.
Declaration
public Vector3[] worldSpaceCameraPositions { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3[] |
Methods
Reset()
Resets the object so it can be used as a new instance next time it is created. To avoid memory allocations and generating garbage, the system reuses objects. This function should clear the object so it can be reused without leaking any information (e.g. pointers to objects that will no longer be valid to access). So it is important the implementation carefully clears all relevant members. Note that this is different from a Dispose or Destructor as the object in not freed but reset. This can be useful when havin large sub-allocated objects like arrays or lists which can be cleared and reused without re-allocating.
Declaration
public override void Reset()