Description
The DispatchCompute
method is used to execute a compute shader on the GPU. This method allows you to specify the number of thread groups to be dispatched in the X, Y, and Z dimensions. It is a part of the CommandList
class within the Sandbox.Rendering
namespace.
Usage
To use the DispatchCompute
method, you need to have a valid ComputeShader
object. You also need to specify the number of thread groups in each dimension (X, Y, Z) that the compute shader will be executed with. This method does not return any value.
Example
// Example of using DispatchCompute
var commandList = new CommandList();
var computeShader = new ComputeShader("path/to/shader");
// Dispatch the compute shader with 8x8x1 thread groups
commandList.DispatchCompute(computeShader, 8, 8, 1);