Browse Source

Swapped Luma and MotionVector outputs on the Reconstruct & Dilate pass, which fixes another apparent alignment issue on PS5 NGGC, causing the motion vectors to break occasionally when switching scaling ratios.

armasr
Nico de Poel 1 year ago
parent
commit
dad922c338
  1. 4
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Runtime/AsrPass.cs
  2. 10
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/ffxm_fsr2_reconstruct_previous_depth_pass_fs.hlsl

4
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Runtime/AsrPass.cs

@ -162,8 +162,8 @@ namespace ArmASR
commandBuffer.SetRandomWriteTarget(3, AsrShaderIDs.UavReconstructedPrevNearestDepth); commandBuffer.SetRandomWriteTarget(3, AsrShaderIDs.UavReconstructedPrevNearestDepth);
_mrt[0] = AsrShaderIDs.RtDilatedDepth; // fDepth _mrt[0] = AsrShaderIDs.RtDilatedDepth; // fDepth
_mrt[1] = Resources.DilatedMotionVectors[frameIndex]; // fMotionVector
_mrt[2] = AsrShaderIDs.RtLockInputLuma; // fLuma
_mrt[1] = AsrShaderIDs.RtLockInputLuma; // fLuma
_mrt[2] = Resources.DilatedMotionVectors[frameIndex]; // fMotionVector
FragmentProperties.SetConstantBuffer(AsrShaderIDs.CbFsr2, Constants, 0, Constants.stride); FragmentProperties.SetConstantBuffer(AsrShaderIDs.CbFsr2, Constants, 0, Constants.stride);
BlitFragment(commandBuffer, _mrt); BlitFragment(commandBuffer, _mrt);

10
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/ffxm_fsr2_reconstruct_previous_depth_pass_fs.hlsl

@ -43,16 +43,16 @@
#if defined(SHADER_API_PSSL) #if defined(SHADER_API_PSSL)
#pragma PSSL_target_output_format(target 0 FMT_32_R) #pragma PSSL_target_output_format(target 0 FMT_32_R)
#pragma PSSL_target_output_format(target 1 FMT_FP16_ABGR)
#pragma PSSL_target_output_format(target 2 FMT_32_R)
#pragma PSSL_target_output_format(target 1 FMT_32_R)
#pragma PSSL_target_output_format(target 2 FMT_FP16_ABGR)
#pragma PSSL_target_output_format(target 3 FMT_32_R) #pragma PSSL_target_output_format(target 3 FMT_32_R)
#endif #endif
struct ReconstructPrevDepthOutputsFS struct ReconstructPrevDepthOutputsFS
{ {
FfxFloat32 fDepth : SV_TARGET0; FfxFloat32 fDepth : SV_TARGET0;
FfxFloat32x2 fMotionVector : SV_TARGET1;
FfxFloat32 fLuma : SV_TARGET2;
FfxFloat32 fLuma : SV_TARGET1;
FfxFloat32x2 fMotionVector : SV_TARGET2;
}; };
@ -62,7 +62,7 @@ ReconstructPrevDepthOutputsFS main(float4 SvPosition : SV_POSITION)
ReconstructPrevDepthOutputs result = ReconstructAndDilate(uPixelCoord); ReconstructPrevDepthOutputs result = ReconstructAndDilate(uPixelCoord);
ReconstructPrevDepthOutputsFS output = (ReconstructPrevDepthOutputsFS)0; ReconstructPrevDepthOutputsFS output = (ReconstructPrevDepthOutputsFS)0;
output.fDepth = result.fDepth; output.fDepth = result.fDepth;
output.fMotionVector = result.fMotionVector;
output.fLuma = result.fLuma; output.fLuma = result.fLuma;
output.fMotionVector = result.fMotionVector;
return output; return output;
} }
Loading…
Cancel
Save