From 6b74532793ec619c528b79aa10de21f66f637f83 Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Fri, 24 Feb 2023 11:32:40 +0100 Subject: [PATCH] Some cleanup and a few small details --- Assets/Scripts/Fsr2Context.cs | 12 ------------ Assets/Scripts/Fsr2Controller.cs | 5 +++-- Assets/Scripts/Fsr2Pipeline.cs | 1 + 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/Assets/Scripts/Fsr2Context.cs b/Assets/Scripts/Fsr2Context.cs index 4aee46b..9031ccc 100644 --- a/Assets/Scripts/Fsr2Context.cs +++ b/Assets/Scripts/Fsr2Context.cs @@ -118,15 +118,7 @@ namespace FidelityFX // private void InitShaders() // { - // LoadComputeShader("FSR2/ffx_fsr2_compute_luminance_pyramid_pass", ref _computeLuminancePyramidShader, out _computeLuminancePyramidKernel); - // LoadComputeShader("FSR2/ffx_fsr2_rcas_pass", ref _rcasShader, out _rcasKernel); - // LoadComputeShader("FSR2/ffx_fsr2_prepare_input_color_pass", ref _prepareInputColorShader, out _prepareInputColorKernel); - // LoadComputeShader("FSR2/ffx_fsr2_depth_clip_pass", ref _depthClipShader, out _depthClipKernel); - // LoadComputeShader("FSR2/ffx_fsr2_reconstruct_previous_depth_pass", ref _reconstructPreviousDepthShader, out _reconstructPreviousDepthKernel); - // LoadComputeShader("FSR2/ffx_fsr2_lock_pass", ref _lockShader, out _lockKernel); - // LoadComputeShader("FSR2/ffx_fsr2_accumulate_pass", ref _accumulateShader, out _accumulateKernel); // LoadComputeShader("FSR2/ffx_fsr2_autogen_reactive_pass", ref _generateReactiveShader, out _generateReactiveKernel); - // LoadComputeShader("FSR2/ffx_fsr2_tcr_autogen_pass", ref _tcrAutogenShader, out _tcrAutogenKernel); // } private void CreatePipelines() @@ -172,10 +164,6 @@ namespace FidelityFX _commandBuffer.Clear(); - // TODO: Should probably use a CommandBuffer here, to queue up all of the commands and dispatch them in one go - // Use SetRandomWriteTarget to declare UAVs - // Use ClearRandomWriteTargets to clear all UAVs at once - if (_firstExecution) { // TODO: clear values diff --git a/Assets/Scripts/Fsr2Controller.cs b/Assets/Scripts/Fsr2Controller.cs index 0a96bc7..6d656d9 100644 --- a/Assets/Scripts/Fsr2Controller.cs +++ b/Assets/Scripts/Fsr2Controller.cs @@ -70,7 +70,7 @@ public class Fsr2Controller : MonoBehaviour // TODO: destroy and recreate context on screen resolution and/or quality mode change // TODO: enable motion vector jitter cancellation or not? - _context = Fsr2.CreateContext(DisplaySize, RenderSize); + _context = Fsr2.CreateContext(DisplaySize, RenderSize, Fsr2.InitializationFlags.EnableMotionVectorsJitterCancellation); // TODO: do we need a depth buffer for the output? We will need depth & motion vectors for subsequent post-FX. How should FSR2 output these? // TODO: can probably be a temporary RT @@ -120,7 +120,7 @@ public class Fsr2Controller : MonoBehaviour _dispatchDescription.Output = _outputRT; _dispatchDescription.Exposure = null; _dispatchDescription.Reactive = null; - _dispatchDescription.PreExposure = 1.0f; + _dispatchDescription.PreExposure = 0; _dispatchDescription.EnableSharpening = performSharpenPass; _dispatchDescription.Sharpness = sharpness; _dispatchDescription.MotionVectorScale.x = gameCamera.pixelWidth; @@ -136,6 +136,7 @@ public class Fsr2Controller : MonoBehaviour RenderTexture.ReleaseTemporary(motionVectors); // Output upscaled image to screen + // TODO: we should probably use a shader to include depth & motion vectors into the output Graphics.Blit(_outputRT, dest); } } diff --git a/Assets/Scripts/Fsr2Pipeline.cs b/Assets/Scripts/Fsr2Pipeline.cs index 09125f1..f72d734 100644 --- a/Assets/Scripts/Fsr2Pipeline.cs +++ b/Assets/Scripts/Fsr2Pipeline.cs @@ -111,6 +111,7 @@ namespace FidelityFX commandBuffer.ReleaseTemporaryRT(UavLockInputLuma); commandBuffer.ReleaseTemporaryRT(UavDilatedReactiveMasks); commandBuffer.ReleaseTemporaryRT(UavPreparedInputColor); + commandBuffer.ReleaseTemporaryRT(UavNewLocks); } protected void LoadComputeShader(string name)