using System; using UnityEngine.Assertions; using UnityEngine.Experimental.Rendering; namespace UnityEngine.Rendering { /// /// Default instance of a RTHandleSystem /// public static class RTHandles { static RTHandleSystem s_DefaultInstance = new RTHandleSystem(); /// /// Maximum allocated width of the default RTHandle System /// public static int maxWidth { get { return s_DefaultInstance.GetMaxWidth(); } } /// /// Maximum allocated height of the default RTHandle System /// public static int maxHeight { get { return s_DefaultInstance.GetMaxHeight(); } } /// /// Current properties of the default RTHandle System /// public static RTHandleProperties rtHandleProperties { get { return s_DefaultInstance.rtHandleProperties; } } /// /// Calculate the dimensions (in pixels) of the RTHandles given the scale factor. /// /// The scale factor to use when calculating the dimensions. The base unscaled size used, is the sizes passed to the last ResetReferenceSize call. /// The calculated dimensions. public static Vector2Int CalculateDimensions(Vector2 scaleFactor) { return s_DefaultInstance.CalculateDimensions(scaleFactor); } /// /// 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. /// /// The scale function to use when calculating the dimensions. /// The calculated dimensions. public static Vector2Int CalculateDimensions(ScaleFunc scaleFunc) { return s_DefaultInstance.CalculateDimensions(scaleFunc); } /// /// Allocate a new fixed sized RTHandle with the default RTHandle System. /// /// With of the RTHandle. /// Heigh of the RTHandle. /// Number of slices of the RTHandle. /// Bit depths of a depth buffer. /// GraphicsFormat of a color buffer. /// Filtering mode of the RTHandle. /// Addressing mode of the RTHandle. /// Texture dimension of the RTHandle. /// Set to true to enable UAV random read writes on the texture. /// Set to true if the texture should have mipmaps. /// Set to true to automatically generate mipmaps. /// Set to true if the depth buffer should be used as a shadow map. /// Anisotropic filtering level. /// Bias applied to mipmaps during filtering. /// Number of MSAA samples for the RTHandle. /// Set to true if the texture needs to be bound as a multisampled texture in the shader. /// [See Dynamic Resolution documentation](https://docs.unity3d.com/Manual/DynamicResolution.html) /// [See Dynamic Resolution documentation](https://docs.unity3d.com/Manual/DynamicResolution.html) /// Use this property to set the render texture memoryless modes. /// Special treatment of the VR eye texture used in stereoscopic rendering. /// Name of the RTHandle. /// A new RTHandle. public static 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 = "" ) { return s_DefaultInstance.Alloc( width, height, slices, depthBufferBits, colorFormat, filterMode, wrapMode, dimension, enableRandomWrite, useMipMap, autoGenerateMips, isShadowMap, anisoLevel, mipMapBias, msaaSamples, bindTextureMS, useDynamicScale, useDynamicScaleExplicit, memoryless, vrUsage, name ); } /// /// Allocate a new fixed sized RTHandle with the default RTHandle System. /// /// With of the RTHandle. /// Heigh of the RTHandle. /// GraphicsFormat of a color or depth stencil buffer. /// Number of slices of the RTHandle. /// Filtering mode of the RTHandle. /// Addressing mode of the RTHandle. /// Texture dimension of the RTHandle. /// Set to true to enable UAV random read writes on the texture. /// Set to true if the texture should have mipmaps. /// Set to true to automatically generate mipmaps. /// Set to true if the depth buffer should be used as a shadow map. /// Anisotropic filtering level. /// Bias applied to mipmaps during filtering. /// Number of MSAA samples for the RTHandle. /// Set to true if the texture needs to be bound as a multisampled texture in the shader. /// [See Dynamic Resolution documentation](https://docs.unity3d.com/Manual/DynamicResolution.html) /// [See Dynamic Resolution documentation](https://docs.unity3d.com/Manual/DynamicResolution.html) /// Use this property to set the render texture memoryless modes. /// Special treatment of the VR eye texture used in stereoscopic rendering. /// Name of the RTHandle. /// A new RTHandle. public static RTHandle Alloc( int width, int height, GraphicsFormat format, int slices = 1, 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 = "" ) { return s_DefaultInstance.Alloc( width, height, format, slices, filterMode, wrapMode, dimension, enableRandomWrite, useMipMap, autoGenerateMips, isShadowMap, anisoLevel, mipMapBias, msaaSamples, bindTextureMS, useDynamicScale, useDynamicScaleExplicit, memoryless, vrUsage, name ); } /// /// Allocate a new fixed sized RTHandle with the default RTHandle System. /// /// With of the RTHandle. /// Heigh of the RTHandle. /// U coordinate wrapping mode of the RTHandle. /// V coordinate wrapping mode of the RTHandle. /// W coordinate wrapping mode of the RTHandle. /// Number of slices of the RTHandle. /// Bit depths of a depth buffer. /// GraphicsFormat of a color buffer. /// Filtering mode of the RTHandle. /// Texture dimension of the RTHandle. /// Set to true to enable UAV random read writes on the texture. /// Set to true if the texture should have mipmaps. /// Set to true to automatically generate mipmaps. /// Set to true if the depth buffer should be used as a shadow map. /// Anisotropic filtering level. /// Bias applied to mipmaps during filtering. /// Number of MSAA samples for the RTHandle. /// Set to true if the texture needs to be bound as a multisampled texture in the shader. /// [See Dynamic Resolution documentation](https://docs.unity3d.com/Manual/DynamicResolution.html) /// [See Dynamic Resolution documentation](https://docs.unity3d.com/Manual/DynamicResolution.html) /// Use this property to set the render texture memoryless modes. /// Special treatment of the VR eye texture used in stereoscopic rendering. /// Name of the RTHandle. /// A new RTHandle. public static 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 = "" ) { return s_DefaultInstance.Alloc( width, height, wrapModeU, wrapModeV, wrapModeW, slices, depthBufferBits, colorFormat, filterMode, dimension, enableRandomWrite, useMipMap, autoGenerateMips, isShadowMap, anisoLevel, mipMapBias, msaaSamples, bindTextureMS, useDynamicScale, useDynamicScaleExplicit, memoryless, vrUsage, name ); } /// /// Allocate a new fixed sized RTHandle with the default RTHandle System. /// /// With of the RTHandle. /// Height of the RTHandle. /// Struct containing details of allocation /// A new RTHandle. public static RTHandle Alloc(int width, int height, RTHandleAllocInfo info) { return s_DefaultInstance.Alloc(width, height, info); } /// /// Allocate a new fixed sized RTHandle with the default RTHandle System. /// /// RenderTexture descriptor of the RTHandle. /// Filtering mode of the RTHandle. /// Addressing mode of the RTHandle. /// Set to true if the depth buffer should be used as a shadow map. /// Anisotropic filtering level. /// Bias applied to mipmaps during filtering. /// Name of the RTHandle. /// A new RTHandle. public static RTHandle Alloc( in RenderTextureDescriptor descriptor, FilterMode filterMode = FilterMode.Point, TextureWrapMode wrapMode = TextureWrapMode.Repeat, bool isShadowMap = false, int anisoLevel = 1, float mipMapBias = 0, string name = "" ) { var format = GetFormat(descriptor.graphicsFormat, descriptor.depthStencilFormat); var result = s_DefaultInstance.Alloc( descriptor.width, descriptor.height, format, descriptor.volumeDepth, filterMode, wrapMode, descriptor.dimension, descriptor.enableRandomWrite, descriptor.useMipMap, descriptor.autoGenerateMips, isShadowMap, anisoLevel, mipMapBias, (MSAASamples)descriptor.msaaSamples, descriptor.bindMS, descriptor.useDynamicScale, descriptor.useDynamicScaleExplicit, descriptor.memoryless, descriptor.vrUsage, name ); return result; } static internal GraphicsFormat GetFormat(GraphicsFormat colorFormat, GraphicsFormat depthStencilFormat) { return (depthStencilFormat==GraphicsFormat.None) ? colorFormat : depthStencilFormat; } /// /// Allocate a new automatically sized RTHandle for the default RTHandle System. /// /// Constant scale for the RTHandle size computation. /// Number of slices of the RTHandle. /// Bit depths of a depth buffer. /// GraphicsFormat of a color buffer. /// Filtering mode of the RTHandle. /// Addressing mode of the RTHandle. /// Texture dimension of the RTHandle. /// Set to true to enable UAV random read writes on the texture. /// Set to true if the texture should have mipmaps. /// Set to true to automatically generate mipmaps. /// Set to true if the depth buffer should be used as a shadow map. /// Anisotropic filtering level. /// Bias applied to mipmaps during filtering. /// Number of MSAA samples. /// Set to true if the texture needs to be bound as a multisampled texture in the shader. /// [See Dynamic Resolution documentation](https://docs.unity3d.com/Manual/DynamicResolution.html) /// [See Dynamic Resolution documentation](https://docs.unity3d.com/Manual/DynamicResolution.html) /// Use this property to set the render texture memoryless modes. /// Special treatment of the VR eye texture used in stereoscopic rendering. /// Name of the RTHandle. /// A new RTHandle. public static 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 = "" ) { return s_DefaultInstance.Alloc( scaleFactor, slices, depthBufferBits, colorFormat, filterMode, wrapMode, dimension, enableRandomWrite, useMipMap, autoGenerateMips, isShadowMap, anisoLevel, mipMapBias, msaaSamples, bindTextureMS, useDynamicScale, useDynamicScaleExplicit, memoryless, vrUsage, name ); } /// /// Allocate a new automatically sized RTHandle for the default RTHandle System. /// /// Constant scale for the RTHandle size computation. /// GraphicsFormat of a color or depth stencil buffer. /// Number of slices of the RTHandle. /// Filtering mode of the RTHandle. /// Addressing mode of the RTHandle. /// Texture dimension of the RTHandle. /// Set to true to enable UAV random read writes on the texture. /// Set to true if the texture should have mipmaps. /// Set to true to automatically generate mipmaps. /// Set to true if the depth buffer should be used as a shadow map. /// Anisotropic filtering level. /// Bias applied to mipmaps during filtering. /// Number of MSAA samples. /// Set to true if the texture needs to be bound as a multisampled texture in the shader. /// [See Dynamic Resolution documentation](https://docs.unity3d.com/Manual/DynamicResolution.html) /// [See Dynamic Resolution documentation](https://docs.unity3d.com/Manual/DynamicResolution.html) /// Use this property to set the render texture memoryless modes. /// Special treatment of the VR eye texture used in stereoscopic rendering. /// Name of the RTHandle. /// A new RTHandle. public static RTHandle Alloc( Vector2 scaleFactor, GraphicsFormat format, int slices = 1, 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 = "" ) { return s_DefaultInstance.Alloc( scaleFactor, format, slices, filterMode, wrapMode, dimension, enableRandomWrite, useMipMap, autoGenerateMips, isShadowMap, anisoLevel, mipMapBias, msaaSamples, bindTextureMS, useDynamicScale, useDynamicScaleExplicit, memoryless, vrUsage, name ); } /// /// Allocate a new automatically sized RTHandle for the default RTHandle System. /// /// Constant scale for the RTHandle size computation. /// RenderTexture descriptor of the RTHandle. /// Filtering mode of the RTHandle. /// Addressing mode of the RTHandle. /// Set to true if the depth buffer should be used as a shadow map. /// Anisotropic filtering level. /// Bias applied to mipmaps during filtering. /// Name of the RTHandle. /// A new RTHandle. public static RTHandle Alloc( Vector2 scaleFactor, in RenderTextureDescriptor descriptor, FilterMode filterMode = FilterMode.Point, TextureWrapMode wrapMode = TextureWrapMode.Repeat, bool isShadowMap = false, int anisoLevel = 1, float mipMapBias = 0, string name = "" ) { var format = GetFormat(descriptor.graphicsFormat, descriptor.depthStencilFormat); return s_DefaultInstance.Alloc( scaleFactor, format, descriptor.volumeDepth, filterMode, wrapMode, descriptor.dimension, descriptor.enableRandomWrite, descriptor.useMipMap, descriptor.autoGenerateMips, isShadowMap, anisoLevel, mipMapBias, (MSAASamples)descriptor.msaaSamples, descriptor.bindMS, descriptor.useDynamicScale, descriptor.useDynamicScaleExplicit, descriptor.memoryless, descriptor.vrUsage, name ); } /// /// Allocate a new automatically sized RTHandle for the default RTHandle System. /// /// Constant scale for the RTHandle size computation. /// Struct containing details of allocation /// A new RTHandle. public static RTHandle Alloc(Vector2 scaleFactor, RTHandleAllocInfo info) { return s_DefaultInstance.Alloc(scaleFactor, info); } /// /// Allocate a new automatically sized RTHandle for the default RTHandle System. /// /// Function used for the RTHandle size computation. /// Number of slices of the RTHandle. /// Bit depths of a depth buffer. /// GraphicsFormat of a color buffer. /// Filtering mode of the RTHandle. /// Addressing mode of the RTHandle. /// Texture dimension of the RTHandle. /// Set to true to enable UAV random read writes on the texture. /// Set to true if the texture should have mipmaps. /// Set to true to automatically generate mipmaps. /// Set to true if the depth buffer should be used as a shadow map. /// Anisotropic filtering level. /// Bias applied to mipmaps during filtering. /// Number of MSAA samples. /// Set to true if the texture needs to be bound as a multisampled texture in the shader. /// [See Dynamic Resolution documentation](https://docs.unity3d.com/Manual/DynamicResolution.html) /// [See Dynamic Resolution documentation](https://docs.unity3d.com/Manual/DynamicResolution.html) /// Use this property to set the render texture memoryless modes. /// Special treatment of the VR eye texture used in stereoscopic rendering. /// Name of the RTHandle. /// A new RTHandle. public static 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 = "" ) { return s_DefaultInstance.Alloc( scaleFunc, slices, depthBufferBits, colorFormat, filterMode, wrapMode, dimension, enableRandomWrite, useMipMap, autoGenerateMips, isShadowMap, anisoLevel, mipMapBias, msaaSamples, bindTextureMS, useDynamicScale, useDynamicScaleExplicit, memoryless, vrUsage, name ); } /// /// Allocate a new automatically sized RTHandle for the default RTHandle System. /// /// Function used for the RTHandle size computation. /// GraphicsFormat of a color or depth stencil buffer. /// Number of slices of the RTHandle. /// Filtering mode of the RTHandle. /// Addressing mode of the RTHandle. /// Texture dimension of the RTHandle. /// Set to true to enable UAV random read writes on the texture. /// Set to true if the texture should have mipmaps. /// Set to true to automatically generate mipmaps. /// Set to true if the depth buffer should be used as a shadow map. /// Anisotropic filtering level. /// Bias applied to mipmaps during filtering. /// Number of MSAA samples. /// Set to true if the texture needs to be bound as a multisampled texture in the shader. /// [See Dynamic Resolution documentation](https://docs.unity3d.com/Manual/DynamicResolution.html) /// [See Dynamic Resolution documentation](https://docs.unity3d.com/Manual/DynamicResolution.html) /// Use this property to set the render texture memoryless modes. /// Special treatment of the VR eye texture used in stereoscopic rendering. /// Name of the RTHandle. /// A new RTHandle. public static RTHandle Alloc( ScaleFunc scaleFunc, GraphicsFormat format, int slices = 1, 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 = "" ) { return s_DefaultInstance.Alloc( scaleFunc, format, slices, filterMode, wrapMode, dimension, enableRandomWrite, useMipMap, autoGenerateMips, isShadowMap, anisoLevel, mipMapBias, msaaSamples, bindTextureMS, useDynamicScale, useDynamicScaleExplicit, memoryless, vrUsage, name ); } /// /// Allocate a new automatically sized RTHandle for the default RTHandle System. /// /// Function used for the RTHandle size computation. /// RenderTexture descriptor of the RTHandle. /// Filtering mode of the RTHandle. /// Addressing mode of the RTHandle. /// Set to true if the depth buffer should be used as a shadow map. /// Anisotropic filtering level. /// Bias applied to mipmaps during filtering. /// Name of the RTHandle. /// A new RTHandle. public static RTHandle Alloc( ScaleFunc scaleFunc, in RenderTextureDescriptor descriptor, FilterMode filterMode = FilterMode.Point, TextureWrapMode wrapMode = TextureWrapMode.Repeat, bool isShadowMap = false, int anisoLevel = 1, float mipMapBias = 0, string name = "" ) { Assert.IsFalse(descriptor.graphicsFormat != GraphicsFormat.None && descriptor.depthStencilFormat != GraphicsFormat.None, "The RenderTextureDescriptor used to create RTHandle " + name + " contains both graphicsFormat and depthStencilFormat which is not allowed."); var format = GetFormat( descriptor.graphicsFormat, descriptor.depthStencilFormat); return s_DefaultInstance.Alloc( scaleFunc, format, descriptor.volumeDepth, filterMode, wrapMode, descriptor.dimension, descriptor.enableRandomWrite, descriptor.useMipMap, descriptor.autoGenerateMips, isShadowMap, anisoLevel, mipMapBias, (MSAASamples)descriptor.msaaSamples, descriptor.bindMS, descriptor.useDynamicScale, descriptor.useDynamicScaleExplicit, descriptor.memoryless, descriptor.vrUsage, name ); } /// /// Allocate a new automatically sized RTHandle for the default RTHandle System. /// /// Function used for the RTHandle size computation. /// Struct containing details of allocation /// A new RTHandle. public static RTHandle Alloc(ScaleFunc scaleFunc, RTHandleAllocInfo info) { return s_DefaultInstance.Alloc(scaleFunc, info); } /// /// Allocate a RTHandle from a regular Texture for the default RTHandle system. /// /// Input texture /// A new RTHandle referencing the input texture. public static RTHandle Alloc(Texture tex) { return s_DefaultInstance.Alloc(tex); } /// /// Allocate a RTHandle from a regular RenderTexture for the default RTHandle system. /// /// Input texture /// To transfer ownership of the RenderTexture to the default RTHandles system, false by default /// A new RTHandle referencing the input texture. public static RTHandle Alloc(RenderTexture tex, bool transferOwnership = false) { return s_DefaultInstance.Alloc(tex, transferOwnership); } /// /// Allocate a RTHandle from a regular render target identifier for the default RTHandle system. /// /// Input render target identifier. /// A new RTHandle referencing the input render target identifier. public static RTHandle Alloc(RenderTargetIdentifier tex) { return s_DefaultInstance.Alloc(tex); } /// /// Allocate a RTHandle from a regular render target identifier for the default RTHandle system. /// /// Input render target identifier. /// Name of the render target. /// A new RTHandle referencing the input render target identifier. public static RTHandle Alloc(RenderTargetIdentifier tex, string name) { return s_DefaultInstance.Alloc(tex, name); } private static RTHandle Alloc(RTHandle tex) { Debug.LogError("Allocation a RTHandle from another one is forbidden."); return null; } /// /// Initialize the default RTHandle system. /// /// Initial reference rendering width. /// Initial reference rendering height. public static void Initialize(int width, int height) { s_DefaultInstance.Initialize(width, height); } /// /// Initialize the default RTHandle system. /// /// Initial reference rendering width. /// Initial reference rendering height. /// Use legacy hardware DynamicResolution control in the default RTHandle system. [Obsolete("useLegacyDynamicResControl is deprecated. Please use SetHardwareDynamicResolutionState() instead.")] public static void Initialize(int width, int height, bool useLegacyDynamicResControl = false) { s_DefaultInstance.Initialize(width, height, useLegacyDynamicResControl); } /// /// Release memory of a RTHandle from the default RTHandle System /// /// RTHandle that should be released. public static void Release(RTHandle rth) { s_DefaultInstance.Release(rth); } /// /// Enable or disable hardware dynamic resolution for the default RTHandle System /// /// State of hardware dynamic resolution. public static void SetHardwareDynamicResolutionState(bool hwDynamicResRequested) { s_DefaultInstance.SetHardwareDynamicResolutionState(hwDynamicResRequested); } /// /// Sets the reference rendering size for subsequent rendering for the default RTHandle System /// /// Reference rendering width for subsequent rendering. /// Reference rendering height for subsequent rendering. public static void SetReferenceSize(int width, int height) { s_DefaultInstance.SetReferenceSize(width, height); } /// /// Reset the reference size of the system and reallocate all textures. /// /// New width. /// New height. public static void ResetReferenceSize(int width, int height) { s_DefaultInstance.ResetReferenceSize(width, height); } /// /// Returns the ratio against the current target's max resolution /// /// width to utilize /// height to utilize /// retruns the width,height / maxTargetSize.xy ratio. public static Vector2 CalculateRatioAgainstMaxSize(int width, int height) { return s_DefaultInstance.CalculateRatioAgainstMaxSize(new Vector2Int(width, height)); } } }