Browse Source

Disable dynamic resolution on render targets created during and after FSR2 upscaling.

fsr2
Nico de Poel 3 years ago
parent
commit
3ae0a91944
  1. 6
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessLayer.cs
  2. 4
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Utils/RuntimeUtilities.cs

6
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessLayer.cs

@ -291,6 +291,11 @@ namespace UnityEngine.Rendering.PostProcessing
m_opaqueOnly = null; m_opaqueOnly = null;
} }
if (m_CurrentContext.IsSuperResolutionActive())
{
RuntimeUtilities.EnableDynamicResolution = true;
}
if (!finalBlitToCameraTarget && m_CurrentContext.IsSuperResolutionActive()) if (!finalBlitToCameraTarget && m_CurrentContext.IsSuperResolutionActive())
{ {
// Set the camera back to its original parameters, so we can output at full display resolution // Set the camera back to its original parameters, so we can output at full display resolution
@ -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 // Set the upscaler's output to full display resolution, as well as for all following post-processing effects
context.SetRenderSize(superResolution.displaySize); context.SetRenderSize(superResolution.displaySize);
RuntimeUtilities.EnableDynamicResolution = false;
var fsrTarget = m_TargetPool.Get(); var fsrTarget = m_TargetPool.Get();
var finalDestination = context.destination; var finalDestination = context.destination;

4
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Utils/RuntimeUtilities.cs

@ -1010,6 +1010,8 @@ namespace UnityEngine.Rendering.PostProcessing
&& layer.temporalAntialiasing.IsSupported(); && layer.temporalAntialiasing.IsSupported();
} }
#if UNITY_2017_3_OR_NEWER #if UNITY_2017_3_OR_NEWER
public static bool EnableDynamicResolution = true;
/// <summary> /// <summary>
/// Checks if dynamic resolution is enabled on a given camera. /// Checks if dynamic resolution is enabled on a given camera.
/// </summary> /// </summary>
@ -1017,7 +1019,7 @@ namespace UnityEngine.Rendering.PostProcessing
/// <returns><c>true</c> if dynamic resolution is enabled, <c>false</c> otherwise</returns> /// <returns><c>true</c> if dynamic resolution is enabled, <c>false</c> otherwise</returns>
public static bool IsDynamicResolutionEnabled(Camera camera) 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 #endif
/// <summary> /// <summary>

Loading…
Cancel
Save