diff --git a/Runtime/FSR2/Fsr2.cs b/Runtime/FSR2/Fsr2.cs index 4632b96..78eb67a 100644 --- a/Runtime/FSR2/Fsr2.cs +++ b/Runtime/FSR2/Fsr2.cs @@ -130,7 +130,7 @@ namespace FidelityFX.FSR2 #if !UNITY_2021_1_OR_NEWER internal static void SetBufferData(this CommandBuffer commandBuffer, ComputeBuffer computeBuffer, Array data) { - commandBuffer.SetComputeBufferData(computeBuffer, data); + computeBuffer.SetData(data); } #endif @@ -194,15 +194,6 @@ namespace FidelityFX.FSR2 public float CameraFar; public float CameraFovAngleVertical; public float ViewSpaceToMetersFactor; - public bool UseTextureArrays; // Enable texture array bindings, primarily used for HDRP and XR - - // EXPERIMENTAL reactive mask generation parameters - public bool EnableAutoReactive; - public ResourceView ColorOpaqueOnly; - public float AutoTcThreshold = 0.05f; - public float AutoTcScale = 1.0f; - public float AutoReactiveScale = 5.0f; - public float AutoReactiveMax = 0.9f; } /// diff --git a/Runtime/FSR2/Fsr2Context.cs b/Runtime/FSR2/Fsr2Context.cs index 38d380b..1dcaa7d 100644 --- a/Runtime/FSR2/Fsr2Context.cs +++ b/Runtime/FSR2/Fsr2Context.cs @@ -45,7 +45,6 @@ namespace FidelityFX.FSR2 private Fsr2Pass _accumulatePass; private Fsr2Pass _sharpenPass; private Fsr2Pass _generateReactivePass; - private Fsr2Pass _tcrAutogeneratePass; private readonly Fsr2Resources _resources = new Fsr2Resources(); @@ -65,10 +64,6 @@ namespace FidelityFX.FSR2 private readonly Fsr2.GenerateReactiveConstants[] _generateReactiveConstantsArray = { new Fsr2.GenerateReactiveConstants() }; private ref Fsr2.GenerateReactiveConstants GenReactiveConsts => ref _generateReactiveConstantsArray[0]; - private ComputeBuffer _tcrAutogenerateConstantsBuffer; - private readonly Fsr2.GenerateReactiveConstants2[] _tcrAutogenerateConstantsArray = { new Fsr2.GenerateReactiveConstants2() }; - private ref Fsr2.GenerateReactiveConstants2 TcrAutoGenConsts => ref _tcrAutogenerateConstantsArray[0]; - private bool _firstExecution; private Vector2 _previousJitterOffset; private int _resourceFrameIndex; @@ -82,7 +77,6 @@ namespace FidelityFX.FSR2 _spdConstantsBuffer = CreateConstantBuffer(); _rcasConstantsBuffer = CreateConstantBuffer(); _generateReactiveConstantsBuffer = CreateConstantBuffer(); - _tcrAutogenerateConstantsBuffer = CreateConstantBuffer(); // Set defaults _firstExecution = true; @@ -103,12 +97,10 @@ namespace FidelityFX.FSR2 _accumulatePass = new Fsr2AccumulatePass(_contextDescription, _resources, _upscalerConstantsBuffer); _sharpenPass = new Fsr2SharpenPass(_contextDescription, _resources, _upscalerConstantsBuffer, _rcasConstantsBuffer); _generateReactivePass = new Fsr2GenerateReactivePass(_contextDescription, _resources, _generateReactiveConstantsBuffer); - _tcrAutogeneratePass = new Fsr2TcrAutogeneratePass(_contextDescription, _resources, _upscalerConstantsBuffer, _tcrAutogenerateConstantsBuffer); } public void Destroy() { - DestroyPass(ref _tcrAutogeneratePass); DestroyPass(ref _generateReactivePass); DestroyPass(ref _sharpenPass); DestroyPass(ref _accumulatePass); @@ -119,7 +111,6 @@ namespace FidelityFX.FSR2 _resources.Destroy(); - DestroyConstantBuffer(ref _tcrAutogenerateConstantsBuffer); DestroyConstantBuffer(ref _generateReactiveConstantsBuffer); DestroyConstantBuffer(ref _rcasConstantsBuffer); DestroyConstantBuffer(ref _spdConstantsBuffer); @@ -146,9 +137,6 @@ namespace FidelityFX.FSR2 DebugCheckDispatch(dispatchParams); } - if (dispatchParams.UseTextureArrays) - commandBuffer.EnableShaderKeyword("UNITY_FSR_TEXTURE2D_X_ARRAY"); - if (_firstExecution) { commandBuffer.SetRenderTarget(_resources.LockStatus[0]); @@ -166,24 +154,6 @@ namespace FidelityFX.FSR2 dispatchParams.Exposure = new ResourceView(_resources.AutoExposure); else if (!dispatchParams.Exposure.IsValid) dispatchParams.Exposure = new ResourceView(_resources.DefaultExposure); - - if (dispatchParams.EnableAutoReactive) - { - // Create the auto-TCR resources only when we need them - if (_resources.AutoReactive == null) - _resources.CreateTcrAutogenResources(_contextDescription); - - if (resetAccumulation) - { - RenderTargetIdentifier opaqueOnly = dispatchParams.ColorOpaqueOnly.IsValid ? dispatchParams.ColorOpaqueOnly.RenderTarget : Fsr2ShaderIDs.SrvOpaqueOnly; - commandBuffer.Blit(_resources.PrevPreAlpha[frameIndex ^ 1], opaqueOnly); - } - } - else if (_resources.AutoReactive != null) - { - // Destroy the auto-TCR resources if we don't use the feature - _resources.DestroyTcrAutogenResources(); - } if (!dispatchParams.Reactive.IsValid) dispatchParams.Reactive = new ResourceView(_resources.DefaultReactive); if (!dispatchParams.TransparencyAndComposition.IsValid) dispatchParams.TransparencyAndComposition = new ResourceView(_resources.DefaultReactive); @@ -221,7 +191,7 @@ namespace FidelityFX.FSR2 // FSR3: need to clear here since we need the content of this surface for frame interpolation, so clearing in the lock pass is not an option bool depthInverted = (_contextDescription.Flags & Fsr2.InitializationFlags.EnableDepthInverted) == Fsr2.InitializationFlags.EnableDepthInverted; - commandBuffer.SetRenderTarget(Fsr2ShaderIDs.UavReconstructedPrevNearestDepth); + commandBuffer.SetRenderTarget(_resources.ReconstructedPrevNearestDepth); commandBuffer.ClearRenderTarget(false, true, depthInverted ? Color.clear : Color.white); // Auto exposure @@ -230,14 +200,9 @@ namespace FidelityFX.FSR2 // Initialize constant buffers data commandBuffer.SetBufferData(_upscalerConstantsBuffer, _upscalerConstantsArray); commandBuffer.SetBufferData(_spdConstantsBuffer, _spdConstantsArray); - - // Auto reactive - if (dispatchParams.EnableAutoReactive) - { - GenerateTransparencyCompositionReactive(dispatchParams, commandBuffer, frameIndex); - dispatchParams.Reactive = new ResourceView(_resources.AutoReactive); - dispatchParams.TransparencyAndComposition = new ResourceView(_resources.AutoComposition); - } + + commandBuffer.SetGlobalConstantBuffer(_upscalerConstantsBuffer, Fsr2ShaderIDs.CbFsr2, 0, Marshal.SizeOf()); + commandBuffer.SetGlobalConstantBuffer(_spdConstantsBuffer, Fsr2ShaderIDs.CbSpd, 0, Marshal.SizeOf()); // Compute luminance pyramid _computeLuminancePyramidPass.ScheduleDispatch(commandBuffer, dispatchParams, frameIndex, dispatchThreadGroupCount.x, dispatchThreadGroupCount.y); @@ -260,6 +225,8 @@ namespace FidelityFX.FSR2 SetupRcasConstants(dispatchParams); commandBuffer.SetBufferData(_rcasConstantsBuffer, _rcasConstantsArray); + commandBuffer.SetGlobalConstantBuffer(_rcasConstantsBuffer, Fsr2ShaderIDs.CbRcas, 0, Marshal.SizeOf()); + // Dispatch RCAS const int threadGroupWorkRegionDimRcas = 16; int threadGroupsX = (Screen.width + threadGroupWorkRegionDimRcas - 1) / threadGroupWorkRegionDimRcas; @@ -270,8 +237,6 @@ namespace FidelityFX.FSR2 _resourceFrameIndex = (_resourceFrameIndex + 1) % MaxQueuedFrames; Fsr2Resources.DestroyAliasableResources(commandBuffer); - - commandBuffer.DisableShaderKeyword("UNITY_FSR_TEXTURE2D_X_ARRAY"); } public void GenerateReactiveMask(Fsr2.GenerateReactiveDescription dispatchParams) @@ -293,22 +258,9 @@ namespace FidelityFX.FSR2 GenReactiveConsts.flags = (uint)dispatchParams.Flags; commandBuffer.SetBufferData(_generateReactiveConstantsBuffer, _generateReactiveConstantsArray); - ((Fsr2GenerateReactivePass)_generateReactivePass).ScheduleDispatch(commandBuffer, dispatchParams, dispatchSrcX, dispatchSrcY); - } - - private void GenerateTransparencyCompositionReactive(Fsr2.DispatchDescription dispatchParams, CommandBuffer commandBuffer, int frameIndex) - { - const int threadGroupWorkRegionDim = 8; - int dispatchSrcX = (dispatchParams.RenderSize.x + (threadGroupWorkRegionDim - 1)) / threadGroupWorkRegionDim; - int dispatchSrcY = (dispatchParams.RenderSize.y + (threadGroupWorkRegionDim - 1)) / threadGroupWorkRegionDim; - - TcrAutoGenConsts.autoTcThreshold = dispatchParams.AutoTcThreshold; - TcrAutoGenConsts.autoTcScale = dispatchParams.AutoTcScale; - TcrAutoGenConsts.autoReactiveScale = dispatchParams.AutoReactiveScale; - TcrAutoGenConsts.autoReactiveMax = dispatchParams.AutoReactiveMax; - commandBuffer.SetBufferData(_tcrAutogenerateConstantsBuffer, _tcrAutogenerateConstantsArray); + commandBuffer.SetGlobalConstantBuffer(_generateReactiveConstantsBuffer, Fsr2ShaderIDs.CbGenReactive, 0, Marshal.SizeOf()); - _tcrAutogeneratePass.ScheduleDispatch(commandBuffer, dispatchParams, frameIndex, dispatchSrcX, dispatchSrcY); + ((Fsr2GenerateReactivePass)_generateReactivePass).ScheduleDispatch(commandBuffer, dispatchParams, dispatchSrcX, dispatchSrcY); } private void SetupConstants(Fsr2.DispatchDescription dispatchParams, bool resetAccumulation) diff --git a/Runtime/FSR2/Fsr2Pass.cs b/Runtime/FSR2/Fsr2Pass.cs index bda5092..228752a 100644 --- a/Runtime/FSR2/Fsr2Pass.cs +++ b/Runtime/FSR2/Fsr2Pass.cs @@ -42,8 +42,6 @@ namespace FidelityFX.FSR2 protected ComputeShader ComputeShader; protected int KernelIndex; - protected CustomSampler Sampler; - protected Fsr2Pass(Fsr2.ContextDescription contextDescription, Fsr2Resources resources, ComputeBuffer constants) { ContextDescription = contextDescription; @@ -57,9 +55,7 @@ namespace FidelityFX.FSR2 public void ScheduleDispatch(CommandBuffer commandBuffer, Fsr2.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) { - commandBuffer.BeginSample(Sampler); DoScheduleDispatch(commandBuffer, dispatchParams, frameIndex, dispatchX, dispatchY); - commandBuffer.EndSample(Sampler); } protected abstract void DoScheduleDispatch(CommandBuffer commandBuffer, Fsr2.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY); @@ -78,23 +74,6 @@ namespace FidelityFX.FSR2 ComputeShader = shader; KernelIndex = ComputeShader.FindKernel("CS"); - Sampler = CustomSampler.Create(passName); - - bool useLut = false; -#if UNITY_2022_1_OR_NEWER // This will also work in 2020.3.43+ and 2021.3.14+ - if (SystemInfo.computeSubGroupSize == 64) - { - useLut = true; - } -#endif - - // This matches the permutation rules from the CreatePipeline* functions - if ((flags & Fsr2.InitializationFlags.EnableHighDynamicRange) != 0) ComputeShader.EnableKeyword("FFX_FSR2_OPTION_HDR_COLOR_INPUT"); - if ((flags & Fsr2.InitializationFlags.EnableDisplayResolutionMotionVectors) == 0) ComputeShader.EnableKeyword("FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS"); - if ((flags & Fsr2.InitializationFlags.EnableMotionVectorsJitterCancellation) != 0) ComputeShader.EnableKeyword("FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS"); - if ((flags & Fsr2.InitializationFlags.EnableDepthInverted) != 0) ComputeShader.EnableKeyword("FFX_FSR2_OPTION_INVERTED_DEPTH"); - if (useLut) ComputeShader.EnableKeyword("FFX_FSR2_OPTION_REPROJECT_USE_LANCZOS_TYPE"); - if ((flags & Fsr2.InitializationFlags.EnableFP16Usage) != 0) ComputeShader.EnableKeyword("FFX_HALF"); } } @@ -120,9 +99,6 @@ namespace FidelityFX.FSR2 commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavExposureMip5, Resources.SceneLuminance, 5); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavAutoExposure, Resources.AutoExposure); - commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr2ShaderIDs.CbFsr2, Constants, 0, Marshal.SizeOf()); - commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr2ShaderIDs.CbSpd, _spdConstants, 0, Marshal.SizeOf()); - commandBuffer.DispatchCompute(ComputeShader, KernelIndex, dispatchX, dispatchY, 1); } } @@ -147,9 +123,10 @@ namespace FidelityFX.FSR2 commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvInputMotionVectors, motionVectors.RenderTarget, motionVectors.MipLevel, motionVectors.SubElement); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvInputExposure, exposure.RenderTarget, exposure.MipLevel, exposure.SubElement); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavReconstructedPrevNearestDepth, Resources.ReconstructedPrevNearestDepth); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavDilatedMotionVectors, Resources.DilatedMotionVectors[frameIndex]); - - commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr2ShaderIDs.CbFsr2, Constants, 0, Marshal.SizeOf()); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavDilatedDepth, Resources.DilatedDepth); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavLockInputLuma, Resources.LockInputLuma); commandBuffer.DispatchCompute(ComputeShader, KernelIndex, dispatchX, dispatchY, 1); } @@ -179,12 +156,13 @@ namespace FidelityFX.FSR2 commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvReactiveMask, reactive.RenderTarget, reactive.MipLevel, reactive.SubElement); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvTransparencyAndCompositionMask, tac.RenderTarget, tac.MipLevel, tac.SubElement); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvReconstructedPrevNearestDepth, Fsr2ShaderIDs.UavReconstructedPrevNearestDepth); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvReconstructedPrevNearestDepth, Resources.ReconstructedPrevNearestDepth); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvDilatedMotionVectors, Resources.DilatedMotionVectors[frameIndex]); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvDilatedDepth, Fsr2ShaderIDs.UavDilatedDepth); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvDilatedDepth, Resources.DilatedDepth); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvPrevDilatedMotionVectors, Resources.DilatedMotionVectors[frameIndex ^ 1]); - commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr2ShaderIDs.CbFsr2, Constants, 0, Marshal.SizeOf()); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavDilatedReactiveMasks, Resources.DilatedReactiveMasks); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavPreparedInputColor, Resources.PreparedInputColor); commandBuffer.DispatchCompute(ComputeShader, KernelIndex, dispatchX, dispatchY, 1); } @@ -200,8 +178,10 @@ namespace FidelityFX.FSR2 protected override void DoScheduleDispatch(CommandBuffer commandBuffer, Fsr2.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) { - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvLockInputLuma, Fsr2ShaderIDs.UavLockInputLuma); - commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr2ShaderIDs.CbFsr2, Constants, 0, Marshal.SizeOf()); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvLockInputLuma, Resources.LockInputLuma); + + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavNewLocks, Resources.NewLocks); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavReconstructedPrevNearestDepth, Resources.ReconstructedPrevNearestDepth); commandBuffer.DispatchCompute(ComputeShader, KernelIndex, dispatchX, dispatchY, 1); } @@ -251,10 +231,10 @@ namespace FidelityFX.FSR2 ref var exposure = ref dispatchParams.Exposure; commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvInputExposure, exposure.RenderTarget, exposure.MipLevel, exposure.SubElement); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvDilatedReactiveMasks, Fsr2ShaderIDs.UavDilatedReactiveMasks); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvDilatedReactiveMasks, Resources.DilatedReactiveMasks); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvInternalUpscaled, Resources.InternalUpscaled[frameIndex ^ 1]); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvLockStatus, Resources.LockStatus[frameIndex ^ 1]); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvPreparedInputColor, Fsr2ShaderIDs.UavPreparedInputColor); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvPreparedInputColor, Resources.PreparedInputColor); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvLanczosLut, Resources.LanczosLut); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvUpscaleMaximumBiasLut, Resources.MaximumBiasLut); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvSceneLuminanceMips, Resources.SceneLuminance); @@ -264,12 +244,11 @@ namespace FidelityFX.FSR2 commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavInternalUpscaled, Resources.InternalUpscaled[frameIndex]); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavLockStatus, Resources.LockStatus[frameIndex]); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavLumaHistory, Resources.LumaHistory[frameIndex]); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavNewLocks, Resources.NewLocks); ref var output = ref dispatchParams.Output; commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavUpscaledOutput, output.RenderTarget, output.MipLevel, output.SubElement); - commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr2ShaderIDs.CbFsr2, Constants, 0, Marshal.SizeOf()); - commandBuffer.DispatchCompute(ComputeShader, KernelIndex, dispatchX, dispatchY, 1); } } @@ -295,9 +274,6 @@ namespace FidelityFX.FSR2 ref var output = ref dispatchParams.Output; commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavUpscaledOutput, output.RenderTarget, output.MipLevel, output.SubElement); - commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr2ShaderIDs.CbFsr2, Constants, 0, Marshal.SizeOf()); - commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr2ShaderIDs.CbRcas, _rcasConstants, 0, Marshal.SizeOf()); - commandBuffer.DispatchCompute(ComputeShader, KernelIndex, dispatchX, dispatchY, 1); } } @@ -320,8 +296,6 @@ namespace FidelityFX.FSR2 public void ScheduleDispatch(CommandBuffer commandBuffer, Fsr2.GenerateReactiveDescription dispatchParams, int dispatchX, int dispatchY) { - commandBuffer.BeginSample(Sampler); - ref var opaqueOnly = ref dispatchParams.ColorOpaqueOnly; ref var color = ref dispatchParams.ColorPreUpscale; ref var reactive = ref dispatchParams.OutReactive; @@ -329,51 +303,7 @@ namespace FidelityFX.FSR2 commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvOpaqueOnly, opaqueOnly.RenderTarget, opaqueOnly.MipLevel, opaqueOnly.SubElement); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvInputColor, color.RenderTarget, color.MipLevel, color.SubElement); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavAutoReactive, reactive.RenderTarget, reactive.MipLevel, reactive.SubElement); - - commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr2ShaderIDs.CbGenReactive, _generateReactiveConstants, 0, Marshal.SizeOf()); - - commandBuffer.DispatchCompute(ComputeShader, KernelIndex, dispatchX, dispatchY, 1); - - commandBuffer.EndSample(Sampler); - } - } - internal class Fsr2TcrAutogeneratePass : Fsr2Pass - { - private readonly ComputeBuffer _tcrAutogenerateConstants; - - public Fsr2TcrAutogeneratePass(Fsr2.ContextDescription contextDescription, Fsr2Resources resources, ComputeBuffer constants, ComputeBuffer tcrAutogenerateConstants) - : base(contextDescription, resources, constants) - { - _tcrAutogenerateConstants = tcrAutogenerateConstants; - - InitComputeShader("Auto-Generate Transparency & Composition Mask", contextDescription.Shaders.tcrAutoGenPass); - } - - protected override void DoScheduleDispatch(CommandBuffer commandBuffer, Fsr2.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) - { - ref var color = ref dispatchParams.Color; - ref var motionVectors = ref dispatchParams.MotionVectors; - ref var opaqueOnly = ref dispatchParams.ColorOpaqueOnly; - ref var reactive = ref dispatchParams.Reactive; - ref var tac = ref dispatchParams.TransparencyAndComposition; - - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvOpaqueOnly, opaqueOnly.RenderTarget, opaqueOnly.MipLevel, opaqueOnly.SubElement); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvInputColor, color.RenderTarget, color.MipLevel, color.SubElement); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvInputMotionVectors, motionVectors.RenderTarget, motionVectors.MipLevel, motionVectors.SubElement); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvPrevColorPreAlpha, Resources.PrevPreAlpha[frameIndex ^ 1]); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvPrevColorPostAlpha, Resources.PrevPostAlpha[frameIndex ^ 1]); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvReactiveMask, reactive.RenderTarget, reactive.MipLevel, reactive.SubElement); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvTransparencyAndCompositionMask, tac.RenderTarget, tac.MipLevel, tac.SubElement); - - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavAutoReactive, Resources.AutoReactive); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavAutoComposition, Resources.AutoComposition); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavPrevColorPreAlpha, Resources.PrevPreAlpha[frameIndex]); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavPrevColorPostAlpha, Resources.PrevPostAlpha[frameIndex]); - - commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr2ShaderIDs.CbFsr2, Constants, 0, Marshal.SizeOf()); - commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr2ShaderIDs.CbGenReactive, _tcrAutogenerateConstants, 0, Marshal.SizeOf()); - commandBuffer.DispatchCompute(ComputeShader, KernelIndex, dispatchX, dispatchY, 1); } } diff --git a/Runtime/FSR2/Fsr2Resources.cs b/Runtime/FSR2/Fsr2Resources.cs index 4c1c50e..b75d40c 100644 --- a/Runtime/FSR2/Fsr2Resources.cs +++ b/Runtime/FSR2/Fsr2Resources.cs @@ -38,14 +38,17 @@ namespace FidelityFX.FSR2 public RenderTexture SpdAtomicCounter; public RenderTexture AutoExposure; public RenderTexture SceneLuminance; - public RenderTexture AutoReactive; - public RenderTexture AutoComposition; public readonly RenderTexture[] DilatedMotionVectors = new RenderTexture[2]; public readonly RenderTexture[] LockStatus = new RenderTexture[2]; public readonly RenderTexture[] InternalUpscaled = new RenderTexture[2]; public readonly RenderTexture[] LumaHistory = new RenderTexture[2]; - public readonly RenderTexture[] PrevPreAlpha = new RenderTexture[2]; - public readonly RenderTexture[] PrevPostAlpha = new RenderTexture[2]; + + public RenderTexture ReconstructedPrevNearestDepth; + public RenderTexture DilatedDepth; + public RenderTexture LockInputLuma; + public RenderTexture DilatedReactiveMasks; + public RenderTexture PreparedInputColor; + public RenderTexture NewLocks; public void Create(Fsr2.ContextDescription contextDescription) { @@ -113,60 +116,40 @@ namespace FidelityFX.FSR2 // Resources FSR2_LumaHistory1/2: FFX_RESOURCE_USAGE_RENDERTARGET | FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R8G8B8A8_UNORM, FFX_RESOURCE_FLAGS_NONE CreateDoubleBufferedResource(LumaHistory, "FSR2_LumaHistory", contextDescription.DisplaySize, GraphicsFormat.R8G8B8A8_UNorm); - } - - public void CreateTcrAutogenResources(Fsr2.ContextDescription contextDescription) - { - // Resource FSR2_AutoReactive: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R8_UNORM, FFX_RESOURCE_FLAGS_NONE - AutoReactive = new RenderTexture(contextDescription.MaxRenderSize.x, contextDescription.MaxRenderSize.y, 0, GraphicsFormat.R8_UNorm) { name = "FSR2_AutoReactive", enableRandomWrite = true }; - AutoReactive.Create(); - - // Resource FSR2_AutoComposition: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R8_UNORM, FFX_RESOURCE_FLAGS_NONE - AutoComposition = new RenderTexture(contextDescription.MaxRenderSize.x, contextDescription.MaxRenderSize.y, 0, GraphicsFormat.R8_UNorm) { name = "FSR2_AutoComposition", enableRandomWrite = true }; - AutoComposition.Create(); - - // Resources FSR2_PrevPreAlpha0/1: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R11G11B10_FLOAT, FFX_RESOURCE_FLAGS_NONE - CreateDoubleBufferedResource(PrevPreAlpha, "FSR2_PrevPreAlpha", contextDescription.MaxRenderSize, GraphicsFormat.B10G11R11_UFloatPack32); - - // Resources FSR2_PrevPostAlpha0/1: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R11G11B10_FLOAT, FFX_RESOURCE_FLAGS_NONE - CreateDoubleBufferedResource(PrevPostAlpha, "FSR2_PrevPostAlpha", contextDescription.MaxRenderSize, GraphicsFormat.B10G11R11_UFloatPack32); - } - - // Set up shared aliasable resources, i.e. temporary render textures - // These do not need to persist between frames, but they do need to be available between passes - public static void CreateAliasableResources(CommandBuffer commandBuffer, Fsr2.ContextDescription contextDescription, Fsr2.DispatchDescription dispatchParams) - { - Vector2Int displaySize = contextDescription.DisplaySize; - Vector2Int maxRenderSize = contextDescription.MaxRenderSize; - + // FSR2_ReconstructedPrevNearestDepth: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R32_UINT, FFX_RESOURCE_FLAGS_ALIASABLE - commandBuffer.GetTemporaryRT(Fsr2ShaderIDs.UavReconstructedPrevNearestDepth, maxRenderSize.x, maxRenderSize.y, 0, default, GraphicsFormat.R32_UInt, 1, true); + CreateResource(out ReconstructedPrevNearestDepth, "FSR2_ReconstructedPrevNearestDepth", contextDescription.MaxRenderSize, GraphicsFormat.R32_UInt); // FSR2_DilatedDepth: FFX_RESOURCE_USAGE_RENDERTARGET | FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R32_FLOAT, FFX_RESOURCE_FLAGS_ALIASABLE - commandBuffer.GetTemporaryRT(Fsr2ShaderIDs.UavDilatedDepth, maxRenderSize.x, maxRenderSize.y, 0, default, GraphicsFormat.R32_SFloat, 1, true); + CreateResource(out DilatedDepth, "FSR2_DilatedDepth", contextDescription.MaxRenderSize, GraphicsFormat.R32_SFloat); // FSR2_LockInputLuma: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R16_FLOAT, FFX_RESOURCE_FLAGS_ALIASABLE - commandBuffer.GetTemporaryRT(Fsr2ShaderIDs.UavLockInputLuma, maxRenderSize.x, maxRenderSize.y, 0, default, GraphicsFormat.R16_SFloat, 1, true); + CreateResource(out LockInputLuma, "FSR2_LockInputLuma", contextDescription.MaxRenderSize, GraphicsFormat.R16_SFloat); // FSR2_DilatedReactiveMasks: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R8G8_UNORM, FFX_RESOURCE_FLAGS_ALIASABLE - commandBuffer.GetTemporaryRT(Fsr2ShaderIDs.UavDilatedReactiveMasks, maxRenderSize.x, maxRenderSize.y, 0, default, GraphicsFormat.R8G8_UNorm, 1, true); + CreateResource(out DilatedReactiveMasks, "FSR2_DilatedReactiveMasks", contextDescription.MaxRenderSize, GraphicsFormat.R8G8_UNorm); // FSR2_PreparedInputColor: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R16G16B16A16_FLOAT, FFX_RESOURCE_FLAGS_ALIASABLE - commandBuffer.GetTemporaryRT(Fsr2ShaderIDs.UavPreparedInputColor, maxRenderSize.x, maxRenderSize.y, 0, default, GraphicsFormat.R16G16B16A16_SFloat, 1, true); + CreateResource(out PreparedInputColor, "FSR2_PreparedInputColor", contextDescription.MaxRenderSize, GraphicsFormat.R16G16B16A16_SFloat); // FSR2_NewLocks: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R8_UNORM, FFX_RESOURCE_FLAGS_ALIASABLE - commandBuffer.GetTemporaryRT(Fsr2ShaderIDs.UavNewLocks, displaySize.x, displaySize.y, 0, default, GraphicsFormat.R8_UNorm, 1, true); + CreateResource(out NewLocks, "FSR2_NewLocks", contextDescription.DisplaySize, GraphicsFormat.R8_UNorm); + } + + private void CreateResource(out RenderTexture rt, string name, Vector2Int size, GraphicsFormat format) + { + rt = new RenderTexture(size.x, size.y, 0, format) { name = name, enableRandomWrite = true }; + rt.Create(); + } + + // Set up shared aliasable resources, i.e. temporary render textures + // These do not need to persist between frames, but they do need to be available between passes + public static void CreateAliasableResources(CommandBuffer commandBuffer, Fsr2.ContextDescription contextDescription, Fsr2.DispatchDescription dispatchParams) + { } public static void DestroyAliasableResources(CommandBuffer commandBuffer) { - // Release all of the aliasable resources used this frame - commandBuffer.ReleaseTemporaryRT(Fsr2ShaderIDs.UavReconstructedPrevNearestDepth); - commandBuffer.ReleaseTemporaryRT(Fsr2ShaderIDs.UavDilatedDepth); - commandBuffer.ReleaseTemporaryRT(Fsr2ShaderIDs.UavLockInputLuma); - commandBuffer.ReleaseTemporaryRT(Fsr2ShaderIDs.UavDilatedReactiveMasks); - commandBuffer.ReleaseTemporaryRT(Fsr2ShaderIDs.UavPreparedInputColor); - commandBuffer.ReleaseTemporaryRT(Fsr2ShaderIDs.UavNewLocks); } private static void CreateDoubleBufferedResource(RenderTexture[] resource, string name, Vector2Int size, GraphicsFormat format) @@ -180,8 +163,6 @@ namespace FidelityFX.FSR2 public void Destroy() { - DestroyTcrAutogenResources(); - DestroyResource(LumaHistory); DestroyResource(InternalUpscaled); DestroyResource(LockStatus); @@ -192,14 +173,13 @@ namespace FidelityFX.FSR2 DestroyResource(ref DefaultExposure); DestroyResource(ref MaximumBiasLut); DestroyResource(ref LanczosLut); - } - - public void DestroyTcrAutogenResources() - { - DestroyResource(PrevPostAlpha); - DestroyResource(PrevPreAlpha); - DestroyResource(ref AutoComposition); - DestroyResource(ref AutoReactive); + + DestroyResource(ref ReconstructedPrevNearestDepth); + DestroyResource(ref DilatedDepth); + DestroyResource(ref LockInputLuma); + DestroyResource(ref DilatedReactiveMasks); + DestroyResource(ref PreparedInputColor); + DestroyResource(ref NewLocks); } private static void DestroyResource(ref Texture2D resource) diff --git a/Runtime/FSR2/Fsr2ShaderIDs.cs b/Runtime/FSR2/Fsr2ShaderIDs.cs index 0adbf6b..8e406be 100644 --- a/Runtime/FSR2/Fsr2ShaderIDs.cs +++ b/Runtime/FSR2/Fsr2ShaderIDs.cs @@ -47,8 +47,6 @@ namespace FidelityFX.FSR2 public static readonly int SrvSceneLuminanceMips = Shader.PropertyToID("r_imgMips"); public static readonly int SrvUpscaleMaximumBiasLut = Shader.PropertyToID("r_upsample_maximum_bias_lut"); public static readonly int SrvDilatedReactiveMasks = Shader.PropertyToID("r_dilated_reactive_masks"); - public static readonly int SrvPrevColorPreAlpha = Shader.PropertyToID("r_input_prev_color_pre_alpha"); - public static readonly int SrvPrevColorPostAlpha = Shader.PropertyToID("r_input_prev_color_post_alpha"); // Unordered access views, i.e. random read/write bindings public static readonly int UavReconstructedPrevNearestDepth = Shader.PropertyToID("rw_reconstructed_previous_nearest_depth"); @@ -67,9 +65,6 @@ namespace FidelityFX.FSR2 public static readonly int UavAutoExposure = Shader.PropertyToID("rw_auto_exposure"); public static readonly int UavSpdAtomicCount = Shader.PropertyToID("rw_spd_global_atomic"); public static readonly int UavAutoReactive = Shader.PropertyToID("rw_output_autoreactive"); - public static readonly int UavAutoComposition = Shader.PropertyToID("rw_output_autocomposition"); - public static readonly int UavPrevColorPreAlpha = Shader.PropertyToID("rw_output_prev_color_pre_alpha"); - public static readonly int UavPrevColorPostAlpha = Shader.PropertyToID("rw_output_prev_color_post_alpha"); // Constant buffer bindings public static readonly int CbFsr2 = Shader.PropertyToID("cbFSR2"); diff --git a/Shaders/ffx_fsr2_accumulate_pass.compute b/Shaders/ffx_fsr2_accumulate_pass.compute index 63532d7..82e4520 100644 --- a/Shaders/ffx_fsr2_accumulate_pass.compute +++ b/Shaders/ffx_fsr2_accumulate_pass.compute @@ -20,15 +20,10 @@ #pragma kernel CS -#pragma multi_compile_local __ FFX_HALF -#pragma multi_compile_local __ FFX_FSR2_OPTION_REPROJECT_USE_LANCZOS_TYPE -#pragma multi_compile_local __ FFX_FSR2_OPTION_HDR_COLOR_INPUT -#pragma multi_compile_local __ FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS -#pragma multi_compile_local __ FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS -#pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH -#pragma multi_compile_local __ FFX_FSR2_OPTION_APPLY_SHARPENING - -#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY +#define FFX_FSR2_OPTION_HDR_COLOR_INPUT 1 +#define FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS 1 +#define FFX_FSR2_OPTION_INVERTED_DEPTH 1 +#define FFX_FSR2_OPTION_APPLY_SHARPENING 1 #include "ffx_fsr_unity_common.cginc" diff --git a/Shaders/ffx_fsr2_autogen_reactive_pass.compute b/Shaders/ffx_fsr2_autogen_reactive_pass.compute index 6bc2301..1990f10 100644 --- a/Shaders/ffx_fsr2_autogen_reactive_pass.compute +++ b/Shaders/ffx_fsr2_autogen_reactive_pass.compute @@ -20,12 +20,9 @@ #pragma kernel CS -#pragma multi_compile_local __ FFX_HALF -#pragma multi_compile_local __ FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS -#pragma multi_compile_local __ FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS -#pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH - -#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY +#define FFX_FSR2_OPTION_HDR_COLOR_INPUT 1 +#define FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS 1 +#define FFX_FSR2_OPTION_INVERTED_DEPTH 1 #include "ffx_fsr_unity_common.cginc" diff --git a/Shaders/ffx_fsr2_compute_luminance_pyramid_pass.compute b/Shaders/ffx_fsr2_compute_luminance_pyramid_pass.compute index 7058cc5..32ab4a8 100644 --- a/Shaders/ffx_fsr2_compute_luminance_pyramid_pass.compute +++ b/Shaders/ffx_fsr2_compute_luminance_pyramid_pass.compute @@ -20,12 +20,9 @@ #pragma kernel CS -#pragma multi_compile_local __ FFX_HALF -#pragma multi_compile_local __ FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS -#pragma multi_compile_local __ FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS -#pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH - -#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY +#define FFX_FSR2_OPTION_HDR_COLOR_INPUT 1 +#define FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS 1 +#define FFX_FSR2_OPTION_INVERTED_DEPTH 1 #include "ffx_fsr_unity_common.cginc" diff --git a/Shaders/ffx_fsr2_depth_clip_pass.compute b/Shaders/ffx_fsr2_depth_clip_pass.compute index 582ca6b..0919de8 100644 --- a/Shaders/ffx_fsr2_depth_clip_pass.compute +++ b/Shaders/ffx_fsr2_depth_clip_pass.compute @@ -20,12 +20,9 @@ #pragma kernel CS -#pragma multi_compile_local __ FFX_HALF -#pragma multi_compile_local __ FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS -#pragma multi_compile_local __ FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS -#pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH - -#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY +#define FFX_FSR2_OPTION_HDR_COLOR_INPUT 1 +#define FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS 1 +#define FFX_FSR2_OPTION_INVERTED_DEPTH 1 #include "ffx_fsr_unity_common.cginc" diff --git a/Shaders/ffx_fsr2_lock_pass.compute b/Shaders/ffx_fsr2_lock_pass.compute index fb12d2c..841bc99 100644 --- a/Shaders/ffx_fsr2_lock_pass.compute +++ b/Shaders/ffx_fsr2_lock_pass.compute @@ -20,12 +20,9 @@ #pragma kernel CS -#pragma multi_compile_local __ FFX_HALF -#pragma multi_compile_local __ FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS -#pragma multi_compile_local __ FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS -#pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH - -#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY +#define FFX_FSR2_OPTION_HDR_COLOR_INPUT 1 +#define FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS 1 +#define FFX_FSR2_OPTION_INVERTED_DEPTH 1 #include "ffx_fsr_unity_common.cginc" diff --git a/Shaders/ffx_fsr2_rcas_pass.compute b/Shaders/ffx_fsr2_rcas_pass.compute index e6ac7df..37cf800 100644 --- a/Shaders/ffx_fsr2_rcas_pass.compute +++ b/Shaders/ffx_fsr2_rcas_pass.compute @@ -20,11 +20,9 @@ #pragma kernel CS -#pragma multi_compile_local __ FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS -#pragma multi_compile_local __ FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS -#pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH - -#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY +#define FFX_FSR2_OPTION_HDR_COLOR_INPUT 1 +#define FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS 1 +#define FFX_FSR2_OPTION_INVERTED_DEPTH 1 #include "ffx_fsr_unity_common.cginc" diff --git a/Shaders/ffx_fsr2_reconstruct_previous_depth_pass.compute b/Shaders/ffx_fsr2_reconstruct_previous_depth_pass.compute index 12f2ec3..f42d0cb 100644 --- a/Shaders/ffx_fsr2_reconstruct_previous_depth_pass.compute +++ b/Shaders/ffx_fsr2_reconstruct_previous_depth_pass.compute @@ -20,13 +20,9 @@ #pragma kernel CS -#pragma multi_compile_local __ FFX_HALF -#pragma multi_compile_local __ FFX_FSR2_OPTION_HDR_COLOR_INPUT -#pragma multi_compile_local __ FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS -#pragma multi_compile_local __ FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS -#pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH - -#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY +#define FFX_FSR2_OPTION_HDR_COLOR_INPUT 1 +#define FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS 1 +#define FFX_FSR2_OPTION_INVERTED_DEPTH 1 #include "ffx_fsr_unity_common.cginc" diff --git a/Shaders/ffx_fsr2_tcr_autogen_pass.compute b/Shaders/ffx_fsr2_tcr_autogen_pass.compute index 5d2668a..34a0a31 100644 --- a/Shaders/ffx_fsr2_tcr_autogen_pass.compute +++ b/Shaders/ffx_fsr2_tcr_autogen_pass.compute @@ -20,12 +20,9 @@ #pragma kernel CS -#pragma multi_compile_local __ FFX_HALF -#pragma multi_compile_local __ FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS -#pragma multi_compile_local __ FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS -#pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH - -#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY +#define FFX_FSR2_OPTION_HDR_COLOR_INPUT 1 +#define FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS 1 +#define FFX_FSR2_OPTION_INVERTED_DEPTH 1 #include "ffx_fsr_unity_common.cginc"