Browse Source

Renamed "upscaling" field back to "superResolution" so as not to unnecessarily break API compatibility, and removed references to non-FSR upscaling techniques

dec2024update
Nico de Poel 1 year ago
parent
commit
a374290d99
  1. 28
      Assets/Scripts/DebugDumper.cs
  2. 28
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Editor/PostProcessLayerEditor.cs
  3. 3
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling.cs
  4. 36
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessLayer.cs

28
Assets/Scripts/DebugDumper.cs

@ -76,40 +76,40 @@ public class DebugDumper : MonoBehaviour
if (_layer.antialiasingMode == PostProcessLayer.Antialiasing.None)
{
_layer.antialiasingMode = PostProcessLayer.Antialiasing.AdvancedUpscaling;
_layer.upscaling.upscalerType = default;
_layer.superResolution.upscalerType = default;
}
else
{
int newUpscalerType = (int)_layer.upscaling.upscalerType + 1;
int newUpscalerType = (int)_layer.superResolution.upscalerType + 1;
if (newUpscalerType >= Enum.GetValues(typeof(Upscaling.UpscalerType)).Length)
{
_layer.antialiasingMode = PostProcessLayer.Antialiasing.None;
_layer.upscaling.upscalerType = default;
_layer.superResolution.upscalerType = default;
}
else
{
_layer.antialiasingMode = PostProcessLayer.Antialiasing.AdvancedUpscaling;
_layer.upscaling.upscalerType = (Upscaling.UpscalerType)newUpscalerType;
_layer.superResolution.upscalerType = (Upscaling.UpscalerType)newUpscalerType;
}
}
}
if (Input.GetButtonDown("Fire2"))
{
int quality = (int)_layer.upscaling.qualityMode;
int quality = (int)_layer.superResolution.qualityMode;
quality = (quality + 1) % Enum.GetValues(typeof(Fsr2.QualityMode)).Length;
_layer.upscaling.qualityMode = (Fsr2.QualityMode)quality;
_layer.superResolution.qualityMode = (Fsr2.QualityMode)quality;
}
if (Input.GetButtonDown("Fire3"))
{
_layer.upscaling.exposureSource =
_layer.upscaling.exposureSource != Upscaling.ExposureSource.Auto ? Upscaling.ExposureSource.Auto : Upscaling.ExposureSource.Default;
_layer.superResolution.exposureSource =
_layer.superResolution.exposureSource != Upscaling.ExposureSource.Auto ? Upscaling.ExposureSource.Auto : Upscaling.ExposureSource.Default;
}
if (Input.GetButtonDown("Jump"))
{
_layer.upscaling.ResetHistory();
_layer.superResolution.ResetHistory();
}
float vertical = Input.GetAxis("Vertical");
@ -134,13 +134,13 @@ public class DebugDumper : MonoBehaviour
GUI.matrix = Matrix4x4.Scale(new Vector3(scale, scale, scale));
}
var renderSize = _layer.upscaling.MaxRenderSize;
var displaySize = _layer.upscaling.UpscaleSize;
var renderSize = _layer.superResolution.MaxRenderSize;
var displaySize = _layer.superResolution.UpscaleSize;
GUILayout.BeginArea(new Rect(0, 0, Screen.width, Screen.height));
GUILayout.Label($"Upscaler: {(_layer.antialiasingMode == PostProcessLayer.Antialiasing.AdvancedUpscaling ? _layer.upscaling.upscalerType.ToString() : "None")}");
GUILayout.Label($"Quality: {_layer.upscaling.qualityMode}");
GUILayout.Label($"Exposure: {(_layer.upscaling.exposureSource)}");
GUILayout.Label($"Upscaler: {(_layer.antialiasingMode == PostProcessLayer.Antialiasing.AdvancedUpscaling ? _layer.superResolution.upscalerType.ToString() : "None")}");
GUILayout.Label($"Quality: {_layer.superResolution.qualityMode}");
GUILayout.Label($"Exposure: {(_layer.superResolution.exposureSource)}");
GUILayout.Label($"Scale: {Mathf.RoundToInt(_scaleFactor * 100)}%");
GUILayout.Label($"Render: {Mathf.CeilToInt(renderSize.x * _scaleFactor)}x{Mathf.CeilToInt(renderSize.y * _scaleFactor)}");
GUILayout.Label($"Display: {displaySize.x}x{displaySize.y}");

28
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Editor/PostProcessLayerEditor.cs

@ -90,20 +90,20 @@ namespace UnityEditor.Rendering.PostProcessing
m_FxaaFastMode = FindProperty(x => x.fastApproximateAntialiasing.fastMode);
m_FxaaKeepAlpha = FindProperty(x => x.fastApproximateAntialiasing.keepAlpha);
m_UpscalerType = FindProperty(x => x.upscaling.upscalerType);
m_FsrQualityMode = FindProperty(x => x.upscaling.qualityMode);
m_FsrPerformSharpen = FindProperty(x => x.upscaling.performSharpenPass);
m_FsrSharpness = FindProperty(x => x.upscaling.sharpness);
m_FsrExposureSource = FindProperty(x => x.upscaling.exposureSource);
m_FsrExposureTexture = FindProperty(x => x.upscaling.exposure);
m_FsrPreExposure = FindProperty(x => x.upscaling.preExposure);
m_FsrDebugView = FindProperty(x => x.upscaling.enableDebugView);
m_FsrAutoReactive = FindProperty(x => x.upscaling.autoGenerateReactiveMask);
m_FsrAutoReactiveParams = FindProperty(x => x.upscaling.generateReactiveParameters);
m_FsrReactiveMaskTexture = FindProperty(x => x.upscaling.reactiveMask);
m_FsrAutoTcr = FindProperty(x => x.upscaling.autoGenerateTransparencyAndComposition);
m_FsrAutoTcrParams = FindProperty(x => x.upscaling.generateTransparencyAndCompositionParameters);
m_FsrTcrMaskTexture = FindProperty(x => x.upscaling.transparencyAndCompositionMask);
m_UpscalerType = FindProperty(x => x.superResolution.upscalerType);
m_FsrQualityMode = FindProperty(x => x.superResolution.qualityMode);
m_FsrPerformSharpen = FindProperty(x => x.superResolution.performSharpenPass);
m_FsrSharpness = FindProperty(x => x.superResolution.sharpness);
m_FsrExposureSource = FindProperty(x => x.superResolution.exposureSource);
m_FsrExposureTexture = FindProperty(x => x.superResolution.exposure);
m_FsrPreExposure = FindProperty(x => x.superResolution.preExposure);
m_FsrDebugView = FindProperty(x => x.superResolution.enableDebugView);
m_FsrAutoReactive = FindProperty(x => x.superResolution.autoGenerateReactiveMask);
m_FsrAutoReactiveParams = FindProperty(x => x.superResolution.generateReactiveParameters);
m_FsrReactiveMaskTexture = FindProperty(x => x.superResolution.reactiveMask);
m_FsrAutoTcr = FindProperty(x => x.superResolution.autoGenerateTransparencyAndComposition);
m_FsrAutoTcrParams = FindProperty(x => x.superResolution.generateTransparencyAndCompositionParameters);
m_FsrTcrMaskTexture = FindProperty(x => x.superResolution.transparencyAndCompositionMask);
m_FogEnabled = FindProperty(x => x.fog.enabled);
m_FogExcludeSkybox = FindProperty(x => x.fog.excludeSkybox);

3
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling.cs

@ -15,9 +15,6 @@ namespace UnityEngine.Rendering.PostProcessing
{
[InspectorName("FidelityFX Super Resolution 2.2 (FSR2)")] FSR2,
[InspectorName("FidelityFX Super Resolution 3.1 (FSR3)")] FSR3,
//[InspectorName("Arm Accuracy Super Resolution (ASR)")] ASR,
//[InspectorName("Snapdragon Game Super Resolution 2 (SGSR2)")] SGSR2,
[InspectorName("PlayStation Spectral Super Resolution (PSSR)")] PSSR,
}
[Tooltip("Which upscaling technology to use.")]

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

@ -100,7 +100,7 @@ namespace UnityEngine.Rendering.PostProcessing
/// <summary>
/// Advanced upscaling & anti-aliasing settings for this camera.
/// </summary>
public Upscaling upscaling;
public Upscaling superResolution;
/// <summary>
/// Subpixel Morphological Anti-aliasing settings for this camera.
@ -302,7 +302,7 @@ namespace UnityEngine.Rendering.PostProcessing
if (!finalBlitToCameraTarget && m_CurrentContext.IsSuperResolutionActive())
{
// Set the camera back to its original parameters, so we can output at full display resolution
upscaling.ResetCameraViewport(m_CurrentContext);
superResolution.ResetCameraViewport(m_CurrentContext);
// Blit the upscaled image to the backbuffer
if (m_originalTargetTexture != null)
@ -342,7 +342,7 @@ namespace UnityEngine.Rendering.PostProcessing
if (resources != null) m_Resources = resources;
RuntimeUtilities.CreateIfNull(ref temporalAntialiasing);
RuntimeUtilities.CreateIfNull(ref upscaling);
RuntimeUtilities.CreateIfNull(ref superResolution);
RuntimeUtilities.CreateIfNull(ref subpixelMorphologicalAntialiasing);
RuntimeUtilities.CreateIfNull(ref fastApproximateAntialiasing);
RuntimeUtilities.CreateIfNull(ref dithering);
@ -445,7 +445,7 @@ namespace UnityEngine.Rendering.PostProcessing
}
temporalAntialiasing.Release();
upscaling.Release();
superResolution.Release();
m_LogHistogram.Release();
foreach (var bundle in m_Bundles.Values)
@ -635,13 +635,13 @@ namespace UnityEngine.Rendering.PostProcessing
// Modify internal rendering resolution for both the camera and the pre-upscaling post-processing effects
if (context.IsSuperResolutionActive())
{
upscaling.ConfigureCameraViewport(context);
context.SetRenderSize(upscaling.MaxRenderSize);
superResolution.ConfigureCameraViewport(context);
context.SetRenderSize(superResolution.MaxRenderSize);
}
else
{
// Ensure all of FSR2's resources are released when it's not in use
upscaling.Release();
superResolution.Release();
if (m_originalTargetTexture != null)
{
@ -740,9 +740,9 @@ 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))
if (context.IsSuperResolutionActive() && (superResolution.autoGenerateReactiveMask || superResolution.autoGenerateTransparencyAndComposition))
{
Vector2Int scaledRenderSize = upscaling.GetScaledRenderSize(context.camera);
Vector2Int scaledRenderSize = superResolution.GetScaledRenderSize(context.camera);
m_opaqueOnly = context.GetScreenSpaceTemporaryRT(colorFormat: sourceFormat, widthOverride: scaledRenderSize.x, heightOverride: scaledRenderSize.y);
m_LegacyCmdBufferOpaque.BuiltinBlit(cameraTarget, m_opaqueOnly);
}
@ -776,7 +776,7 @@ namespace UnityEngine.Rendering.PostProcessing
if (!finalBlitToCameraTarget && m_CurrentContext.IsSuperResolutionActive())
{
var displaySize = upscaling.UpscaleSize;
var displaySize = superResolution.UpscaleSize;
m_upscaledOutput = context.GetScreenSpaceTemporaryRT(widthOverride: displaySize.x, heightOverride: displaySize.y);
context.destination = m_upscaledOutput;
}
@ -813,7 +813,7 @@ namespace UnityEngine.Rendering.PostProcessing
// Set the camera back to its original parameters, so we can output at full display resolution
if (finalBlitToCameraTarget && m_CurrentContext.IsSuperResolutionActive())
{
upscaling.ResetCameraViewport(m_CurrentContext);
superResolution.ResetCameraViewport(m_CurrentContext);
}
if (m_CurrentContext.IsTemporalAntialiasingActive() || m_CurrentContext.IsSuperResolutionActive())
@ -936,7 +936,7 @@ namespace UnityEngine.Rendering.PostProcessing
flags |= temporalAntialiasing.GetCameraFlags();
if (context.IsSuperResolutionActive())
flags |= upscaling.GetCameraFlags();
flags |= superResolution.GetCameraFlags();
if (fog.IsEnabledAndSupported(context))
flags |= fog.GetCameraFlags();
@ -958,7 +958,7 @@ namespace UnityEngine.Rendering.PostProcessing
bundle.Value.ResetHistory();
temporalAntialiasing.ResetHistory();
upscaling.ResetHistory();
superResolution.ResetHistory();
}
/// <summary>
@ -1020,7 +1020,7 @@ namespace UnityEngine.Rendering.PostProcessing
context.debugLayer = debugLayer;
context.antialiasing = antialiasingMode;
context.temporalAntialiasing = temporalAntialiasing;
context.upscaling = upscaling;
context.upscaling = superResolution;
context.logHistogram = m_LogHistogram;
#if UNITY_2018_2_OR_NEWER
@ -1195,17 +1195,17 @@ namespace UnityEngine.Rendering.PostProcessing
}
else if (context.IsSuperResolutionActive())
{
upscaling.ConfigureJitteredProjectionMatrix(context);
superResolution.ConfigureJitteredProjectionMatrix(context);
// Set the upscaler's output to full display resolution, as well as for all following post-processing effects
context.SetRenderSize(upscaling.UpscaleSize);
context.SetRenderSize(superResolution.UpscaleSize);
var upscaleTarget = m_TargetPool.Get();
var finalDestination = context.destination;
context.GetScreenSpaceTemporaryRT(cmd, upscaleTarget, 0, context.sourceFormat, isUpscaleOutput: true);
context.destination = upscaleTarget;
upscaling.ColorOpaqueOnly = m_opaqueOnly;
upscaling.Render(context);
superResolution.ColorOpaqueOnly = m_opaqueOnly;
superResolution.Render(context);
context.source = upscaleTarget;
context.destination = finalDestination;

Loading…
Cancel
Save