Class RTHandleSystem
System managing a set of RTHandle textures
Namespace: UnityEngine.Rendering
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(Int32, Int32, Int32, DepthBits, GraphicsFormat, FilterMode, TextureWrapMode, TextureDimension, Boolean, Boolean, Boolean, Boolean, Int32, Single, MSAASamples, Boolean, Boolean, 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 = 0F, MSAASamples msaaSamples = MSAASamples.None, bool bindTextureMS = false, bool useDynamicScale = false, RenderTextureMemoryless memoryless = RenderTextureMemoryless.None, VRTextureUsage vrUsage = VRTextureUsage.None, string name = "")
Parameters
Type | Name | Description |
---|---|---|
Int32 | width | With of the RTHandle. |
Int32 | height | Heigh of the RTHandle. |
Int32 | 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. |
Boolean | enableRandomWrite | Set to true to enable UAV random read writes on the texture. |
Boolean | useMipMap | Set to true if the texture should have mipmaps. |
Boolean | autoGenerateMips | Set to true to automatically generate mipmaps. |
Boolean | isShadowMap | Set to true if the depth buffer should be used as a shadow map. |
Int32 | anisoLevel | Anisotropic filtering level. |
Single | mipMapBias | Bias applied to mipmaps during filtering. |
MSAASamples | msaaSamples | Number of MSAA samples for the RTHandle. |
Boolean | bindTextureMS | Set to true if the texture needs to be bound as a multisampled texture in the shader. |
Boolean | useDynamicScale | Set to true to use hardware dynamic scaling. |
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 |
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, Int32, DepthBits, GraphicsFormat, FilterMode, TextureWrapMode, TextureDimension, Boolean, Boolean, Boolean, Boolean, Int32, Single, MSAASamples, Boolean, Boolean, 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 = 0F, MSAASamples msaaSamples = MSAASamples.None, bool bindTextureMS = false, bool useDynamicScale = false, RenderTextureMemoryless memoryless = RenderTextureMemoryless.None, VRTextureUsage vrUsage = VRTextureUsage.None, string name = "")
Parameters
Type | Name | Description |
---|---|---|
ScaleFunc | scaleFunc | Function used for the RTHandle size computation. |
Int32 | 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. |
Boolean | enableRandomWrite | Set to true to enable UAV random read writes on the texture. |
Boolean | useMipMap | Set to true if the texture should have mipmaps. |
Boolean | autoGenerateMips | Set to true to automatically generate mipmaps. |
Boolean | isShadowMap | Set to true if the depth buffer should be used as a shadow map. |
Int32 | anisoLevel | Anisotropic filtering level. |
Single | mipMapBias | Bias applied to mipmaps during filtering. |
MSAASamples | msaaSamples | Number of MSAA samples. |
Boolean | bindTextureMS | Set to true if the texture needs to be bound as a multisampled texture in the shader. |
Boolean | useDynamicScale | Set to true to use hardware dynamic scaling. |
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)
Allocate a RTHandle from a regular RenderTexture.
Declaration
public RTHandle Alloc(RenderTexture texture)
Parameters
Type | Name | Description |
---|---|---|
RenderTexture | texture | Input texture |
Returns
Type | Description |
---|---|
RTHandle | A new RTHandle referencing the input texture. |
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, Int32, DepthBits, GraphicsFormat, FilterMode, TextureWrapMode, TextureDimension, Boolean, Boolean, Boolean, Boolean, Int32, Single, MSAASamples, Boolean, Boolean, 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 = 0F, MSAASamples msaaSamples = MSAASamples.None, bool bindTextureMS = false, bool useDynamicScale = false, RenderTextureMemoryless memoryless = RenderTextureMemoryless.None, VRTextureUsage vrUsage = VRTextureUsage.None, string name = "")
Parameters
Type | Name | Description |
---|---|---|
Vector2 | scaleFactor | Constant scale for the RTHandle size computation. |
Int32 | 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. |
Boolean | enableRandomWrite | Set to true to enable UAV random read writes on the texture. |
Boolean | useMipMap | Set to true if the texture should have mipmaps. |
Boolean | autoGenerateMips | Set to true to automatically generate mipmaps. |
Boolean | isShadowMap | Set to true if the depth buffer should be used as a shadow map. |
Int32 | anisoLevel | Anisotropic filtering level. |
Single | mipMapBias | Bias applied to mipmaps during filtering. |
MSAASamples | msaaSamples | Number of MSAA samples. |
Boolean | bindTextureMS | Set to true if the texture needs to be bound as a multisampled texture in the shader. |
Boolean | useDynamicScale | Set to true to use hardware dynamic scaling. |
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. |
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 |
---|---|
Int32 | Maximum allocated height of the RTHandle System. |
GetMaxWidth()
Returns the maximum allocated width of the RTHandle System.
Declaration
public int GetMaxWidth()
Returns
Type | Description |
---|---|
Int32 | Maximum allocated width of the RTHandle System. |
Initialize(Int32, Int32)
Initialize the RTHandle system.
Declaration
public void Initialize(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Int32 | width | Initial reference rendering width. |
Int32 | height | Initial reference rendering height. |
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(Int32, Int32)
Reset the reference size of the system and reallocate all textures.
Declaration
public void ResetReferenceSize(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Int32 | width | New width. |
Int32 | height | New height. |
SetHardwareDynamicResolutionState(Boolean)
Enable or disable hardware dynamic resolution for the RTHandle System
Declaration
public void SetHardwareDynamicResolutionState(bool enableHWDynamicRes)
Parameters
Type | Name | Description |
---|---|---|
Boolean | enableHWDynamicRes | State of hardware dynamic resolution. |
SetReferenceSize(Int32, Int32)
Sets the reference rendering size for subsequent rendering for the RTHandle System
Declaration
public void SetReferenceSize(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Int32 | width | Reference rendering width for subsequent rendering. |
Int32 | height | Reference rendering height for subsequent rendering. |
SetReferenceSize(Int32, Int32, Boolean)
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 |
---|---|---|
Int32 | width | Reference rendering width for subsequent rendering. |
Int32 | height | Reference rendering height for subsequent rendering. |
Boolean | reset | If set to true, the new width and height will override the old values even if they are not bigger. |