Class GraphicsUtilities
Provides GPU readback and graphics format helper methods used by the capture pipeline.
Inherited Members
Namespace: Unity.SimulationPro
Assembly: Unity.SimulationPro.Capture.dll
Syntax
public static class GraphicsUtilities
Methods
DepthFormatForDepth(int)
Get the GraphicsFormat for the input number of depth bits per pixel.
Declaration
public static GraphicsFormat DepthFormatForDepth(int depthBpp)
Parameters
| Type | Name | Description |
|---|---|---|
| int | depthBpp | Depth: Number of bits per pixel. |
Returns
| Type | Description |
|---|---|
| GraphicsFormat | Graphics format for the corresponding number of depth bits per pixel. |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when |
GetBlockSize(GraphicsFormat)
Get the size of a pixel in bytes for a given format.
Declaration
public static int GetBlockSize(GraphicsFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| GraphicsFormat | format | Graphics format you are using. |
Returns
| Type | Description |
|---|---|
| int | Returns the size of the pixel in bytes. |
GetComponentCount(GraphicsFormat)
Get the number of components for a given format.
Declaration
public static int GetComponentCount(GraphicsFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| GraphicsFormat | format | Graphics format you are using. |
Returns
| Type | Description |
|---|---|
| int | Returns the number of components. |
GetPixelsSlow(RenderTexture)
Perform the readback from the provided Render texture using ReadPixels API.
Declaration
public static byte[] GetPixelsSlow(RenderTexture renderTexture)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTexture | renderTexture | Input source Render texture for the readback. |
Returns
| Type | Description |
|---|---|
| byte[] | Returns a byte array of the RGB data retrieved from the readback. |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the render texture's channel size is not 2 or 4 bytes for single-channel formats. |
SupportsAsyncReadback()
Check if the AsyncReadback is supported by the current Graphics API.
Declaration
public static bool SupportsAsyncReadback()
Returns
| Type | Description |
|---|---|
| bool | Returns a bool indicating if the asyncreadback is supported. |
SupportsRenderTextureFormat(GraphicsFormat)
Check if the given GraphicsFormat is supported by the current platform.
Declaration
public static bool SupportsRenderTextureFormat(GraphicsFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| GraphicsFormat | format | Input Graphics format. |
Returns
| Type | Description |
|---|---|
| bool | Boolean indicating if the graphics format is supported. |