/// Base class for all of the compute passes that make up the FSR2 process.
/// This loosely matches the FfxPipelineState struct from the original FSR2 codebase, wrapped in an object-oriented blanket.
/// Base class for all of the compute passes that make up the FSR3 Upscaler process.
/// This loosely matches the FfxPipelineState struct from the original FSR3 Upscaler codebase, wrapped in an object-oriented blanket.
/// These classes are responsible for loading compute shaders, managing temporary resources, binding resources to shader kernels and dispatching said shaders.
/// </summary>
internalabstractclassFsr2Pass:IDisposable
{
internalconstintShadingChangeMipLevel=4;// This matches the FFX_FSR2_SHADING_CHANGE_MIP_LEVEL define
internalconstintShadingChangeMipLevel=4;// This matches the FFX_FSR3UPSCALER_SHADING_CHANGE_MIP_LEVEL define
// R16_SNorm textures are not supported by Unity on most platforms, strangely enough. So instead we use R32_SFloat and upload pre-normalized float data.
// Despite what the original FSR2 codebase says, this resource really isn't aliasable. Resetting this counter to 0 every frame breaks auto-exposure on MacOS Metal.
// Despite what the original FSR3 codebase says, this resource really isn't aliasable. Resetting this counter to 0 every frame breaks auto-exposure on MacOS Metal.
// This is a rather special case: it's an aliasable resource, but because we require a mipmap chain and bind specific mip levels per shader, we can't easily use temporary RTs for this.
Debug.LogError($"FSR2 render size is invalid: {_maxRenderSize.x}x{_maxRenderSize.y}. Please check your screen resolution and camera viewport parameters.");
Debug.LogError($"FSR3 Upscaler render size is invalid: {_maxRenderSize.x}x{_maxRenderSize.y}. Please check your screen resolution and camera viewport parameters.");
enabled=false;
}
@ -86,7 +86,7 @@ namespace FidelityFX
{
varscaledRenderSize=GetScaledRenderSize();
// Perform custom jittering of the camera's projection matrix according to FSR2's recipe
// Perform custom jittering of the camera's projection matrix according to FSR3's recipe
Debug.LogError($"FSR2 render size is invalid: {_maxRenderSize.x}x{_maxRenderSize.y}. Please check your screen resolution and camera viewport parameters.");
Debug.LogError($"FSR3 Upscaler render size is invalid: {_maxRenderSize.x}x{_maxRenderSize.y}. Please check your screen resolution and camera viewport parameters.");
/// Small helper script to be used in conjunction with the Fsr2ImageEffect script.
/// The FSR2 image effect needs to be the last effect in the post-processing chain but for render scaling to work properly, it also needs to be the first to execute OnPreCull.
/// The FSR3 Upscaler image effect needs to be the last effect in the post-processing chain but for render scaling to work properly, it also needs to be the first to execute OnPreCull.
/// Unfortunately altering the script execution order does not affect the order in which OnPreCull is executed. Only the order of scripts on the same game object matters.
///
/// When combining FSR2 upscaling with other post-processing effects (most notably Unity's Post-Processing Stack V2),
/// When combining FSR3 upscaling with other post-processing effects (most notably Unity's Post-Processing Stack V2),
/// this script should be added to the same camera and moved up above any other scripts that have an OnPreCull method.