Class Upscaling
Manages the pipeline's upscalers: their instances, the active selection, their per-camera contexts and options.
Inherited Members
Namespace: UnityEngine.Rendering
Assembly: Unity.RenderPipelines.Core.Runtime.dll
Syntax
public class Upscaling
Constructors
Upscaling(List<UpscalerOptions>, HashSet<Type>?, Type[]?)
Initializes the Upscaling system. with the given list of upscaler options per upscaler type.
Declaration
public Upscaling(List<UpscalerOptions> upscalerOptions, HashSet<Type>? embeddedTypes = null, Type[]? priorityOrder = null)
Parameters
| Type | Name | Description |
|---|---|---|
| List<UpscalerOptions> | upscalerOptions | The list of options from the RP asset. |
| HashSet<Type> | embeddedTypes | A set of types that the pipeline handles internally (e.g., Bilinear, Point in URP). |
| Type[] | priorityOrder | An ordered list of Types. Upscalers matching these types will appear first in the list, in the order provided. All others appear after, alphabetically. |
Properties
activeUpscaler
Returns the active IUpscaler instance, null if none is selected.
Declaration
public IUpscaler? activeUpscaler { get; }
Property Value
| Type | Description |
|---|---|
| IUpscaler |
activeUpscalerIsEmbedded
Returns true if the active upscaler is embedded in an uber pass.
Declaration
public bool activeUpscalerIsEmbedded { get; }
Property Value
| Type | Description |
|---|---|
| bool |
upscalerIds
Returns the IDs of the upscalers registered to the upscaling system.
Declaration
public IReadOnlyList<string> upscalerIds { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<string> |
Methods
AcquireContext(ulong, IUpscaler, UpscalerOptions, Vector2Int)
Acquires an upscaler context for the specified camera. Returns a cached context if valid, or creates a new one if missing or invalid. Also updates the context's last-used frame for expiry tracking.
Declaration
public IUpscalerContext? AcquireContext(ulong cameraId, IUpscaler upscaler, UpscalerOptions options, Vector2Int displayResolution)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | cameraId | Unique ID for the camera. In XR scenarios, this must be unique per view (encode eye information into the ID). |
| IUpscaler | upscaler | The upscaler to acquire a context for. |
| UpscalerOptions | options | The current upscaler options. |
| Vector2Int | displayResolution | The target display resolution. |
Returns
| Type | Description |
|---|---|
| IUpscalerContext | The context, or null for spatial upscalers that don't need context. |
CleanupExpiredContexts(CommandBuffer)
Cleans up contexts that haven't been used for a while (400 frames). Should be called once per frame from the render pipeline.
Declaration
public void CleanupExpiredContexts(CommandBuffer cmd)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | The command buffer to record cleanup commands into. |
Dispose(CommandBuffer)
Cleans up all contexts. Call when the upscaling system is torn down (e.g. when the render pipeline is disposed)
Declaration
public void Dispose(CommandBuffer cmd)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | The command buffer to record cleanup commands into. |
GetGlobalOptions(IUpscaler)
Returns the pipeline-wide ("global") options for the given upscaler — the live, user-configured options
object the pipeline supplied (e.g. an RP-asset sub-asset), shared by all cameras — or null if the
upscaler was registered without an options type (e.g. spatial/embedded upscalers).
Declaration
public UpscalerOptions? GetGlobalOptions(IUpscaler upscaler)
Parameters
| Type | Name | Description |
|---|---|---|
| IUpscaler | upscaler | The upscaler whose global options to fetch. |
Returns
| Type | Description |
|---|---|
| UpscalerOptions | The pipeline-wide options, or null if the upscaler has no options type. |
Remarks
This is not a copy and not factory defaults: editing the returned object (inspector or C# API) is reflected here, because it is the same serialized instance. Options are owned by the framework, not the IUpscaler instance.
Per-camera options (future) layer on top of this: add an override-aware
ResolveOptions(IUpscaler, UpscalerOptions perCameraOverride) returning
perCameraOverride ?? GetGlobalOptions(upscaler), and have the call sites pass the camera's serialized
override (read from the pipeline-specific camera component — core cannot see it). That is a non-breaking
addition and this method stays as the global fallback. Not added now because no per-camera override source
exists yet (it would be a no-op).
GetIUpscalerById(string)
Returns the registered IUpscaler instance with the given ID.
Declaration
public IUpscaler? GetIUpscalerById(string upscalerId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | upscalerId | An upscaler ID. See upscalerId. |
Returns
| Type | Description |
|---|---|
| IUpscaler | The registered IUpscaler instance with the given ID, or null if none matches. |
GetIUpscalerOfType(Type)
Returns null if no IUpscaler exists for given type
Declaration
public IUpscaler? GetIUpscalerOfType(Type T)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | T | The upscaler type to fetch. |
Returns
| Type | Description |
|---|---|
| IUpscaler | The registered instance of that type, or |
GetIUpscalerOfType<T>()
Returns null if no IUpscaler exists for given type
Declaration
public IUpscaler? GetIUpscalerOfType<T>() where T : IUpscaler
Returns
| Type | Description |
|---|---|
| IUpscaler | The registered instance of that type, or |
Type Parameters
| Name | Description |
|---|---|
| T | The upscaler type to fetch. |
IndexOf(string)
Returns the index of the upscalerId.
Declaration
public int IndexOf(string upscalerId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | upscalerId | An upscaler ID. See upscalerId. |
Returns
| Type | Description |
|---|---|
| int | The index of the upscalerId. -1 if upscalerId is not in the ID cache. |
SetActiveUpscaler(string)
Sets the active upscaler by ID, returns whether an upscaler with the given ID was registered. The upscaler is activated whether or not it runs on this device, which is left for the caller to decide.
Declaration
public bool SetActiveUpscaler(string upscalerId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | upscalerId | An upscaler ID. See upscalerId. |
Returns
| Type | Description |
|---|---|
| bool | True if an upscaler with the given ID exists and it was set as active. |
SetActiveUpscalerToFirstSupported(IReadOnlyList<string>?)
Activates the first upscaler in the list that runs on this device.
Declaration
public void SetActiveUpscalerToFirstSupported(IReadOnlyList<string>? upscalerIds)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<string> | upscalerIds | Upscaler IDs, from highest to lowest priority. |