void DispatchCompute( ComputeShader compute, int x, int y, int z )

book_4_sparkGenerated
code_blocksInput

Description

The DispatchCompute method is used to dispatch a compute shader for execution. This method allows you to specify the number of work 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 ComputeShader object that you want to execute. You also need to specify the number of work groups in each dimension (x, y, z) that the compute shader should be dispatched 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 10 work groups in x, 5 in y, and 2 in z dimensions
commandList.DispatchCompute(computeShader, 10, 5, 2);