Class CaptureGPUBuffer
Provides static helper methods for performing asynchronous GPU readback from ComputeBuffer and Texture sources. Falls back to synchronous readback when async GPU readback is unavailable on the current platform.
Inherited Members
Namespace: Unity.SimulationPro
Assembly: Unity.SimulationPro.Capture.dll
Syntax
public static class CaptureGPUBuffer
Methods
Capture<T>(ComputeBuffer, Func<AsyncRequest<object>, Result>)
Perform async read back from the provided compute buffer
Declaration
public static AsyncRequest<object> Capture<T>(ComputeBuffer src, Func<AsyncRequest<object>, AsyncRequest.Result> functor = null) where T : struct
Parameters
| Type | Name | Description |
|---|---|---|
| ComputeBuffer | src | Compute buffer source to be used for the read back. |
| Func<AsyncRequest<object>, AsyncRequest.Result> | functor | Functor that will be invoked after the async read back request is complete. |
Returns
| Type | Description |
|---|---|
| AsyncRequest<object> | An AsyncRequest<T> that completes when the readback is finished. |
Type Parameters
| Name | Description |
|---|---|
| T | Type for the destination data buffer. |
Capture<T>(ComputeBuffer, int, int, Func<AsyncRequest<object>, Result>)
Perform async read back from the provided compute buffer with size and offset.
Declaration
public static AsyncRequest<object> Capture<T>(ComputeBuffer src, int size, int offset, Func<AsyncRequest<object>, AsyncRequest.Result> functor = null) where T : struct
Parameters
| Type | Name | Description |
|---|---|---|
| ComputeBuffer | src | Compute buffer source to be used for the read back. |
| int | size | Size in bytes of the data to be retrieved from the ComputeBuffer. |
| int | offset | Offset in bytes in the ComputeBuffer. |
| Func<AsyncRequest<object>, AsyncRequest.Result> | functor | Functor that will be invoked after the async read back request is complete. |
Returns
| Type | Description |
|---|---|
| AsyncRequest<object> | Returns an AsyncRequest |
Type Parameters
| Name | Description |
|---|---|
| T | Type for the destination data buffer. |
Capture<T>(Texture, int, Func<AsyncRequest<object>, Result>)
Perform async read back from the provided source texture.
Declaration
public static AsyncRequest<object> Capture<T>(Texture src, int mipIndex = 0, Func<AsyncRequest<object>, AsyncRequest.Result> functor = null) where T : struct
Parameters
| Type | Name | Description |
|---|---|---|
| Texture | src | Texture source to be used for the read back. |
| int | mipIndex | Index of the mipmap to be fetched. |
| Func<AsyncRequest<object>, AsyncRequest.Result> | functor | Functor that will be invoked after the async read back request is complete. |
Returns
| Type | Description |
|---|---|
| AsyncRequest<object> | Returns an AsyncRequest |
Type Parameters
| Name | Description |
|---|---|
| T | Type for the destination data buffer. |
Capture<T>(Texture, int, int, int, int, int, int, int, Func<AsyncRequest<object>, Result>)
Perform async read back from the provided source texture.
Declaration
public static AsyncRequest<object> Capture<T>(Texture src, int mipIndex, int x, int width, int y, int height, int z, int depth, Func<AsyncRequest<object>, AsyncRequest.Result> functor = null) where T : struct
Parameters
| Type | Name | Description |
|---|---|---|
| Texture | src | Texture source to be used for the read back. |
| int | mipIndex | Index of the mipmap to be fetched. |
| int | x | Starting X coordinate in pixels of the Texture data to be fetched. |
| int | width | Width in pixels of the Texture data to be fetched. |
| int | y | Starting Y coordinate in pixels of the Texture data to be fetched. |
| int | height | Height in pixels of the Texture data to be fetched. |
| int | z | Start Z coordinate in pixels for the Texture3D being fetched. Index of Start layer for TextureCube, Texture2DArray and TextureCubeArray being fetched. |
| int | depth | Depth in pixels for Texture3D being fetched. Number of layers for TextureCube, TextureArray and TextureCubeArray. |
| Func<AsyncRequest<object>, AsyncRequest.Result> | functor | Functor that will be invoked after the async read back request is complete. |
Returns
| Type | Description |
|---|---|
| AsyncRequest<object> | An AsyncRequest<T> that completes when the readback is finished. |
Type Parameters
| Name | Description |
|---|---|
| T | Type for the destination data buffer. |
Capture<T>(Texture, int, GraphicsFormat, Func<AsyncRequest<object>, Result>)
Perform async read back from the provided source texture.
Declaration
public static AsyncRequest<object> Capture<T>(Texture src, int mipIndex, GraphicsFormat dstFormat, Func<AsyncRequest<object>, AsyncRequest.Result> functor = null) where T : struct
Parameters
| Type | Name | Description |
|---|---|---|
| Texture | src | Texture source to be used for the read back. |
| int | mipIndex | Index of the mipmap to be fetched. |
| GraphicsFormat | dstFormat | Target TextureFormat of the data. If the target format is different from the format stored on the GPU, the conversion is automatic. |
| Func<AsyncRequest<object>, AsyncRequest.Result> | functor | Functor that will be invoked after the async read back request is complete. |
Returns
| Type | Description |
|---|---|
| AsyncRequest<object> | Returns an AsynRequest |
Type Parameters
| Name | Description |
|---|---|
| T | Type for the destination data buffer. |