Interface IUpscaler
Defines the essential contract for any upscaling technology.
Inherited Members
Namespace: UnityEngine.Rendering
Assembly: Unity.RenderPipelines.Core.Runtime.dll
Syntax
public interface IUpscaler : IRenderGraphRecorder
Remarks
An upscaler instance is a shared singleton: one instance per type serves every camera and XR view. Store no
per-camera or per-frame state on it — per-camera state belongs in IUpscalerContext, and per-frame
inputs (options, resolutions, matrices, ...) arrive via UpscalingIO each frame. In particular,
read options from io.options (passed by the pipeline); the instance does not hold them.
Properties
hasQualityMode
Returns true if the upscaler exposes a quality mode that can dictate the render resolution (e.g. the DLSS/FSR presets). When false, the upscaler has no opinion on resolution and the pipeline drives the render resolution (e.g. STP, spatial filters), which is equivalent to CustomScaling.
Declaration
bool hasQualityMode { get; }
Property Value
| Type | Description |
|---|---|
| bool |
isSupportedOnDevice
Returns true if the upscaler can run on the current device.
Declaration
bool isSupportedOnDevice { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
Queried when selecting an upscaler, so it must be cheap. Implementations that need to probe hardware or a plugin should do so once and return the cached result.
isTemporal
Returns true if the upscaler uses temporal information from previous frames.
Declaration
bool isTemporal { get; }
Property Value
| Type | Description |
|---|---|
| bool |
name
Gets the display name of the upscaler (e.g., "FSR2").
Declaration
string name { get; }
Property Value
| Type | Description |
|---|---|
| string |
reactiveMaskSource
Returns the type of reactive mask that the upscaler requires.
Declaration
ReactiveMaskSource reactiveMaskSource { get; }
Property Value
| Type | Description |
|---|---|
| ReactiveMaskSource |
supportsAlphaUpscaling
Returns true if the alpha channel of the upscaler's output is valid.
Declaration
bool supportsAlphaUpscaling { get; }
Property Value
| Type | Description |
|---|---|
| bool |
supportsSharpening
Returns true if the upscaler supports sharpening within the upscaling pass.
Declaration
bool supportsSharpening { get; }
Property Value
| Type | Description |
|---|---|
| bool |
upscalerId
Gets the stable identifier of the upscaler (e.g., "unity.stp"), which render pipeline assets serialize.
Declaration
string upscalerId { get; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
Prefix the ID to keep it unique, and never change it once shipped: This is never localized and never shown to users.
Methods
CalculateJitter(int, float, out Vector2, out bool)
Calculates the pixel jitter for the current frame.
Declaration
void CalculateJitter(int frameIndex, float upscaleRatio, out Vector2 jitter, out bool allowScaling)
Parameters
| Type | Name | Description |
|---|---|---|
| int | frameIndex | The index of the current frame, used to cycle through jitter patterns. |
| float | upscaleRatio | The ratio of output resolution to input resolution (e.g., 2.0 for 1080p → 4K). |
| Vector2 | jitter | Outputs the calculated sub-pixel jitter vector. |
| bool | allowScaling | Outputs whether the jitter vector permits scaling relative to resolution. |
CalculateMipBias(Vector2Int, Vector2Int)
Calculates the recommended global mip bias for texture sampling during rendering. Temporal upscalers typically recommend a negative bias to sample finer mip levels, providing more detail for temporal accumulation.
Declaration
float CalculateMipBias(Vector2Int preUpscaleResolution, Vector2Int postUpscaleResolution)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2Int | preUpscaleResolution | The render resolution before upscaling. |
| Vector2Int | postUpscaleResolution | The target display resolution after upscaling. |
Returns
| Type | Description |
|---|---|
| float | The recommended mip bias value (typically negative when upscaling). |
Remarks
The standard formula is log2(renderWidth / displayWidth), which produces negative
values when upscaling (e.g., -1.0 for 2x upscaling). Some upscalers recommend an additional
offset (e.g., -1.0) for sharper results.
When a temporal upscaler is active, the render pipeline should use this value directly,
bypassing any TAA mip bias settings.
The render pipelines must guarantee this method is only called when upscaling is active
(preUpscaleResolution < postUpscaleResolution). Implementations do not need to handle
the no-upscaling case.
CreateContext(UpscalerOptions, Vector2Int)
Creates a new context for this upscaler. Upscaler authors implement this to create per-camera state. Called by the context manager when a new camera needs upscaling or when an existing context is invalidated.
Declaration
IUpscalerContext CreateContext(UpscalerOptions options, Vector2Int displayResolution)
Parameters
| Type | Name | Description |
|---|---|---|
| UpscalerOptions | options | The upscaler options to create the context with. |
| Vector2Int | displayResolution | The target display resolution. |
Returns
| Type | Description |
|---|---|
| IUpscalerContext | A new context instance, or null for spatial upscalers that don't need context. |
GetResolutionInfo(Vector2Int, UpscalerOptions)
Gets resolution information for this upscaler given a display resolution and options. Used by pipelines to configure DRS bounds or display resolution info in UI.
Declaration
UpscalerResolutionInfo GetResolutionInfo(Vector2Int displayResolution, UpscalerOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2Int | displayResolution | The target display/output resolution. |
| UpscalerOptions | options | The upscaler options to use for resolution calculation. |
Returns
| Type | Description |
|---|---|
| UpscalerResolutionInfo | Resolution info containing optimal and optional min/max resolutions. |
Remarks
DLSS and XeSS provide per-quality-mode min/max ranges via their SDK APIs. FSR2 provides only optimal resolution (no per-quality range). Spatial upscalers return the display resolution unchanged.
The options parameter is provided by the framework (Upscaling.GetGlobalOptions) and enables future per-camera quality settings; pipelines pass the framework-resolved options (asset default today; per-camera later).
Example usage:
var info = upscaler.GetResolutionInfo(displayResolution, upscaling.GetGlobalOptions(upscaler));
if (info.constraint == UpscalerResolutionConstraint.Range)
{
drsSettings.minPercentage = (float)info.minResolution.x / displayResolution.x * 100f;
drsSettings.maxPercentage = (float)info.maxResolution.x / displayResolution.x * 100f;
}