Class FSRUtils
Utility functions relating to FidelityFX Super Resolution (FSR)
These functions are expected to be used in conjuction with the helper functions provided by FSRCommon.hlsl.
Inherited Members
Namespace: UnityEngine.Rendering
Assembly: Unity.RenderPipelines.Core.Runtime.dll
Syntax
public static class FSRUtils
Fields
kDefaultSharpnessLinear
The default RCAS sharpness parameter as a linear value
Declaration
public const float kDefaultSharpnessLinear = 0.92
Field Value
Type | Description |
---|---|
float |
kDefaultSharpnessStops
AMD's FidelityFX Super Resolution integration guide recommends a value of 0.2 for the RCAS sharpness parameter when specified in stops
Declaration
public const float kDefaultSharpnessStops = 0.2
Field Value
Type | Description |
---|---|
float |
Methods
IsSupported()
Returns true if FidelityFX Super Resolution (FSR) is supported on the current system FSR requires the textureGather shader instruction which wasn't supported by OpenGL ES until version 3.1
Declaration
public static bool IsSupported()
Returns
Type | Description |
---|---|
bool | True if supported |
SetEasuConstants(BaseCommandBuffer, Vector2, Vector2, Vector2)
Sets the constant values required by the FSR EASU shader on the provided command buffer
Logic ported from "FsrEasuCon()" in Runtime/PostProcessing/Shaders/ffx/ffx_fsr1.hlsl
Declaration
public static void SetEasuConstants(BaseCommandBuffer cmd, Vector2 inputViewportSizeInPixels, Vector2 inputImageSizeInPixels, Vector2 outputImageSizeInPixels)
Parameters
Type | Name | Description |
---|---|---|
BaseCommandBuffer | cmd | RasterCommandBuffer/ComputeCommandBuffer/LowlevelCommandBuffer to modify |
Vector2 | inputViewportSizeInPixels | This the rendered image resolution being upscaled |
Vector2 | inputImageSizeInPixels | This is the resolution of the resource containing the input image (useful for dynamic resolution) |
Vector2 | outputImageSizeInPixels | This is the display resolution which the input image gets upscaled to |
SetEasuConstants(CommandBuffer, Vector2, Vector2, Vector2)
Sets the constant values required by the FSR EASU shader on the provided command buffer
Logic ported from "FsrEasuCon()" in Runtime/PostProcessing/Shaders/ffx/ffx_fsr1.hlsl
Declaration
public static void SetEasuConstants(CommandBuffer cmd, Vector2 inputViewportSizeInPixels, Vector2 inputImageSizeInPixels, Vector2 outputImageSizeInPixels)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cmd | Command buffer to modify |
Vector2 | inputViewportSizeInPixels | This the rendered image resolution being upscaled |
Vector2 | inputImageSizeInPixels | This is the resolution of the resource containing the input image (useful for dynamic resolution) |
Vector2 | outputImageSizeInPixels | This is the display resolution which the input image gets upscaled to |
SetRcasConstants(CommandBuffer, float)
Sets the constant values required by the FSR RCAS shader on the provided command buffer
Logic ported from "FsrRcasCon()" in Runtime/PostProcessing/Shaders/ffx/ffx_fsr1.hlsl For a more user-friendly version of this function, see SetRcasConstantsLinear().
Declaration
public static void SetRcasConstants(CommandBuffer cmd, float sharpnessStops = 0.2)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cmd | Command buffer to modify |
float | sharpnessStops | The scale is {0.0 := maximum, to N>0, where N is the number of stops(halving) of the reduction of sharpness |
SetRcasConstantsLinear(RasterCommandBuffer, float)
Sets the constant values required by the FSR RCAS shader on the provided command buffer
Equivalent to SetRcasConstants(), but handles the sharpness parameter as a linear value instead of one specified in stops. This is intended to simplify code that allows users to configure the sharpening behavior from a GUI.
Declaration
public static void SetRcasConstantsLinear(RasterCommandBuffer cmd, float sharpnessLinear = 0.92)
Parameters
Type | Name | Description |
---|---|---|
RasterCommandBuffer | cmd | RasterCommandBuffer to modify |
float | sharpnessLinear | The level of intensity of the sharpening filter where 0.0 is the least sharp and 1.0 is the most sharp |
SetRcasConstantsLinear(CommandBuffer, float)
Sets the constant values required by the FSR RCAS shader on the provided command buffer
Equivalent to SetRcasConstants(), but handles the sharpness parameter as a linear value instead of one specified in stops. This is intended to simplify code that allows users to configure the sharpening behavior from a GUI.
Declaration
public static void SetRcasConstantsLinear(CommandBuffer cmd, float sharpnessLinear = 0.92)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cmd | Command buffer to modify |
float | sharpnessLinear | The level of intensity of the sharpening filter where 0.0 is the least sharp and 1.0 is the most sharp |