using System;
namespace UnityEngine.Rendering
{
///
/// Types of dynamic resolution that can be requested. Note that if Hardware is selected, but not available on the platform, the system will fallback to Software.
///
public enum DynamicResolutionType : byte
{
///
/// Software dynamic resolution.
///
Software,
///
/// Hardware dynamic resolution.
///
Hardware,
}
///
/// Types of filters that can be used to upscale rendered result to native resolution.
///
public enum DynamicResUpscaleFilter : byte
{
///
/// Bilinear upscaling filter. Obsolete and not supported.
///
[Obsolete("Bilinear upscale filter is considered obsolete and is not supported anymore, please use CatmullRom for a very cheap, but blurry filter.", false)] Bilinear,
///
/// Bicubic Catmull-Rom upscaling filter.
///
CatmullRom,
///
/// Lanczos upscaling filter. Obsolete and not supported.
///
[Obsolete("Lanczos upscale filter is considered obsolete and is not supported anymore, please use Contrast Adaptive Sharpening for very sharp filter or FidelityFX Super Resolution 1.0.", false)] Lanczos,
///
/// Contrast Adaptive Sharpening upscaling filter.
///
ContrastAdaptiveSharpen,
///
/// FidelityFX Super Resolution 1.0
///
[InspectorName("FidelityFX Super Resolution 1.0")]
EdgeAdaptiveScalingUpres,
///
/// Temporal Upscaling.
///
[InspectorName("TAA Upscale")]
TAAU
}
/// User-facing settings for dynamic resolution.
[Serializable]
public struct GlobalDynamicResolutionSettings
{
/// Default GlobalDynamicResolutionSettings
///
public static GlobalDynamicResolutionSettings NewDefault() => new GlobalDynamicResolutionSettings()
{
useMipBias = false,
maxPercentage = 100.0f,
minPercentage = 100.0f,
// It fall-backs to software when not supported, so it makes sense to have it on by default.
dynResType = DynamicResolutionType.Hardware,
upsampleFilter = DynamicResUpscaleFilter.CatmullRom,
forcedPercentage = 100.0f,
lowResTransparencyMinimumThreshold = 0.0f,
rayTracingHalfResThreshold = 50.0f,
//Defaults for dlss
enableDLSS = false,
DLSSUseOptimalSettings = true,
DLSSPerfQualitySetting = 0,
DLSSSharpness = 0.5f
};
/// Select whether the dynamic resolution is enabled or not.
public bool enabled;
/// Offsets the mip bias to recover mode detail. This only works if the camera is utilizing TAA.
public bool useMipBias;
/// Toggle NVIDIA Deep Learning Super Sampling (DLSS).
public bool enableDLSS;
/// Opaque quality setting of NVIDIA Deep Learning Super Sampling (DLSS). Use the system enum UnityEngine.NVIDIA.DLSSQuality to set the quality.
public uint DLSSPerfQualitySetting;
/// Toggle NVIDIA Deep Learning Super Sampling (DLSS) automatic recommendation system for scaling and sharpness.
/// If this is on, the manually established scale callback for Dynamic Resolution Scaling is ignored. The sharpness setting of DLSS is also ignored.
///
public bool DLSSUseOptimalSettings;
/// Pixel sharpness of NVIDIA Deep Leraning Super Sampling (DLSS).
[Range(0, 1)]
public float DLSSSharpness;
/// The maximum resolution percentage that dynamic resolution can reach.
public float maxPercentage;
/// The minimum resolution percentage that dynamic resolution can reach.
public float minPercentage;
/// The type of dynamic resolution method.
public DynamicResolutionType dynResType;
/// The default of upscaling filter used. It can be overridden via the API DynamicResolutionHandler.SetUpscaleFilter
public DynamicResUpscaleFilter upsampleFilter;
/// Select whether dynamic resolution system will force a specific resolution percentage.
public bool forceResolution;
/// The resolution percentage forced in case forceResolution is set to true.
public float forcedPercentage;
/// The minimum percentage threshold allowed to clamp low resolution transparency. When the resolution percentage falls below this threshold, HDRP will clamp the low resolution to this percentage.
public float lowResTransparencyMinimumThreshold;
/// The minimum percentage threshold allowed to render ray tracing effects at half resolution. When the resolution percentage falls below this threshold, HDRP will render ray tracing effects at full resolution.
public float rayTracingHalfResThreshold;
}
}