diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Runtime/Asr.cs b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Runtime/Asr.cs index 158c196..88d441e 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Runtime/Asr.cs +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Runtime/Asr.cs @@ -33,7 +33,7 @@ namespace ArmASR /// /// Creates a new ASR context with standard parameters that are appropriate for the current platform. /// - public static AsrContext CreateContext(Vector2Int displaySize, Vector2Int maxRenderSize, AsrShaders shaders, InitializationFlags flags = 0) + public static AsrContext CreateContext(Variant variant, Vector2Int displaySize, Vector2Int maxRenderSize, AsrShaders shaders, InitializationFlags flags = 0) { if (SystemInfo.usesReversedZBuffer) flags |= InitializationFlags.EnableDepthInverted; @@ -49,6 +49,7 @@ namespace ArmASR var contextDescription = new ContextDescription { Flags = flags, + Variant = variant, DisplaySize = displaySize, MaxRenderSize = maxRenderSize, Shaders = shaders, @@ -172,6 +173,13 @@ namespace ArmASR UnityEngine.Object.Destroy(obj); #endif } + + public enum Variant + { + Quality, // Maintains the same image quality as the original FSR2. + Balanced, // Gives a significant improvement in both bandwidth savings and performance uplift while maintaining close image quality to the 'quality' preset. + Performance, // A more aggressive preset that will give you the highest performance with some quality sacrifices. + } public enum QualityMode { @@ -203,6 +211,7 @@ namespace ArmASR public struct ContextDescription { public InitializationFlags Flags; + public Variant Variant; public Vector2Int MaxRenderSize; public Vector2Int DisplaySize; public AsrShaders Shaders; diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Runtime/AsrPass.cs b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Runtime/AsrPass.cs index 2070b61..d22b383 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Runtime/AsrPass.cs +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Runtime/AsrPass.cs @@ -263,12 +263,18 @@ namespace ArmASR commandBuffer.SetGlobalTexture(AsrShaderIDs.SrvAutoExposure, Resources.AutoExposure); commandBuffer.SetGlobalTexture(AsrShaderIDs.SrvLumaHistory, Resources.LumaHistory[frameIndex ^ 1]); - // TODO: these need to vary depending on the ASR preset used (below is for Quality preset) - _mrt[0] = Resources.InternalUpscaled[frameIndex]; // TODO: ColorAndWeight - _mrt[1] = Resources.LockStatus[frameIndex]; - _mrt[2] = Resources.LumaHistory[frameIndex]; - _mrt[3] = dispatchParams.EnableSharpening ? BuiltinRenderTextureType.None : dispatchParams.Output.RenderTarget; - + if (ContextDescription.Variant == Asr.Variant.Quality) + { + _mrt[0] = Resources.InternalUpscaled[frameIndex]; // TODO: ColorAndWeight + _mrt[1] = Resources.LockStatus[frameIndex]; + _mrt[2] = Resources.LumaHistory[frameIndex]; + _mrt[3] = dispatchParams.EnableSharpening ? BuiltinRenderTextureType.None : dispatchParams.Output.RenderTarget; + } + else + { + // TODO: UpscaledColor, TemporalReactive, LockStatus, Color + } + FragmentProperties.SetConstantBuffer(AsrShaderIDs.CbFsr2, Constants, 0, Constants.stride); BlitFragment(commandBuffer, _mrt); }