diff --git a/Assets/Scripts/Core/Fsr2.cs b/Assets/Scripts/Core/Fsr2.cs index 1ba8192..6469817 100644 --- a/Assets/Scripts/Core/Fsr2.cs +++ b/Assets/Scripts/Core/Fsr2.cs @@ -63,6 +63,8 @@ namespace FidelityFX { switch (qualityMode) { + case QualityMode.NativeAA: + return 1.0f; case QualityMode.UltraQuality: return 1.2f; case QualityMode.Quality: @@ -134,11 +136,12 @@ namespace FidelityFX public enum QualityMode { - UltraQuality = 0, - Quality = 1, - Balanced = 2, - Performance = 3, - UltraPerformance = 4, + NativeAA = 0, + UltraQuality = 1, // TODO: UltraQuality may become obsolete, and NativeAA can replace it at position 0 + Quality = 2, + Balanced = 3, + Performance = 4, + UltraPerformance = 5, } [Flags] diff --git a/Assets/Scripts/Core/Fsr2Pass.cs b/Assets/Scripts/Core/Fsr2Pass.cs index 23b8e6c..291865b 100644 --- a/Assets/Scripts/Core/Fsr2Pass.cs +++ b/Assets/Scripts/Core/Fsr2Pass.cs @@ -85,18 +85,18 @@ namespace FidelityFX bool supportedFP16 = ((flags & Fsr2.InitializationFlags.EnableFP16Usage) != 0 && AllowFP16); // This matches the permutation rules from the CreatePipeline* functions - if ((flags & Fsr2.InitializationFlags.EnableHighDynamicRange) != 0) shaderRef.EnableKeyword("FFX_FSR2_OPTION_HDR_COLOR_INPUT"); - if ((flags & Fsr2.InitializationFlags.EnableDisplayResolutionMotionVectors) == 0) shaderRef.EnableKeyword("FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS"); - if ((flags & Fsr2.InitializationFlags.EnableMotionVectorsJitterCancellation) != 0) shaderRef.EnableKeyword("FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS"); - if ((flags & Fsr2.InitializationFlags.EnableDepthInverted) != 0) shaderRef.EnableKeyword("FFX_FSR2_OPTION_INVERTED_DEPTH"); - if (useLut) shaderRef.EnableKeyword("FFX_FSR2_OPTION_REPROJECT_USE_LANCZOS_TYPE"); + if ((flags & Fsr2.InitializationFlags.EnableHighDynamicRange) != 0) shaderRef.EnableKeyword("FFX_FSR3UPSCALER_OPTION_HDR_COLOR_INPUT"); + if ((flags & Fsr2.InitializationFlags.EnableDisplayResolutionMotionVectors) == 0) shaderRef.EnableKeyword("FFX_FSR3UPSCALER_OPTION_LOW_RESOLUTION_MOTION_VECTORS"); + if ((flags & Fsr2.InitializationFlags.EnableMotionVectorsJitterCancellation) != 0) shaderRef.EnableKeyword("FFX_FSR3UPSCALER_OPTION_JITTERED_MOTION_VECTORS"); + if ((flags & Fsr2.InitializationFlags.EnableDepthInverted) != 0) shaderRef.EnableKeyword("FFX_FSR3UPSCALER_OPTION_INVERTED_DEPTH"); + if (useLut) shaderRef.EnableKeyword("FFX_FSR3UPSCALER_OPTION_REPROJECT_USE_LANCZOS_TYPE"); if (supportedFP16) shaderRef.EnableKeyword("FFX_HALF"); // Inform the shader which render pipeline we're currently using var pipeline = GraphicsSettings.currentRenderPipeline; if (pipeline != null && pipeline.GetType().Name.Contains("HDRenderPipeline")) { - shaderRef.EnableKeyword("UNITY_FSR2_HDRP"); + shaderRef.EnableKeyword("UNITY_FSR3UPSCALER_HDRP"); } } @@ -124,7 +124,7 @@ namespace FidelityFX { _spdConstants = spdConstants; - LoadComputeShader("FSR2/ffx_fsr2_compute_luminance_pyramid_pass"); + LoadComputeShader("FSR3/ffx_fsr3upscaler_compute_luminance_pyramid_pass"); } public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr2.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) @@ -149,7 +149,7 @@ namespace FidelityFX public Fsr2ReconstructPreviousDepthPass(Fsr2.ContextDescription contextDescription, Fsr2Resources resources, ComputeBuffer constants) : base(contextDescription, resources, constants) { - LoadComputeShader("FSR2/ffx_fsr2_reconstruct_previous_depth_pass"); + LoadComputeShader("FSR3/ffx_fsr3upscaler_reconstruct_previous_depth_pass"); } public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr2.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) @@ -177,7 +177,7 @@ namespace FidelityFX public Fsr2DepthClipPass(Fsr2.ContextDescription contextDescription, Fsr2Resources resources, ComputeBuffer constants) : base(contextDescription, resources, constants) { - LoadComputeShader("FSR2/ffx_fsr2_depth_clip_pass"); + LoadComputeShader("FSR3/ffx_fsr3upscaler_depth_clip_pass"); } public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr2.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) @@ -212,7 +212,7 @@ namespace FidelityFX public Fsr2LockPass(Fsr2.ContextDescription contextDescription, Fsr2Resources resources, ComputeBuffer constants) : base(contextDescription, resources, constants) { - LoadComputeShader("FSR2/ffx_fsr2_lock_pass"); + LoadComputeShader("FSR3/ffx_fsr3upscaler_lock_pass"); } public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr2.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) @@ -226,7 +226,7 @@ namespace FidelityFX internal class Fsr2AccumulatePass : Fsr2Pass { - private const string SharpeningKeyword = "FFX_FSR2_OPTION_APPLY_SHARPENING"; + private const string SharpeningKeyword = "FFX_FSR3UPSCALER_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; @@ -238,7 +238,7 @@ namespace FidelityFX public Fsr2AccumulatePass(Fsr2.ContextDescription contextDescription, Fsr2Resources resources, ComputeBuffer constants) : base(contextDescription, resources, constants) { - LoadComputeShader("FSR2/ffx_fsr2_accumulate_pass"); + LoadComputeShader("FSR3/ffx_fsr3upscaler_accumulate_pass"); #if UNITY_2021_2_OR_NEWER _sharpeningKeyword = new LocalKeyword(ComputeShader, SharpeningKeyword); #endif @@ -303,7 +303,7 @@ namespace FidelityFX { _rcasConstants = rcasConstants; - LoadComputeShader("FSR2/ffx_fsr2_rcas_pass"); + LoadComputeShader("FSR3/ffx_fsr3upscaler_rcas_pass"); } public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr2.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) @@ -331,7 +331,7 @@ namespace FidelityFX { _generateReactiveConstants = generateReactiveConstants; - LoadComputeShader("FSR2/ffx_fsr2_autogen_reactive_pass"); + LoadComputeShader("FSR3/ffx_fsr3upscaler_autogen_reactive_pass"); } public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr2.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) @@ -354,7 +354,7 @@ namespace FidelityFX } } - internal class Fsr2TcrAutogeneratePass : Fsr2Pass + internal class Fsr2TcrAutogeneratePass : Fsr2Pass // TODO: where did this pass go in FSR3? { private readonly ComputeBuffer _tcrAutogenerateConstants; diff --git a/Assets/Scripts/Core/Fsr2ShaderIDs.cs b/Assets/Scripts/Core/Fsr2ShaderIDs.cs index b07c967..40bbfff 100644 --- a/Assets/Scripts/Core/Fsr2ShaderIDs.cs +++ b/Assets/Scripts/Core/Fsr2ShaderIDs.cs @@ -36,7 +36,7 @@ namespace FidelityFX internal static readonly int SrvReconstructedPrevNearestDepth = Shader.PropertyToID("r_reconstructed_previous_nearest_depth"); internal static readonly int SrvDilatedMotionVectors = Shader.PropertyToID("r_dilated_motion_vectors"); internal static readonly int SrvPrevDilatedMotionVectors = Shader.PropertyToID("r_previous_dilated_motion_vectors"); - internal static readonly int SrvDilatedDepth = Shader.PropertyToID("r_dilatedDepth"); + internal static readonly int SrvDilatedDepth = Shader.PropertyToID("r_dilated_depth"); internal static readonly int SrvInternalUpscaled = Shader.PropertyToID("r_internal_upscaled_color"); internal static readonly int SrvLockStatus = Shader.PropertyToID("r_lock_status"); internal static readonly int SrvLockInputLuma = Shader.PropertyToID("r_lock_input_luma"); @@ -53,7 +53,7 @@ namespace FidelityFX // Unordered access views, i.e. random read/write bindings internal static readonly int UavReconstructedPrevNearestDepth = Shader.PropertyToID("rw_reconstructed_previous_nearest_depth"); internal static readonly int UavDilatedMotionVectors = Shader.PropertyToID("rw_dilated_motion_vectors"); - internal static readonly int UavDilatedDepth = Shader.PropertyToID("rw_dilatedDepth"); + internal static readonly int UavDilatedDepth = Shader.PropertyToID("rw_dilated_depth"); internal static readonly int UavInternalUpscaled = Shader.PropertyToID("rw_internal_upscaled_color"); internal static readonly int UavLockStatus = Shader.PropertyToID("rw_lock_status"); internal static readonly int UavLockInputLuma = Shader.PropertyToID("rw_lock_input_luma"); @@ -72,7 +72,7 @@ namespace FidelityFX internal static readonly int UavPrevColorPostAlpha = Shader.PropertyToID("rw_output_prev_color_post_alpha"); // Constant buffer bindings - internal static readonly int CbFsr2 = Shader.PropertyToID("cbFSR2"); + internal static readonly int CbFsr2 = Shader.PropertyToID("cbFSR3Upscaler"); internal static readonly int CbSpd = Shader.PropertyToID("cbSPD"); internal static readonly int CbRcas = Shader.PropertyToID("cbRCAS"); internal static readonly int CbGenReactive = Shader.PropertyToID("cbGenerateReactive"); diff --git a/Assets/Scripts/Debug/DebugDumper.cs b/Assets/Scripts/Debug/DebugDumper.cs index 88b5457..a1ae610 100644 --- a/Assets/Scripts/Debug/DebugDumper.cs +++ b/Assets/Scripts/Debug/DebugDumper.cs @@ -113,7 +113,7 @@ public class DebugDumper : MonoBehaviour GUI.matrix = Matrix4x4.Scale(new Vector3(scale, scale, scale)); } - GUILayout.Label($"FSR2: {(_fsr.enabled ? "Enabled" : "Disabled")}"); + GUILayout.Label($"FSR3 Upscaler: {(_fsr.enabled ? "Enabled" : "Disabled")}"); GUILayout.Label($"Quality: {_fsr.qualityMode}"); GUILayout.Label($"Auto-exposure: {(_fsr.enableAutoExposure ? "Enabled" : "Disabled")}"); GUILayout.Label($"Scale: {_scaleFactor:0.00}");