Class RTUtils
Provides a utility class for getting and releasing UnityEngine.RenderTextures handles.
Namespace: UnityEditor.TerrainTools
Syntax
public static class RTUtils
Remarks
Tracks the lifetimes of these RenderTextures. Any RenderTextures that aren't released within several frames are regarded as leaked RenderTexture resources, which generate warnings in the Console.
Methods
Destroy(RenderTexture)
Destroys a UnityEngine.RenderTexture created using new RenderTexture()
.
Declaration
public static void Destroy(RenderTexture rt)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.RenderTexture | rt | The RenderTexture to destroy. |
See Also
GetDescriptor(Int32, Int32, Int32, GraphicsFormat, Int32, Boolean)
Gets a RenderTextureDescriptor set up for UnityEngine.RenderTexture operations on GPU.
Declaration
public static RenderTextureDescriptor GetDescriptor(int width, int height, int depth, GraphicsFormat format, int mipCount = 0, bool srgb = false)
Parameters
Type | Name | Description |
---|---|---|
Int32 | width | The width of the RenderTexture. |
Int32 | height | The height of the RenderTexture. |
Int32 | depth | The depth of the RenderTexture. |
UnityEngine.Experimental.Rendering.GraphicsFormat | format | The UnityEngine.RenderTextureFormat of the RenderTexture. |
Int32 | mipCount | The mip count of the RenderTexture. Default is |
Boolean | srgb | The flag that determines whether RenderTextures created using this descriptor are in sRGB or Linear space. |
Returns
Type | Description |
---|---|
UnityEngine.RenderTextureDescriptor | Returns a RenderTextureDescriptor object. |
GetDescriptor(Int32, Int32, Int32, RenderTextureFormat, Int32, Boolean)
Gets a RenderTextureDescriptor for UnityEngine.RenderTexture operations on GPU.
Declaration
public static RenderTextureDescriptor GetDescriptor(int width, int height, int depth, RenderTextureFormat format, int mipCount = 0, bool srgb = false)
Parameters
Type | Name | Description |
---|---|---|
Int32 | width | The width of the RenderTexture. |
Int32 | height | The height of the RenderTexture. |
Int32 | depth | The depth of the RenderTexture. |
UnityEngine.RenderTextureFormat | format | The UnityEngine.RenderTextureFormat of the RenderTexture. |
Int32 | mipCount | The mip count of the RenderTexture. Default is |
Boolean | srgb | The flag that determines whether RenderTextures created using this descriptor are in sRGB or Linear space. |
Returns
Type | Description |
---|---|
UnityEngine.RenderTextureDescriptor | Returns a RenderTextureDescriptor object. |
See Also
GetDescriptorRW(Int32, Int32, Int32, GraphicsFormat, Int32, Boolean)
Gets a RenderTextureDescriptor for UnityEngine.RenderTexture operations on GPU with the enableRandomWrite
flag set to true
.
Declaration
public static RenderTextureDescriptor GetDescriptorRW(int width, int height, int depth, GraphicsFormat format, int mipCount = 0, bool srgb = false)
Parameters
Type | Name | Description |
---|---|---|
Int32 | width | The width of the RenderTexture. |
Int32 | height | The height of the RenderTexture. |
Int32 | depth | The depth of the RenderTexture. |
UnityEngine.Experimental.Rendering.GraphicsFormat | format | The UnityEngine.RenderTextureFormat of the RenderTexture. |
Int32 | mipCount | The mip count of the RenderTexture. Default is |
Boolean | srgb | The flag that determines whether RenderTextures created using this descriptor are in sRGB or Linear space. |
Returns
Type | Description |
---|---|
UnityEngine.RenderTextureDescriptor | Returns a RenderTextureDescriptor object. |
See Also
GetDescriptorRW(Int32, Int32, Int32, RenderTextureFormat, Int32, Boolean)
Gets a RenderTextureDescriptor for UnityEngine.RenderTexture operations on GPU with the enableRandomWrite
flag set to true
.
Declaration
public static RenderTextureDescriptor GetDescriptorRW(int width, int height, int depth, RenderTextureFormat format, int mipCount = 0, bool srgb = false)
Parameters
Type | Name | Description |
---|---|---|
Int32 | width | The width of the RenderTexture. |
Int32 | height | The height of the RenderTexture. |
Int32 | depth | The depth of the RenderTexture. |
UnityEngine.RenderTextureFormat | format | The UnityEngine.RenderTextureFormat of the RenderTexture. |
Int32 | mipCount | The mip count of the RenderTexture. Default is |
Boolean | srgb | The flag that determines whether RenderTextures created using this descriptor are in sRGB or Linear space. |
Returns
Type | Description |
---|---|
UnityEngine.RenderTextureDescriptor | Returns a RenderTextureDescriptor object. |
See Also
GetHandleCount()
Gets the number of RTHandles that have been requested and not released yet.
Declaration
public static int GetHandleCount()
Returns
Type | Description |
---|---|
Int32 | Returns the number of RTHandles that have been requested and not released. |
GetNewHandle(Int32, Int32, Int32, GraphicsFormat)
Gets an RTHandle for a UnityEngine.RenderTexture acquired with new RenderTexture(desc)
.
Declaration
public static RTHandle GetNewHandle(int width, int height, int depth, GraphicsFormat format)
Parameters
Type | Name | Description |
---|---|---|
Int32 | width | The width of the RenderTexture. |
Int32 | height | The height of the RenderTexture. |
Int32 | depth | The depth of the RenderTexture. |
UnityEngine.Experimental.Rendering.GraphicsFormat | format | The format of the RenderTexture. |
Returns
Type | Description |
---|---|
RTHandle | Returns an RTHandle. |
Remarks
Use Release(RTHandle) to release the RTHandle.
GetNewHandle(RenderTextureDescriptor)
Gets an RTHandle for a UnityEngine.RenderTexture acquired with new RenderTexture(desc)
.
Declaration
public static RTHandle GetNewHandle(RenderTextureDescriptor desc)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.RenderTextureDescriptor | desc | The |
Returns
Type | Description |
---|---|
RTHandle | Returns an RTHandle. |
See Also
GetTempHandle(Int32, Int32, Int32, GraphicsFormat)
Gets an RTHandle for a UnityEngine.RenderTexture acquired with UnityEngine.RenderTexture.GetTemporary(UnityEngine.RenderTextureDescriptor).
Declaration
public static RTHandle GetTempHandle(int width, int height, int depth, GraphicsFormat format)
Parameters
Type | Name | Description |
---|---|---|
Int32 | width | The width of the RenderTexture. |
Int32 | height | The height of the RenderTexture. |
Int32 | depth | The depth of the RenderTexture. |
UnityEngine.Experimental.Rendering.GraphicsFormat | format | The format of the RenderTexture. |
Returns
Type | Description |
---|---|
RTHandle | Returns a temporary RTHandle. |
Remarks
Use Release(RTHandle) to release the RTHandle.
GetTempHandle(RenderTextureDescriptor)
Gets an RTHandle for a UnityEngine.RenderTexture acquired with UnityEngine.RenderTexture.GetTemporary(UnityEngine.RenderTextureDescriptor).
Declaration
public static RTHandle GetTempHandle(RenderTextureDescriptor desc)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.RenderTextureDescriptor | desc | RenderTextureDescriptor for the RenderTexture. |
Returns
Type | Description |
---|---|
RTHandle | Returns a temporary RTHandle. |
Remarks
Use Release(RTHandle) to release the RTHandle.
See Also
Release(RTHandle)
Releases the UnityEngine.RenderTexture resource associated with the specified RTHandle.
Declaration
public static void Release(RTHandle handle)
Parameters
Type | Name | Description |
---|---|---|
RTHandle | handle | The RTHandle from which to release RenderTexture resources. |