Class ComputeAlgorithms
Provides multi-stage compute shader algorithms such as Push-Pull.
Namespace: Holoride.ElasticSDK.Compute
Assembly: Holoride.ElasticSDK.Library.Runtime.dll
Syntax
[PublicAPI]
public static class ComputeAlgorithms
Methods
AllocatePyramid(IList<ComputeBuffer>, int, int, uint)
Allocates the lower level buffers for a buffer pyramid.
Declaration
public static void AllocatePyramid(IList<ComputeBuffer> pyramid, int resolution, int stride, uint maxLevel = 4294967295)
Parameters
Type | Name | Description |
---|---|---|
IList<ComputeBuffer> | pyramid | The list the buffers will be added to. |
int | resolution | The resolution of the input buffer. |
int | stride | The stride of the compute buffers to generate. |
uint | maxLevel | The maximum number of levels to create. May be used to stop early. Otherwise bound by resolution (stops when level resolution is one). |
GetComputeShaderPath(string)
Declaration
public static string GetComputeShaderPath(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name |
Returns
Type | Description |
---|---|
string |
Initialize()
Declaration
public static void Initialize()
RunPushPullShaderAsync(ComputeShader, ComputeBuffer, IList<ComputeBuffer>, int, int, int, int, int, uint, PushPullHookAsync, PushPullHookAsync, CancellationToken)
Runs a generic Push-Pull-Shader.
Declaration
public static UniTask RunPushPullShaderAsync(ComputeShader shader, ComputeBuffer buffer, IList<ComputeBuffer> pyramid, int resolution, int pushKernelId, int pushThreadCount = -1, int pullKernelId = -1, int pullThreadCount = -1, uint maxLevel = 4294967295, ComputeAlgorithms.PushPullHookAsync onAfterPush = null, ComputeAlgorithms.PushPullHookAsync onAfterPull = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
ComputeShader | shader | The compute shader implementing the push-pull kernels. |
ComputeBuffer | buffer | The buffer to perform the push-pull algorithm on. Serves as seeding input for the push phase and the as the final output buffer for the pull phase. |
IList<ComputeBuffer> | pyramid | The pyramid of buffers used by the algorithm. Typically created via AllocatePyramid(IList<ComputeBuffer>, int, int, uint). |
int | resolution | The resolution of the (assumed to be) 2D data in the buffer. Buffer is expected to be a square. |
int | pushKernelId | The id of the push kernel. This step is required to populate the levels. |
int | pushThreadCount | The number of threads per group for the push kernel. |
int | pullKernelId | The id of the pull kernel. This step is optional and will be skipped for invalid (negative) kernel ids. |
int | pullThreadCount | The number of threads per group for the pull kernel. |
uint | maxLevel | The max mip level to generate. |
ComputeAlgorithms.PushPullHookAsync | onAfterPush | Callback for performing operations on the generated command buffer pyramid after the push phase of
the algorithm has completed. The passed pyramid becomes invalid after the |
ComputeAlgorithms.PushPullHookAsync | onAfterPull | Callback for performing operations on the generated command buffer pyramid after the pull phase of the algorithm has completed. The passed pyramid becomes invalid after this callback returns. |
CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Cysharp.Threading.Tasks.UniTask |
RunPushPullShaderAsync(ComputeShader, ComputeBuffer, int, int, int, int, int, uint, PushPullHookAsync, PushPullHookAsync, CancellationToken)
Runs a generic Push-Pull-Shader.
Declaration
public static UniTask RunPushPullShaderAsync(ComputeShader shader, ComputeBuffer buffer, int resolution, int pushKernelId, int pushThreadCount = -1, int pullKernelId = -1, int pullThreadCount = -1, uint maxLevel = 4294967295, ComputeAlgorithms.PushPullHookAsync onAfterPush = null, ComputeAlgorithms.PushPullHookAsync onAfterPull = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
ComputeShader | shader | The compute shader implementing the push-pull kernels. |
ComputeBuffer | buffer | The buffer to perform the push-pull algorithm on. Serves as seeding input for the push phase and the as the final output buffer for the pull phase. |
int | resolution | The resolution of the (assumed to be) 2D data in the buffer. Buffer is expected to be a square. |
int | pushKernelId | The id of the push kernel. This step is required to populate the levels. |
int | pushThreadCount | The number of threads per group for the push kernel. |
int | pullKernelId | The id of the pull kernel. This step is optional and will be skipped for invalid (negative) kernel ids. |
int | pullThreadCount | The number of threads per group for the pull kernel. |
uint | maxLevel | The max mip level to generate. |
ComputeAlgorithms.PushPullHookAsync | onAfterPush | Callback for performing operations on the generated command buffer pyramid after the push phase of
the algorithm has completed. The passed pyramid becomes invalid after the |
ComputeAlgorithms.PushPullHookAsync | onAfterPull | Callback for performing operations on the generated command buffer pyramid after the pull phase of the algorithm has completed. The passed pyramid becomes invalid after this callback returns. |
CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Cysharp.Threading.Tasks.UniTask |