docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class RTHandleSystem

    System managing a set of RTHandle textures

    Inheritance
    object
    RTHandleSystem
    Implements
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.Rendering
    Assembly: Unity.RenderPipelines.Core.Runtime.dll
    Syntax
    public class RTHandleSystem : IDisposable

    Constructors

    RTHandleSystem()

    RTHandleSystem constructor.

    Declaration
    public RTHandleSystem()

    Properties

    rtHandleProperties

    Current properties of the RTHandle System.

    Declaration
    public RTHandleProperties rtHandleProperties { get; }
    Property Value
    Type Description
    RTHandleProperties

    Methods

    Alloc(int, int, int, DepthBits, GraphicsFormat, FilterMode, TextureWrapMode, TextureDimension, bool, bool, bool, bool, int, float, MSAASamples, bool, bool, bool, RenderTextureMemoryless, VRTextureUsage, string)

    Allocate a new fixed sized RTHandle.

    Declaration
    public RTHandle Alloc(int width, int height, int slices = 1, DepthBits depthBufferBits = DepthBits.None, GraphicsFormat colorFormat = GraphicsFormat.R8G8B8A8_SRGB, FilterMode filterMode = FilterMode.Point, TextureWrapMode wrapMode = TextureWrapMode.Repeat, TextureDimension dimension = TextureDimension.Tex2D, bool enableRandomWrite = false, bool useMipMap = false, bool autoGenerateMips = true, bool isShadowMap = false, int anisoLevel = 1, float mipMapBias = 0, MSAASamples msaaSamples = MSAASamples.None, bool bindTextureMS = false, bool useDynamicScale = false, bool useDynamicScaleExplicit = false, RenderTextureMemoryless memoryless = RenderTextureMemoryless.None, VRTextureUsage vrUsage = VRTextureUsage.None, string name = "")
    Parameters
    Type Name Description
    int width

    With of the RTHandle.

    int height

    Heigh of the RTHandle.

    int slices

    Number of slices of the RTHandle.

    DepthBits depthBufferBits

    Bit depths of a depth buffer.

    GraphicsFormat colorFormat

    GraphicsFormat of a color buffer.

    FilterMode filterMode

    Filtering mode of the RTHandle.

    TextureWrapMode wrapMode

    Addressing mode of the RTHandle.

    TextureDimension dimension

    Texture dimension of the RTHandle.

    bool enableRandomWrite

    Set to true to enable UAV random read writes on the texture.

    bool useMipMap

    Set to true if the texture should have mipmaps.

    bool autoGenerateMips

    Set to true to automatically generate mipmaps.

    bool isShadowMap

    Set to true if the depth buffer should be used as a shadow map.

    int anisoLevel

    Anisotropic filtering level.

    float mipMapBias

    Bias applied to mipmaps during filtering.

    MSAASamples msaaSamples

    Number of MSAA samples for the RTHandle.

    bool bindTextureMS

    Set to true if the texture needs to be bound as a multisampled texture in the shader.

    bool useDynamicScale

    See Dynamic Resolution documentation

    bool useDynamicScaleExplicit

    See Dynamic Resolution documentation

    RenderTextureMemoryless memoryless

    Use this property to set the render texture memoryless modes.

    VRTextureUsage vrUsage

    Special treatment of the VR eye texture used in stereoscopic rendering.

    string name

    Name of the RTHandle.

    Returns
    Type Description
    RTHandle

    A new RTHandle.

    Alloc(int, int, RTHandleAllocInfo)

    Allocate a new fixed sized RTHandle.

    Declaration
    public RTHandle Alloc(int width, int height, RTHandleAllocInfo info)
    Parameters
    Type Name Description
    int width

    With of the RTHandle.

    int height

    Height of the RTHandle.

    RTHandleAllocInfo info

    Struct containing details of allocation

    Returns
    Type Description
    RTHandle

    A new RTHandle.

    Alloc(int, int, TextureWrapMode, TextureWrapMode, TextureWrapMode, int, DepthBits, GraphicsFormat, FilterMode, TextureDimension, bool, bool, bool, bool, int, float, MSAASamples, bool, bool, bool, RenderTextureMemoryless, VRTextureUsage, string)

    Allocate a new fixed sized RTHandle.

    Declaration
    public RTHandle Alloc(int width, int height, TextureWrapMode wrapModeU, TextureWrapMode wrapModeV, TextureWrapMode wrapModeW = TextureWrapMode.Repeat, int slices = 1, DepthBits depthBufferBits = DepthBits.None, GraphicsFormat colorFormat = GraphicsFormat.R8G8B8A8_SRGB, FilterMode filterMode = FilterMode.Point, TextureDimension dimension = TextureDimension.Tex2D, bool enableRandomWrite = false, bool useMipMap = false, bool autoGenerateMips = true, bool isShadowMap = false, int anisoLevel = 1, float mipMapBias = 0, MSAASamples msaaSamples = MSAASamples.None, bool bindTextureMS = false, bool useDynamicScale = false, bool useDynamicScaleExplicit = false, RenderTextureMemoryless memoryless = RenderTextureMemoryless.None, VRTextureUsage vrUsage = VRTextureUsage.None, string name = "")
    Parameters
    Type Name Description
    int width

    With of the RTHandle.

    int height

    Heigh of the RTHandle.

    TextureWrapMode wrapModeU

    U coordinate wrapping mode of the RTHandle.

    TextureWrapMode wrapModeV

    V coordinate wrapping mode of the RTHandle.

    TextureWrapMode wrapModeW

    W coordinate wrapping mode of the RTHandle.

    int slices

    Number of slices of the RTHandle.

    DepthBits depthBufferBits

    Bit depths of a depth buffer.

    GraphicsFormat colorFormat

    GraphicsFormat of a color buffer.

    FilterMode filterMode

    Filtering mode of the RTHandle.

    TextureDimension dimension

    Texture dimension of the RTHandle.

    bool enableRandomWrite

    Set to true to enable UAV random read writes on the texture.

    bool useMipMap

    Set to true if the texture should have mipmaps.

    bool autoGenerateMips

    Set to true to automatically generate mipmaps.

    bool isShadowMap

    Set to true if the depth buffer should be used as a shadow map.

    int anisoLevel

    Anisotropic filtering level.

    float mipMapBias

    Bias applied to mipmaps during filtering.

    MSAASamples msaaSamples

    Number of MSAA samples for the RTHandle.

    bool bindTextureMS

    Set to true if the texture needs to be bound as a multisampled texture in the shader.

    bool useDynamicScale

    See Dynamic Resolution documentation

    bool useDynamicScaleExplicit

    See Dynamic Resolution documentation

    RenderTextureMemoryless memoryless

    Use this property to set the render texture memoryless modes.

    VRTextureUsage vrUsage

    Special treatment of the VR eye texture used in stereoscopic rendering.

    string name

    Name of the RTHandle.

    Returns
    Type Description
    RTHandle

    A new RTHandle.

    Alloc(RenderTexture, bool)

    Allocate a RTHandle from a regular RenderTexture.

    Declaration
    public RTHandle Alloc(RenderTexture texture, bool transferOwnership = false)
    Parameters
    Type Name Description
    RenderTexture texture

    Input texture

    bool transferOwnership

    Says if the RTHandleSystem has the ownership of the external RenderTarget, false by default

    Returns
    Type Description
    RTHandle

    A new RTHandle referencing the input texture.

    Alloc(RenderTargetIdentifier)

    Allocate a RTHandle from a regular render target identifier.

    Declaration
    public RTHandle Alloc(RenderTargetIdentifier texture)
    Parameters
    Type Name Description
    RenderTargetIdentifier texture

    Input render target identifier.

    Returns
    Type Description
    RTHandle

    A new RTHandle referencing the input render target identifier.

    Alloc(RenderTargetIdentifier, string)

    Allocate a RTHandle from a regular render target identifier.

    Declaration
    public RTHandle Alloc(RenderTargetIdentifier texture, string name)
    Parameters
    Type Name Description
    RenderTargetIdentifier texture

    Input render target identifier.

    string name

    Name of the texture.

    Returns
    Type Description
    RTHandle

    A new RTHandle referencing the input render target identifier.

    Alloc(ScaleFunc, int, DepthBits, GraphicsFormat, FilterMode, TextureWrapMode, TextureDimension, bool, bool, bool, bool, int, float, MSAASamples, bool, bool, bool, RenderTextureMemoryless, VRTextureUsage, string)

    Allocate a new automatically sized RTHandle.

    Declaration
    public RTHandle Alloc(ScaleFunc scaleFunc, int slices = 1, DepthBits depthBufferBits = DepthBits.None, GraphicsFormat colorFormat = GraphicsFormat.R8G8B8A8_SRGB, FilterMode filterMode = FilterMode.Point, TextureWrapMode wrapMode = TextureWrapMode.Repeat, TextureDimension dimension = TextureDimension.Tex2D, bool enableRandomWrite = false, bool useMipMap = false, bool autoGenerateMips = true, bool isShadowMap = false, int anisoLevel = 1, float mipMapBias = 0, MSAASamples msaaSamples = MSAASamples.None, bool bindTextureMS = false, bool useDynamicScale = false, bool useDynamicScaleExplicit = false, RenderTextureMemoryless memoryless = RenderTextureMemoryless.None, VRTextureUsage vrUsage = VRTextureUsage.None, string name = "")
    Parameters
    Type Name Description
    ScaleFunc scaleFunc

    Function used for the RTHandle size computation.

    int slices

    Number of slices of the RTHandle.

    DepthBits depthBufferBits

    Bit depths of a depth buffer.

    GraphicsFormat colorFormat

    GraphicsFormat of a color buffer.

    FilterMode filterMode

    Filtering mode of the RTHandle.

    TextureWrapMode wrapMode

    Addressing mode of the RTHandle.

    TextureDimension dimension

    Texture dimension of the RTHandle.

    bool enableRandomWrite

    Set to true to enable UAV random read writes on the texture.

    bool useMipMap

    Set to true if the texture should have mipmaps.

    bool autoGenerateMips

    Set to true to automatically generate mipmaps.

    bool isShadowMap

    Set to true if the depth buffer should be used as a shadow map.

    int anisoLevel

    Anisotropic filtering level.

    float mipMapBias

    Bias applied to mipmaps during filtering.

    MSAASamples msaaSamples

    Number of MSAA samples.

    bool bindTextureMS

    Set to true if the texture needs to be bound as a multisampled texture in the shader.

    bool useDynamicScale

    See Dynamic Resolution documentation

    bool useDynamicScaleExplicit

    See Dynamic Resolution documentation

    RenderTextureMemoryless memoryless

    Use this property to set the render texture memoryless modes.

    VRTextureUsage vrUsage

    Special treatment of the VR eye texture used in stereoscopic rendering.

    string name

    Name of the RTHandle.

    Returns
    Type Description
    RTHandle

    A new RTHandle.

    Alloc(ScaleFunc, RTHandleAllocInfo)

    Allocate a new automatically sized RTHandle.

    Declaration
    public RTHandle Alloc(ScaleFunc scaleFunc, RTHandleAllocInfo info)
    Parameters
    Type Name Description
    ScaleFunc scaleFunc

    Function used for the RTHandle size computation.

    RTHandleAllocInfo info

    Struct containing details of allocation

    Returns
    Type Description
    RTHandle

    A new RTHandle.

    Alloc(Texture)

    Allocate a RTHandle from a regular Texture.

    Declaration
    public RTHandle Alloc(Texture texture)
    Parameters
    Type Name Description
    Texture texture

    Input texture

    Returns
    Type Description
    RTHandle

    A new RTHandle referencing the input texture.

    Alloc(Vector2, int, DepthBits, GraphicsFormat, FilterMode, TextureWrapMode, TextureDimension, bool, bool, bool, bool, int, float, MSAASamples, bool, bool, bool, RenderTextureMemoryless, VRTextureUsage, string)

    Allocate a new automatically sized RTHandle.

    Declaration
    public RTHandle Alloc(Vector2 scaleFactor, int slices = 1, DepthBits depthBufferBits = DepthBits.None, GraphicsFormat colorFormat = GraphicsFormat.R8G8B8A8_SRGB, FilterMode filterMode = FilterMode.Point, TextureWrapMode wrapMode = TextureWrapMode.Repeat, TextureDimension dimension = TextureDimension.Tex2D, bool enableRandomWrite = false, bool useMipMap = false, bool autoGenerateMips = true, bool isShadowMap = false, int anisoLevel = 1, float mipMapBias = 0, MSAASamples msaaSamples = MSAASamples.None, bool bindTextureMS = false, bool useDynamicScale = false, bool useDynamicScaleExplicit = false, RenderTextureMemoryless memoryless = RenderTextureMemoryless.None, VRTextureUsage vrUsage = VRTextureUsage.None, string name = "")
    Parameters
    Type Name Description
    Vector2 scaleFactor

    Constant scale for the RTHandle size computation.

    int slices

    Number of slices of the RTHandle.

    DepthBits depthBufferBits

    Bit depths of a depth buffer.

    GraphicsFormat colorFormat

    GraphicsFormat of a color buffer.

    FilterMode filterMode

    Filtering mode of the RTHandle.

    TextureWrapMode wrapMode

    Addressing mode of the RTHandle.

    TextureDimension dimension

    Texture dimension of the RTHandle.

    bool enableRandomWrite

    Set to true to enable UAV random read writes on the texture.

    bool useMipMap

    Set to true if the texture should have mipmaps.

    bool autoGenerateMips

    Set to true to automatically generate mipmaps.

    bool isShadowMap

    Set to true if the depth buffer should be used as a shadow map.

    int anisoLevel

    Anisotropic filtering level.

    float mipMapBias

    Bias applied to mipmaps during filtering.

    MSAASamples msaaSamples

    Number of MSAA samples.

    bool bindTextureMS

    Set to true if the texture needs to be bound as a multisampled texture in the shader.

    bool useDynamicScale

    See Dynamic Resolution documentation

    bool useDynamicScaleExplicit

    See Dynamic Resolution documentation

    RenderTextureMemoryless memoryless

    Use this property to set the render texture memoryless modes.

    VRTextureUsage vrUsage

    Special treatment of the VR eye texture used in stereoscopic rendering.

    string name

    Name of the RTHandle.

    Returns
    Type Description
    RTHandle

    A new RTHandle.

    Alloc(Vector2, RTHandleAllocInfo)

    Allocate a new automatically sized RTHandle.

    Declaration
    public RTHandle Alloc(Vector2 scaleFactor, RTHandleAllocInfo info)
    Parameters
    Type Name Description
    Vector2 scaleFactor

    Constant scale for the RTHandle size computation.

    RTHandleAllocInfo info

    Struct containing details of allocation

    Returns
    Type Description
    RTHandle

    A new RTHandle.

    CalculateDimensions(ScaleFunc)

    Calculate the dimensions (in pixels) of the RTHandles given the scale function. The base unscaled size used, is the sizes passed to the last ResetReferenceSize call.

    Declaration
    public Vector2Int CalculateDimensions(ScaleFunc scaleFunc)
    Parameters
    Type Name Description
    ScaleFunc scaleFunc

    The scale function to use when calculating the dimensions.

    Returns
    Type Description
    Vector2Int

    The calculated dimensions.

    CalculateDimensions(Vector2)

    Calculate the dimensions (in pixels) of the RTHandles given the scale factor.

    Declaration
    public Vector2Int CalculateDimensions(Vector2 scaleFactor)
    Parameters
    Type Name Description
    Vector2 scaleFactor

    The scale factor to use when calculating the dimensions. The base unscaled size used, is the sizes passed to the last ResetReferenceSize call.

    Returns
    Type Description
    Vector2Int

    The calculated dimensions.

    Dispose()

    Disposable pattern implementation

    Declaration
    public void Dispose()

    GetMaxHeight()

    Returns the maximum allocated height of the RTHandle System.

    Declaration
    public int GetMaxHeight()
    Returns
    Type Description
    int

    Maximum allocated height of the RTHandle System.

    GetMaxWidth()

    Returns the maximum allocated width of the RTHandle System.

    Declaration
    public int GetMaxWidth()
    Returns
    Type Description
    int

    Maximum allocated width of the RTHandle System.

    Initialize(int, int)

    Initialize the RTHandle system.

    Declaration
    public void Initialize(int width, int height)
    Parameters
    Type Name Description
    int width

    Initial reference rendering width.

    int height

    Initial reference rendering height.

    Initialize(int, int, bool)

    Initialize the RTHandle system.

    Declaration
    [Obsolete("useLegacyDynamicResControl is deprecated. Please use SetHardwareDynamicResolutionState() instead.")]
    public void Initialize(int width, int height, bool useLegacyDynamicResControl = false)
    Parameters
    Type Name Description
    int width

    Initial reference rendering width.

    int height

    Initial reference rendering height.

    bool useLegacyDynamicResControl

    Use legacy hardware DynamicResolution control in RTHandle system.

    Release(RTHandle)

    Release memory of a RTHandle from the RTHandle System

    Declaration
    public void Release(RTHandle rth)
    Parameters
    Type Name Description
    RTHandle rth

    RTHandle that should be released.

    ResetReferenceSize(int, int)

    Reset the reference size of the system and reallocate all textures.

    Declaration
    public void ResetReferenceSize(int width, int height)
    Parameters
    Type Name Description
    int width

    New width.

    int height

    New height.

    SetHardwareDynamicResolutionState(bool)

    Enable or disable hardware dynamic resolution for the RTHandle System

    Declaration
    public void SetHardwareDynamicResolutionState(bool enableHWDynamicRes)
    Parameters
    Type Name Description
    bool enableHWDynamicRes

    State of hardware dynamic resolution.

    SetReferenceSize(int, int)

    Sets the reference rendering size for subsequent rendering for the RTHandle System

    Declaration
    public void SetReferenceSize(int width, int height)
    Parameters
    Type Name Description
    int width

    Reference rendering width for subsequent rendering.

    int height

    Reference rendering height for subsequent rendering.

    SetReferenceSize(int, int, bool)

    Sets the reference rendering size for subsequent rendering for the RTHandle System

    Declaration
    public void SetReferenceSize(int width, int height, bool reset)
    Parameters
    Type Name Description
    int width

    Reference rendering width for subsequent rendering.

    int height

    Reference rendering height for subsequent rendering.

    bool reset

    If set to true, the new width and height will override the old values even if they are not bigger.

    Implements

    IDisposable

    Extension Methods

    ReflectionUtils.GetField(object, string)
    ReflectionUtils.GetFields(object)
    ReflectionUtils.Invoke(object, string, params object[])
    ReflectionUtils.SetField(object, string, object)
    AnalyticsUtils.ToNestedColumnWithDefault<T>(T, T, bool)
    AnalyticsUtils.ToNestedColumn<T>(T, bool)
    AnalyticsUtils.ToNestedColumn<T>(T, T)
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)