Browse Source

Fixes for accumulate pass

fsr3.1
Nico de Poel 2 years ago
parent
commit
0ab4f99e13
  1. 2
      Assets/Shaders/FSR3/ffx_fsr3upscaler_accumulate_pass.compute
  2. 1
      Assets/Shaders/FSR3/ffx_fsr3upscaler_unity_common.cginc
  3. 3
      Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_accumulate.h
  4. 6
      Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_reproject.h

2
Assets/Shaders/FSR3/ffx_fsr3upscaler_accumulate_pass.compute

@ -1,4 +1,4 @@
// Copyright (c) 2023 Nico de Poel
// Copyright (c) 2024 Nico de Poel
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

1
Assets/Shaders/FSR3/ffx_fsr3upscaler_unity_common.cginc

@ -21,6 +21,7 @@
// Suppress a few warnings produced by FFX's HLSL code
#pragma warning(disable: 3078) // Loop control variable conflicts
#pragma warning(disable: 3203) // Signed/unsigned mismatch
#pragma warning(disable: 3556) // Integer divides might be much slower, try using uints if possible
#define FFX_GPU // Compiling for GPU
#define FFX_HLSL // Compile for plain HLSL

3
Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_accumulate.h

@ -114,7 +114,7 @@ void InitPassData(FfxInt32x2 iPxHrPos, FFX_PARAMETER_INOUT AccumulationPassCommo
params.fMotionVector = GetMotionVector(iPxHrPos, fHrUv);
params.f4KVelocity = Get4KVelocity(params.fMotionVector);
ComputeReprojectedUVs(params);
ComputeReprojectedUVs(params, params.fReprojectedHrUv, params.bIsExistingSample);
const FfxFloat32x2 fLumaInstabilityUv_HW = ClampUv(fHrUv, RenderSize(), MaxRenderSize());
params.fLumaInstabilityFactor = SampleLumaInstability(fLumaInstabilityUv_HW);
@ -131,6 +131,7 @@ void InitPassData(FfxInt32x2 iPxHrPos, FFX_PARAMETER_INOUT AccumulationPassCommo
params.fAccumulation *= FfxFloat32(round(params.fAccumulation * 100.0f) > 1.0f);
// Init variable data
data = (AccumulationPassData)0;
data.fUpsampledColor = FfxFloat32x3(0.0f, 0.0f, 0.0f);
data.fHistoryColor = FfxFloat32x3(0.0f, 0.0f, 0.0f);
data.fHistoryWeight = 1.0f;

6
Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_reproject.h

@ -43,11 +43,11 @@ FfxFloat32x2 GetMotionVector(FfxInt32x2 iPxHrPos, FfxFloat32x2 fHrUv)
return fDilatedMotionVector;
}
void ComputeReprojectedUVs(FFX_PARAMETER_INOUT AccumulationPassCommonParams params)
void ComputeReprojectedUVs(const AccumulationPassCommonParams params, FFX_PARAMETER_OUT FfxFloat32x2 fReprojectedHrUv, FFX_PARAMETER_OUT FfxBoolean bIsExistingSample)
{
params.fReprojectedHrUv = params.fHrUv + params.fMotionVector;
fReprojectedHrUv = params.fHrUv + params.fMotionVector;
params.bIsExistingSample = IsUvInside(params.fReprojectedHrUv);
bIsExistingSample = IsUvInside(fReprojectedHrUv);
}
void ReprojectHistoryColor(const AccumulationPassCommonParams params, FFX_PARAMETER_INOUT AccumulationPassData data)

Loading…
Cancel
Save