diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Pipeline.cs b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Pipeline.cs index 7a3bd75..6e6b19f 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Pipeline.cs +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Pipeline.cs @@ -271,24 +271,37 @@ namespace FidelityFX internal class Fsr2AccumulatePipeline : Fsr2Pipeline { + private const string SharpeningKeyword = "FFX_FSR2_OPTION_APPLY_SHARPENING"; + // Workaround: Disable FP16 path for the accumulate pass on NVIDIA due to reduced occupancy and high VRAM throughput. protected override bool AllowFP16 => SystemInfo.graphicsDeviceVendorID != 0x10DE; +#if UNITY_2021_2_OR_NEWER private readonly LocalKeyword _sharpeningKeyword; +#endif public Fsr2AccumulatePipeline(Fsr2.ContextDescription contextDescription, Fsr2Resources resources, ComputeBuffer constants) : base(contextDescription, resources, constants) { LoadComputeShader("FSR2/ffx_fsr2_accumulate_pass"); - _sharpeningKeyword = new LocalKeyword(ComputeShader, "FFX_FSR2_OPTION_APPLY_SHARPENING"); +#if UNITY_2021_2_OR_NEWER + _sharpeningKeyword = new LocalKeyword(ComputeShader, SharpeningKeyword); +#endif } public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr2.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) { +#if UNITY_2021_2_OR_NEWER if (dispatchParams.EnableSharpening) commandBuffer.EnableKeyword(ComputeShader, _sharpeningKeyword); else commandBuffer.DisableKeyword(ComputeShader, _sharpeningKeyword); +#else + if (dispatchParams.EnableSharpening) + commandBuffer.EnableShaderKeyword(SharpeningKeyword); + else + commandBuffer.DisableShaderKeyword(SharpeningKeyword); +#endif if ((ContextDescription.Flags & Fsr2.InitializationFlags.EnableDisplayResolutionMotionVectors) == 0) commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvDilatedMotionVectors, Resources.DilatedMotionVectors[frameIndex]);