Class RTUtils
Provides a utility class for getting and releasing RenderTextures handles.
Inherited Members
Namespace: UnityEditor.TerrainTools
Assembly: Unity.TerrainTools.Editor.dll
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 RenderTexture created using new RenderTexture()
.
Declaration
public static void Destroy(RenderTexture rt)
Parameters
Type | Name | Description |
---|---|---|
RenderTexture | rt | The RenderTexture to destroy. |
See Also
GetDescriptor(int, int, int, GraphicsFormat, int, bool)
Gets a RenderTextureDescriptor set up for 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 |
---|---|---|
int | width | The width of the RenderTexture. |
int | height | The height of the RenderTexture. |
int | depth | The depth of the RenderTexture. |
GraphicsFormat | format | The RenderTextureFormat of the RenderTexture. |
int | mipCount | The mip count of the RenderTexture. Default is |
bool | srgb | The flag that determines whether RenderTextures created using this descriptor are in sRGB or Linear space. |
Returns
Type | Description |
---|---|
RenderTextureDescriptor | Returns a RenderTextureDescriptor object. |
GetDescriptor(int, int, int, RenderTextureFormat, int, bool)
Gets a RenderTextureDescriptor for 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 |
---|---|---|
int | width | The width of the RenderTexture. |
int | height | The height of the RenderTexture. |
int | depth | The depth of the RenderTexture. |
RenderTextureFormat | format | The RenderTextureFormat of the RenderTexture. |
int | mipCount | The mip count of the RenderTexture. Default is |
bool | srgb | The flag that determines whether RenderTextures created using this descriptor are in sRGB or Linear space. |
Returns
Type | Description |
---|---|
RenderTextureDescriptor | Returns a RenderTextureDescriptor object. |
See Also
GetDescriptorRW(int, int, int, GraphicsFormat, int, bool)
Gets a RenderTextureDescriptor for 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 |
---|---|---|
int | width | The width of the RenderTexture. |
int | height | The height of the RenderTexture. |
int | depth | The depth of the RenderTexture. |
GraphicsFormat | format | The RenderTextureFormat of the RenderTexture. |
int | mipCount | The mip count of the RenderTexture. Default is |
bool | srgb | The flag that determines whether RenderTextures created using this descriptor are in sRGB or Linear space. |
Returns
Type | Description |
---|---|
RenderTextureDescriptor | Returns a RenderTextureDescriptor object. |
See Also
GetDescriptorRW(int, int, int, RenderTextureFormat, int, bool)
Gets a RenderTextureDescriptor for 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 |
---|---|---|
int | width | The width of the RenderTexture. |
int | height | The height of the RenderTexture. |
int | depth | The depth of the RenderTexture. |
RenderTextureFormat | format | The RenderTextureFormat of the RenderTexture. |
int | mipCount | The mip count of the RenderTexture. Default is |
bool | srgb | The flag that determines whether RenderTextures created using this descriptor are in sRGB or Linear space. |
Returns
Type | Description |
---|---|
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 |
---|---|
int | Returns the number of RTHandles that have been requested and not released. |
GetNewHandle(int, int, int, GraphicsFormat)
Gets an RTHandle for a RenderTexture acquired with new RenderTexture(desc)
.
Declaration
public static RTHandle GetNewHandle(int width, int height, int depth, GraphicsFormat format)
Parameters
Type | Name | Description |
---|---|---|
int | width | The width of the RenderTexture. |
int | height | The height of the RenderTexture. |
int | depth | The depth of the RenderTexture. |
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 RenderTexture acquired with new RenderTexture(desc)
.
Declaration
public static RTHandle GetNewHandle(RenderTextureDescriptor desc)
Parameters
Type | Name | Description |
---|---|---|
RenderTextureDescriptor | desc | The |
Returns
Type | Description |
---|---|
RTHandle | Returns an RTHandle. |
See Also
GetTempHandle(int, int, int, GraphicsFormat)
Gets an RTHandle for a RenderTexture acquired with GetTemporary.
Declaration
public static RTHandle GetTempHandle(int width, int height, int depth, GraphicsFormat format)
Parameters
Type | Name | Description |
---|---|---|
int | width | The width of the RenderTexture. |
int | height | The height of the RenderTexture. |
int | depth | The depth of the RenderTexture. |
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 RenderTexture acquired with GetTemporary.
Declaration
public static RTHandle GetTempHandle(RenderTextureDescriptor desc)
Parameters
Type | Name | Description |
---|---|---|
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 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. |