From 3ae0a91944b4ee7c4b8029cadafb677cbf516feb Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Tue, 13 Jun 2023 15:10:21 +0200 Subject: [PATCH] Disable dynamic resolution on render targets created during and after FSR2 upscaling. --- .../PostProcessing/Runtime/PostProcessLayer.cs | 6 ++++++ .../PostProcessing/Runtime/Utils/RuntimeUtilities.cs | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) 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 7bc836b..5a210cc 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 @@ -290,6 +290,11 @@ namespace UnityEngine.Rendering.PostProcessing RenderTexture.ReleaseTemporary(m_opaqueOnly); m_opaqueOnly = null; } + + if (m_CurrentContext.IsSuperResolutionActive()) + { + RuntimeUtilities.EnableDynamicResolution = true; + } if (!finalBlitToCameraTarget && m_CurrentContext.IsSuperResolutionActive()) { @@ -1183,6 +1188,7 @@ namespace UnityEngine.Rendering.PostProcessing // Set the upscaler's output to full display resolution, as well as for all following post-processing effects context.SetRenderSize(superResolution.displaySize); + RuntimeUtilities.EnableDynamicResolution = false; var fsrTarget = m_TargetPool.Get(); var finalDestination = context.destination; diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Utils/RuntimeUtilities.cs b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Utils/RuntimeUtilities.cs index 13497b8..c5ba737 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Utils/RuntimeUtilities.cs +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Utils/RuntimeUtilities.cs @@ -1010,6 +1010,8 @@ namespace UnityEngine.Rendering.PostProcessing && layer.temporalAntialiasing.IsSupported(); } #if UNITY_2017_3_OR_NEWER + public static bool EnableDynamicResolution = true; + /// /// Checks if dynamic resolution is enabled on a given camera. /// @@ -1017,7 +1019,7 @@ namespace UnityEngine.Rendering.PostProcessing /// true if dynamic resolution is enabled, false otherwise public static bool IsDynamicResolutionEnabled(Camera camera) { - return camera.allowDynamicResolution || (camera.targetTexture != null && camera.targetTexture.useDynamicScale); + return EnableDynamicResolution && (camera.allowDynamicResolution || (camera.targetTexture != null && camera.targetTexture.useDynamicScale)); } #endif ///