From 1222d236f5338978ff144d014fce34cd772233a6 Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Wed, 26 Mar 2025 22:25:51 +0100 Subject: [PATCH] Fixed dynamic resolution scaling: - Two instances of the same bug in ARM's code, where RenderSize was used instead of MaxRenderSize to calculate UVs - One instance of me previously fixing a bug in Isonzo that isn't a bug in the latest PPV2 code, oops --- .../Upscaling/ASR/Shaders/shaders/fsr2/ffxm_fsr2_lock.h | 2 +- .../Upscaling/ASR/Shaders/shaders/fsr2/ffxm_fsr2_upsample.h | 4 ++-- .../PostProcessing/Runtime/PostProcessLayer.cs | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/fsr2/ffxm_fsr2_lock.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/fsr2/ffxm_fsr2_lock.h index 1efc9e1..6725573 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/fsr2/ffxm_fsr2_lock.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/fsr2/ffxm_fsr2_lock.h @@ -65,7 +65,7 @@ FfxBoolean ComputeThinFeatureConfidence(FfxInt32x2 pos) FFXM_MIN16_F lumaSamples [9]; FFXM_MIN16_F fTmpDummy = FFXM_MIN16_F(0.0f); - const FfxFloat32x2 fInputLumaSize = FfxFloat32x2(RenderSize()); + const FfxFloat32x2 fInputLumaSize = FfxFloat32x2(MaxRenderSize()); const FfxFloat32x2 fPxBaseUv = FfxFloat32x2(pos) / fInputLumaSize; const FfxFloat32x2 fUnitUv = FfxFloat32x2(1.0f, 1.0f) / fInputLumaSize; diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/fsr2/ffxm_fsr2_upsample.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/fsr2/ffxm_fsr2_upsample.h index d41127d..d1829bf 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/fsr2/ffxm_fsr2_upsample.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Shaders/shaders/fsr2/ffxm_fsr2_upsample.h @@ -84,8 +84,8 @@ FfxFloat32x4 ComputeUpsampledColorAndWeight(const AccumulationPassCommonParams p FfxFloat32x2 fSrcUnjitteredPos = (FfxFloat32x2(iSrcInputPos) + FfxFloat32x2(0.5f, 0.5f)) - Jitter(); // This is the un-jittered position of the sample at offset 0,0 - FfxFloat32x2 iSrcInputUv = FfxFloat32x2(fSrcOutputPos) / FfxFloat32x2(RenderSize()); - FfxFloat32x2 unitOffsetUv = FfxFloat32x2(1.0f, 1.0f) / FfxFloat32x2(RenderSize()); + FfxFloat32x2 iSrcInputUv = FfxFloat32x2(fSrcOutputPos) / FfxFloat32x2(MaxRenderSize()); + FfxFloat32x2 unitOffsetUv = FfxFloat32x2(1.0f, 1.0f) / FfxFloat32x2(MaxRenderSize()); FFXM_MIN16_F4 fColorAndWeight = FFXM_MIN16_F4(0.0f, 0.0f, 0.0f, 0.0f); diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessLayer.cs b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessLayer.cs index a51151f..0c32a88 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessLayer.cs +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessLayer.cs @@ -742,8 +742,7 @@ namespace UnityEngine.Rendering.PostProcessing // Create a copy of the opaque-only color buffer for auto-reactive mask generation if (context.IsSuperResolutionActive() && (upscaling.autoGenerateReactiveMask || upscaling.autoGenerateTransparencyAndComposition)) { - Vector2Int scaledRenderSize = upscaling.GetScaledRenderSize(context.camera); - m_opaqueOnly = context.GetScreenSpaceTemporaryRT(colorFormat: sourceFormat, widthOverride: scaledRenderSize.x, heightOverride: scaledRenderSize.y); + m_opaqueOnly = context.GetScreenSpaceTemporaryRT(colorFormat: sourceFormat); m_LegacyCmdBufferOpaque.BuiltinBlit(cameraTarget, m_opaqueOnly); }