docs.unity.cn

Core RP Library 16.0.3

    Show / Hide Table of Contents

    Class DynamicResolutionHandler

    The class responsible to handle dynamic resolution.

    Inheritance
    System.Object
    DynamicResolutionHandler
    Namespace: UnityEngine.Rendering
    Syntax
    public class DynamicResolutionHandler

    Properties

    filter

    The filter that is used to upscale the rendering result to the native resolution.

    Declaration
    public DynamicResUpscaleFilter filter { get; }
    Property Value
    Type Description
    DynamicResUpscaleFilter

    finalViewport

    The viewport of the final buffer. This is likely the resolution the dynamic resolution starts from before any scaling. Note this is NOT the target resolution the rendering will happen in but the resolution the scaled rendered result will be upscaled to.

    Declaration
    public Vector2Int finalViewport { get; set; }
    Property Value
    Type Description
    Vector2Int

    instance

    Get the instance of the global dynamic resolution handler.

    Declaration
    public static DynamicResolutionHandler instance { get; }
    Property Value
    Type Description
    DynamicResolutionHandler

    runUpscalerFilterOnFullResolution

    By default, dynamic resolution scaling is turned off automatically when the source matches the final viewport (100% scale). That is, DynamicResolutionEnabled and SoftwareDynamicResIsEnabled will return false if the scale is 100%. For certain upscalers, we dont want this behavior since they could possibly include anti aliasing and other quality improving post processes. Setting this to true will eliminate this behavior. Note: when the EdgeAdaptiveScalingUpres (FSR 1.0) filter is set, this will cause this parameter to always be true.

    Declaration
    public bool runUpscalerFilterOnFullResolution { get; set; }
    Property Value
    Type Description
    System.Boolean

    upsamplerSchedule

    Property that sets / gets the state of the upscaling schedule. This must be set at the beginning of the frame, once per camera.

    Declaration
    public DynamicResolutionHandler.UpsamplerScheduleType upsamplerSchedule { get; set; }
    Property Value
    Type Description
    DynamicResolutionHandler.UpsamplerScheduleType

    Methods

    ApplyScalesOnSize(Vector2Int)

    Applies to the passed size the scale imposed by the dynamic resolution system. This function uses the internal resolved scale from the dynamic resolution system. Note: this function is pure (has no side effects), this function does not cache the pre-scale size

    Declaration
    public Vector2Int ApplyScalesOnSize(Vector2Int size)
    Parameters
    Type Name Description
    Vector2Int size

    The size to apply the scaling

    Returns
    Type Description
    Vector2Int

    The parameter size scaled by the dynamic resolution system.

    CalculateMipBias(Vector2Int, Vector2Int, Boolean)

    Returns the mip bias to apply in the rendering pipeline. This mip bias helps bring detail since sampling of textures occurs at the target rate.

    Declaration
    public float CalculateMipBias(Vector2Int inputResolution, Vector2Int outputResolution, bool forceApply = false)
    Parameters
    Type Name Description
    Vector2Int inputResolution

    The input width x height resolution in pixels.

    Vector2Int outputResolution

    The output width x height resolution in pixels.

    System.Boolean forceApply

    False by default. If true, we ignore the useMipBias setting and return a mip bias regardless.

    Returns
    Type Description
    System.Single

    The calculated mip bias

    ClearSelectedCamera()

    Will clear the currently used camera. Use this function to restore the default instance when UpdateAndUseCamera is called.

    Declaration
    public static void ClearSelectedCamera()

    DynamicResolutionEnabled()

    Identifies whether dynamic resolution is enabled and scaling the render targets.

    Declaration
    public bool DynamicResolutionEnabled()
    Returns
    Type Description
    System.Boolean

    True: Dynamic resolution is enabled.

    ForceSoftwareFallback()

    Forces software fallback for dynamic resolution. Needs to be called in case Hardware dynamic resolution is requested by the user, but not supported by the platform.

    Declaration
    public void ForceSoftwareFallback()

    GetCurrentScale()

    Returns the scale that is currently applied by the dynamic resolution system.

    Declaration
    public float GetCurrentScale()
    Returns
    Type Description
    System.Single

    The scale that is currently applied by the dynamic resolution system.

    GetLastScaledSize()

    Returns the latest scaled size that has been produced by GetScaledSize.

    Declaration
    public Vector2Int GetLastScaledSize()
    Returns
    Type Description
    Vector2Int

    The latest scaled size that has been produced by GetScaledSize.

    GetLowResMultiplier(Single)

    Returns the resolved low res multiplier based on the low res transparency threshold settings. Note: The pipeline can use this to drive the scale for low res transparency if available.

    Declaration
    public float GetLowResMultiplier(float targetLowRes)
    Parameters
    Type Name Description
    System.Single targetLowRes

    the target low resolution. If by any chance thresholding is disabled or clamped, the exact same resolution is returned. This allows the caller to directly compare the float result safely with the floating point target resolution.

    Returns
    Type Description
    System.Single

    Returns the resolved low res multiplier based on the low transparency threshold settings.

    GetResolvedScale()

    Gets the resolved scale

    Declaration
    public Vector2 GetResolvedScale()
    Returns
    Type Description
    Vector2

    The resolved scale in form of Vector2

    GetScaledSize(Vector2Int)

    Applies to the passed size the scale imposed by the dynamic resolution system. Note: this function has the side effect of caching the last scale size, and the output is always smaller or equal then the input.

    Declaration
    public Vector2Int GetScaledSize(Vector2Int size)
    Parameters
    Type Name Description
    Vector2Int size

    The starting size of the render target that will be scaled by dynamic resolution.

    Returns
    Type Description
    Vector2Int

    The parameter size scaled by the dynamic resolution system.

    HardwareDynamicResIsEnabled()

    Determines whether hardware dynamic resolution is enabled or not.

    Declaration
    public bool HardwareDynamicResIsEnabled()
    Returns
    Type Description
    System.Boolean

    True: Hardware dynamic resolution is enabled

    RequestsHardwareDynamicResolution()

    Identifies whether hardware dynamic resolution has been requested and is going to be used.

    Declaration
    public bool RequestsHardwareDynamicResolution()
    Returns
    Type Description
    System.Boolean

    True: Hardware dynamic resolution is requested by user and software fallback has not been forced

    SetActiveDynamicScalerSlot(DynamicResScalerSlot)

    Sets the active dynamic scaler slot to be used by the runtime when calculating frame resolutions. See DynamicResScalerSlot for more information.

    Declaration
    public static void SetActiveDynamicScalerSlot(DynamicResScalerSlot slot)
    Parameters
    Type Name Description
    DynamicResScalerSlot slot

    The scaler to be selected and used by the runtime.

    SetCurrentCameraRequest(Boolean)

    Set whether the camera that is currently processed by the pipeline has requested dynamic resolution or not.

    Declaration
    public void SetCurrentCameraRequest(bool cameraRequest)
    Parameters
    Type Name Description
    System.Boolean cameraRequest

    Determines whether the camera has requested dynamic resolution or not.

    SetDynamicResScaler(PerformDynamicRes, DynamicResScalePolicyType)

    Set the scaler method used to drive dynamic resolution by the user.

    Declaration
    public static void SetDynamicResScaler(PerformDynamicRes scaler, DynamicResScalePolicyType scalerType = DynamicResScalePolicyType.ReturnsMinMaxLerpFactor)
    Parameters
    Type Name Description
    PerformDynamicRes scaler

    The delegate used to determine the resolution percentage used by the dynamic resolution system.

    DynamicResScalePolicyType scalerType

    The type of scaler that is used, this is used to indicate the return type of the scaler to the dynamic resolution system.

    SetSystemDynamicResScaler(PerformDynamicRes, DynamicResScalePolicyType)

    Set the scaler method used to drive dynamic resolution internally from the Scriptable Rendering Pipeline. This function should only be called by Scriptable Rendering Pipeline.

    Declaration
    public static void SetSystemDynamicResScaler(PerformDynamicRes scaler, DynamicResScalePolicyType scalerType = DynamicResScalePolicyType.ReturnsMinMaxLerpFactor)
    Parameters
    Type Name Description
    PerformDynamicRes scaler

    The delegate used to determine the resolution percentage used by the dynamic resolution system.

    DynamicResScalePolicyType scalerType

    The type of scaler that is used, this is used to indicate the return type of the scaler to the dynamic resolution system.

    SetUpscaleFilter(Camera, DynamicResUpscaleFilter)

    Set the Upscale filter used by the camera when dynamic resolution is run.

    Declaration
    public static void SetUpscaleFilter(Camera camera, DynamicResUpscaleFilter filter)
    Parameters
    Type Name Description
    Camera camera

    The camera for which the upscale filter is set.

    DynamicResUpscaleFilter filter

    The filter to be used by the camera to upscale to final resolution.

    SoftwareDynamicResIsEnabled()

    Determines whether software dynamic resolution is enabled or not.

    Declaration
    public bool SoftwareDynamicResIsEnabled()
    Returns
    Type Description
    System.Boolean

    True: Software dynamic resolution is enabled

    Update(GlobalDynamicResolutionSettings, Action)

    Update the state of the dynamic resolution system.

    Declaration
    public void Update(GlobalDynamicResolutionSettings settings, Action OnResolutionChange = null)
    Parameters
    Type Name Description
    GlobalDynamicResolutionSettings settings

    The settings that are to be used by the dynamic resolution system.

    Action OnResolutionChange

    An action that will be called every time the dynamic resolution system triggers a change in resolution.

    UpdateAndUseCamera(Camera, Nullable<GlobalDynamicResolutionSettings>, Action)

    Update the state of the dynamic resolution system for a specific camera. Call this function also to switch context between cameras (will set the current camera as active). Passing a null camera has the same effect as calling Update without the camera parameter.

    Declaration
    public static void UpdateAndUseCamera(Camera camera, GlobalDynamicResolutionSettings? settings = null, Action OnResolutionChange = null)
    Parameters
    Type Name Description
    Camera camera

    Camera used to select a specific instance tied to this DynamicResolutionHandler instance.

    Nullable<GlobalDynamicResolutionSettings> settings

    (optional) The settings that are to be used by the dynamic resolution system. passing null for the settings will result in the last update's settings used.

    Action OnResolutionChange

    An action that will be called every time the dynamic resolution system triggers a change in resolution.

    Extension Methods

    AnalyticsUtils.ToNestedColumnWithDefault<T>(T, T, Boolean)
    ReflectionUtils.Invoke(Object, String, Object[])
    ReflectionUtils.SetField(Object, String, Object)
    ReflectionUtils.GetField(Object, String)
    ReflectionUtils.GetFields(Object)
    In This Article
    • Properties
      • filter
      • finalViewport
      • instance
      • runUpscalerFilterOnFullResolution
      • upsamplerSchedule
    • Methods
      • ApplyScalesOnSize(Vector2Int)
      • CalculateMipBias(Vector2Int, Vector2Int, Boolean)
      • ClearSelectedCamera()
      • DynamicResolutionEnabled()
      • ForceSoftwareFallback()
      • GetCurrentScale()
      • GetLastScaledSize()
      • GetLowResMultiplier(Single)
      • GetResolvedScale()
      • GetScaledSize(Vector2Int)
      • HardwareDynamicResIsEnabled()
      • RequestsHardwareDynamicResolution()
      • SetActiveDynamicScalerSlot(DynamicResScalerSlot)
      • SetCurrentCameraRequest(Boolean)
      • SetDynamicResScaler(PerformDynamicRes, DynamicResScalePolicyType)
      • SetSystemDynamicResScaler(PerformDynamicRes, DynamicResScalePolicyType)
      • SetUpscaleFilter(Camera, DynamicResUpscaleFilter)
      • SoftwareDynamicResIsEnabled()
      • Update(GlobalDynamicResolutionSettings, Action)
      • UpdateAndUseCamera(Camera, Nullable<GlobalDynamicResolutionSettings>, Action)
    • Extension Methods
    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on 07 July 2023