Class RTUtils
Utility class for getting and releasing RenderTextures handles. Lifetimes of these RenderTextures are tracked and any that have not been released within several frames are regarded as leaked RenderTexture resources and will generate warnings in the Console.
Namespace: UnityEditor.Experimental.TerrainAPI
Syntax
public static class RTUtils
Methods
Destroy(RenderTexture)
Destroy a RenderTexture created using 'new RenderTexture()' RenderTexture to destroy
Declaration
public static void Destroy(RenderTexture rt)
Parameters
Type | Name | Description |
---|---|---|
RenderTexture | rt |
GetDescriptor(Int32, Int32, Int32, GraphicsFormat, Int32, Boolean)
Get a RenderTextureDescriptor set up for RenderTexture operations on GPU Width of the RenderTexture Height of the RenderTexture RenderTextureFormat of the RenderTexture Depth of the RenderTexture MipCount of the RenderTexture. Default is 0 Flag determining whether RenderTextures created using this descriptor should be sRGB or Linear space
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 | |
Int32 | height | |
Int32 | depth | |
GraphicsFormat | format | |
Int32 | mipCount | |
Boolean | srgb |
Returns
Type | Description |
---|---|
RenderTextureDescriptor |
GetDescriptor(Int32, Int32, Int32, RenderTextureFormat, Int32, Boolean)
Get a RenderTextureDescriptor set up for RenderTexture operations on GPU Width of the RenderTexture Height of the RenderTexture RenderTextureFormat of the RenderTexture Depth of the RenderTexture MipCount of the RenderTexture. Default is 0 Flag determining whether RenderTextures created using this descriptor should be sRGB or Linear space
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 | |
Int32 | height | |
Int32 | depth | |
RenderTextureFormat | format | |
Int32 | mipCount | |
Boolean | srgb |
Returns
Type | Description |
---|---|
RenderTextureDescriptor |
GetDescriptorRW(Int32, Int32, Int32, GraphicsFormat, Int32, Boolean)
Get a RenderTextureDescriptor set up for RenderTexture operations on GPU with the enableRandomWrite flag set to true Width of the RenderTexture Height of the RenderTexture GraphicsFormat of the RenderTexture Depth of the RenderTexture MipCount of the RenderTexture. Default is 0 Flag determining whether RenderTextures created using this descriptor should be sRGB or Linear space
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 | |
Int32 | height | |
Int32 | depth | |
GraphicsFormat | format | |
Int32 | mipCount | |
Boolean | srgb |
Returns
Type | Description |
---|---|
RenderTextureDescriptor |
GetDescriptorRW(Int32, Int32, Int32, RenderTextureFormat, Int32, Boolean)
Get a RenderTextureDescriptor set up for RenderTexture operations on GPU with the enableRandomWrite flag set to true Width of the RenderTexture Height of the RenderTexture RenderTextureFormat of the RenderTexture Depth of the RenderTexture MipCount of the RenderTexture. Default is 0 Flag determining whether RenderTextures created using this descriptor should be sRGB or Linear space
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 | |
Int32 | height | |
Int32 | depth | |
RenderTextureFormat | format | |
Int32 | mipCount | |
Boolean | srgb |
Returns
Type | Description |
---|---|
RenderTextureDescriptor |
GetHandleCount()
Get the number of RTHandles that have been requested and not released yet.
Declaration
public static int GetHandleCount()
Returns
Type | Description |
---|---|
Int32 | Number of RTHandles that have been requested and not released |
GetNewHandle(Int32, Int32, Int32, GraphicsFormat)
Get a RTHandle for a RenderTexture acquired with 'new RenderTexture(desc)'. Free using RTUtils.Release
Declaration
public static RTHandle GetNewHandle(int width, int height, int depth, GraphicsFormat format)
Parameters
Type | Name | Description |
---|---|---|
Int32 | width | Width of the RenderTexture |
Int32 | height | Height of the RenderTexture |
Int32 | depth | Depth of the RenderTexture |
GraphicsFormat | format | Format of the RenderTexture |
Returns
Type | Description |
---|---|
RTHandle |
GetNewHandle(RenderTextureDescriptor)
Get a RTHandle for a RenderTexture acquired with 'new RenderTexture(desc)'. Free using RTUtils.Release RenderTextureDescriptor for the RenderTexture
Declaration
public static RTHandle GetNewHandle(RenderTextureDescriptor desc)
Parameters
Type | Name | Description |
---|---|---|
RenderTextureDescriptor | desc |
Returns
Type | Description |
---|---|
RTHandle |
GetTempHandle(Int32, Int32, Int32, GraphicsFormat)
Get a RTHandle for a RenderTexture acquired with RenderTexture.GetTemporary. Free using RTUtils.Release
Declaration
public static RTHandle GetTempHandle(int width, int height, int depth, GraphicsFormat format)
Parameters
Type | Name | Description |
---|---|---|
Int32 | width | Width of the RenderTexture |
Int32 | height | Height of the RenderTexture |
Int32 | depth | Depth of the RenderTexture |
GraphicsFormat | format | Format of the RenderTexture |
Returns
Type | Description |
---|---|
RTHandle |
GetTempHandle(RenderTextureDescriptor)
Get a RTHandle for a RenderTexture acquired from RenderTexture.GetTemporary. Free using RTUtils.Release RenderTextureDescriptor for the RenderTexture
Declaration
public static RTHandle GetTempHandle(RenderTextureDescriptor desc)
Parameters
Type | Name | Description |
---|---|---|
RenderTextureDescriptor | desc |
Returns
Type | Description |
---|---|
RTHandle |
Release(RTHandle)
Release the RenderTexture resource associated with the specified RTHandle RTHandle from which RenderTexture resources will be released
Declaration
public static void Release(RTHandle handle)
Parameters
Type | Name | Description |
---|---|---|
RTHandle | handle |