Class STPUpscalerContext
Per-camera context for STP upscaling. Wraps the STP.HistoryContext and tracks the display resolution it was created for.
Implements
Inherited Members
Namespace: Global Namespace
Assembly: Unity.RenderPipelines.Core.Runtime.dll
Syntax
public class STPUpscalerContext : IUpscalerContext
Constructors
STPUpscalerContext(Vector2Int)
Creates a context holding fresh STP history for the given display resolution.
Declaration
public STPUpscalerContext(Vector2Int displayResolution)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2Int | displayResolution | The display (post-upscale) resolution this context is created for. |
Properties
createdForDisplayResolution
The display resolution this context was created for. Upscaler authors set this at creation time. The context manager reads it to detect resolution and options changes that require context recreation.
Declaration
public Vector2Int createdForDisplayResolution { get; }
Property Value
| Type | Description |
|---|---|
| Vector2Int |
historyContext
The STP history state this context owns, carried across frames so STP can reproject previous frames.
Declaration
public STP.HistoryContext historyContext { get; }
Property Value
| Type | Description |
|---|---|
| STP.HistoryContext |
lastUsedFrame
The frame number when this context was last used. Set automatically by the context manager each frame to track when unused contexts should be cleaned up.
Declaration
public int lastUsedFrame { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
Cleanup(CommandBuffer)
Releases native resources associated with this context. Called automatically by the context manager when the context expires, needs recreation, or the upscaling system is disposed.
Declaration
public void Cleanup(CommandBuffer cmd)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | The command buffer used to record cleanup commands into. The caller executes it. |
Remarks
A command buffer is taken rather than this being a plain managed Dispose because some upscalers own native resources that must be released on the render thread. Implementations may record a render-thread signal here instead of GPU work, and the release may complete asynchronously.
IsValidForOptions(UpscalerOptions)
Checks if this context is still valid for the given options. Upscaler authors implement the validation logic. The context manager calls this each frame to determine if the context needs recreation.
Declaration
public bool IsValidForOptions(UpscalerOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| UpscalerOptions | options | The current upscaler options to validate against. |
Returns
| Type | Description |
|---|---|
| bool | True if the context is still valid, false if it needs to be recreated. |