diff --git a/Runtime/FSR2/Fsr2Context.cs b/Runtime/FSR2/Fsr2Context.cs index cd02699..782e700 100644 --- a/Runtime/FSR2/Fsr2Context.cs +++ b/Runtime/FSR2/Fsr2Context.cs @@ -224,6 +224,9 @@ namespace FidelityFX.FSR2 commandBuffer.SetRenderTarget(Fsr2ShaderIDs.UavReconstructedPrevNearestDepth); commandBuffer.ClearRenderTarget(false, true, depthInverted ? Color.clear : Color.white); + commandBuffer.SetRenderTarget(Fsr2ShaderIDs.UavNewLocks); + commandBuffer.ClearRenderTarget(false, true, Color.clear); + // Auto exposure SetupSpdConstants(dispatchParams, out var dispatchThreadGroupCount); diff --git a/Runtime/FSR2/Fsr2Pass.cs b/Runtime/FSR2/Fsr2Pass.cs index d791f79..7186c53 100644 --- a/Runtime/FSR2/Fsr2Pass.cs +++ b/Runtime/FSR2/Fsr2Pass.cs @@ -274,6 +274,7 @@ namespace FidelityFX.FSR2 commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvSceneLuminanceMips, Resources.SceneLuminance); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvAutoExposure, Resources.AutoExposure[frameIndex]); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvLumaHistory, Resources.LumaHistory[frameIndex ^ 1]); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvNewLocks, Fsr2ShaderIDs.UavNewLocks); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavInternalUpscaled, Resources.InternalUpscaled[frameIndex]); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavLockStatus, Resources.LockStatus[frameIndex]); diff --git a/Runtime/FSR2/Fsr2ShaderIDs.cs b/Runtime/FSR2/Fsr2ShaderIDs.cs index 0adbf6b..d37fabf 100644 --- a/Runtime/FSR2/Fsr2ShaderIDs.cs +++ b/Runtime/FSR2/Fsr2ShaderIDs.cs @@ -39,6 +39,7 @@ namespace FidelityFX.FSR2 public static readonly int SrvDilatedDepth = Shader.PropertyToID("r_dilatedDepth"); public static readonly int SrvInternalUpscaled = Shader.PropertyToID("r_internal_upscaled_color"); public static readonly int SrvLockStatus = Shader.PropertyToID("r_lock_status"); + public static readonly int SrvNewLocks = Shader.PropertyToID("r_new_locks"); public static readonly int SrvLockInputLuma = Shader.PropertyToID("r_lock_input_luma"); public static readonly int SrvPreparedInputColor = Shader.PropertyToID("r_prepared_input_color"); public static readonly int SrvLumaHistory = Shader.PropertyToID("r_luma_history"); diff --git a/Shaders/shaders/ffx_fsr2_accumulate_pass.hlsl b/Shaders/shaders/ffx_fsr2_accumulate_pass.hlsl index 59cfd80..b5c78af 100644 --- a/Shaders/shaders/ffx_fsr2_accumulate_pass.hlsl +++ b/Shaders/shaders/ffx_fsr2_accumulate_pass.hlsl @@ -35,12 +35,12 @@ #define FSR2_BIND_SRV_SCENE_LUMINANCE_MIPS 8 #define FSR2_BIND_SRV_AUTO_EXPOSURE 9 #define FSR2_BIND_SRV_LUMA_HISTORY 10 +#define FSR2_BIND_SRV_NEW_LOCKS 11 #define FSR2_BIND_UAV_INTERNAL_UPSCALED 0 #define FSR2_BIND_UAV_LOCK_STATUS 1 #define FSR2_BIND_UAV_UPSCALED_OUTPUT 2 -#define FSR2_BIND_UAV_NEW_LOCKS 3 -#define FSR2_BIND_UAV_LUMA_HISTORY 4 +#define FSR2_BIND_UAV_LUMA_HISTORY 3 #define FSR2_BIND_CB_FSR2 0 diff --git a/Shaders/shaders/fsr2/ffx_fsr2_accumulate.h b/Shaders/shaders/fsr2/ffx_fsr2_accumulate.h index 71b9d26..db60a64 100644 --- a/Shaders/shaders/fsr2/ffx_fsr2_accumulate.h +++ b/Shaders/shaders/fsr2/ffx_fsr2_accumulate.h @@ -289,7 +289,7 @@ void Accumulate(FfxInt32x2 iPxHrPos) #if FFX_FSR2_OPTION_APPLY_SHARPENING == 0 WriteUpscaledOutput(iPxHrPos, fHistoryColor); #endif - StoreNewLocks(iPxHrPos, 0); + //StoreNewLocks(iPxHrPos, 0); } #endif // FFX_FSR2_ACCUMULATE_H diff --git a/Shaders/shaders/fsr2/ffx_fsr2_reproject.h b/Shaders/shaders/fsr2/ffx_fsr2_reproject.h index 386b297..b9dd57f 100644 --- a/Shaders/shaders/fsr2/ffx_fsr2_reproject.h +++ b/Shaders/shaders/fsr2/ffx_fsr2_reproject.h @@ -120,7 +120,7 @@ void ReprojectHistoryColor(const AccumulationPassCommonParams params, FFX_PARAME LockState ReprojectHistoryLockStatus(const AccumulationPassCommonParams params, FFX_PARAMETER_OUT FfxFloat32x2 fReprojectedLockStatus) { LockState state = { FFX_FALSE, FFX_FALSE }; - const FfxFloat32 fNewLockIntensity = LoadRwNewLocks(params.iPxHrPos); + const FfxFloat32 fNewLockIntensity = LoadNewLocks(params.iPxHrPos); state.NewLock = fNewLockIntensity > (127.0f / 255.0f); FfxFloat32 fInPlaceLockLifetime = state.NewLock ? fNewLockIntensity : 0;