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 592351e..18f0246 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 @@ -293,7 +293,7 @@ namespace UnityEngine.Rendering.PostProcessing if (m_CurrentContext.IsSuperResolutionActive()) { - RuntimeUtilities.EnableDynamicResolution = true; + RuntimeUtilities.AllowDynamicResolution = true; } if (!finalBlitToCameraTarget && m_CurrentContext.IsSuperResolutionActive()) @@ -1191,16 +1191,15 @@ namespace UnityEngine.Rendering.PostProcessing var fsrTarget = m_TargetPool.Get(); var finalDestination = context.destination; - RuntimeUtilities.EnableDynamicResolution = false; - context.GetScreenSpaceTemporaryRT(cmd, fsrTarget, 0, context.sourceFormat, enableRandomWrite: true); + context.GetScreenSpaceTemporaryRT(cmd, fsrTarget, 0, context.sourceFormat, isUpscaleOutput: true); context.destination = fsrTarget; superResolution.colorOpaqueOnly = m_opaqueOnly; - RuntimeUtilities.EnableDynamicResolution = true; superResolution.Render(context); context.source = fsrTarget; context.destination = finalDestination; - RuntimeUtilities.EnableDynamicResolution = false; + // Disable dynamic scaling on render targets, so all subsequent effects will be applied on the full resolution upscaled image + RuntimeUtilities.AllowDynamicResolution = false; if (lastTarget > -1) cmd.ReleaseTemporaryRT(lastTarget); diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessRenderContext.cs b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessRenderContext.cs index bc6f560..4cbf865 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessRenderContext.cs +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessRenderContext.cs @@ -372,10 +372,10 @@ namespace UnityEngine.Rendering.PostProcessing /// The texture filtering mode /// Override the display width; use 0 to disable the override /// Override the display height; use 0 to disable the override - /// Enable random access write into this render texture + /// Enable random access write into this render texture and disable dynamic scaling public void GetScreenSpaceTemporaryRT(CommandBuffer cmd, int nameID, int depthBufferBits = 0, RenderTextureFormat colorFormat = RenderTextureFormat.Default, RenderTextureReadWrite readWrite = RenderTextureReadWrite.Default, - FilterMode filter = FilterMode.Bilinear, int widthOverride = 0, int heightOverride = 0, bool enableRandomWrite = false) + FilterMode filter = FilterMode.Bilinear, int widthOverride = 0, int heightOverride = 0, bool isUpscaleOutput = false) { var desc = GetDescriptor(depthBufferBits, colorFormat, readWrite); if (widthOverride > 0) @@ -387,8 +387,11 @@ namespace UnityEngine.Rendering.PostProcessing if (stereoActive && desc.dimension == Rendering.TextureDimension.Tex2DArray) desc.dimension = Rendering.TextureDimension.Tex2D; - if (enableRandomWrite) + if (isUpscaleOutput) + { desc.enableRandomWrite = true; + desc.useDynamicScale = false; + } #if UNITY_2019_1_OR_NEWER cmd.GetTemporaryRT(nameID, desc, filter); 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 c5ba737..cc706d6 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,7 +1010,7 @@ namespace UnityEngine.Rendering.PostProcessing && layer.temporalAntialiasing.IsSupported(); } #if UNITY_2017_3_OR_NEWER - public static bool EnableDynamicResolution = true; + public static bool AllowDynamicResolution = true; /// /// Checks if dynamic resolution is enabled on a given camera. @@ -1019,7 +1019,7 @@ namespace UnityEngine.Rendering.PostProcessing /// true if dynamic resolution is enabled, false otherwise public static bool IsDynamicResolutionEnabled(Camera camera) { - return EnableDynamicResolution && (camera.allowDynamicResolution || (camera.targetTexture != null && camera.targetTexture.useDynamicScale)); + return AllowDynamicResolution && (camera.allowDynamicResolution || (camera.targetTexture != null && camera.targetTexture.useDynamicScale)); } #endif ///