# Sandbox.ComputeShader.DispatchIndirect

```csharp
void DispatchIndirect(GpuBuffer indirectBuffer, uint indirectElementOffset = 0)
```

Dispatch this compute shader by reading thread group counts (x, y, z)
from an indirect buffer of type [Sandbox.GpuBuffer.IndirectDispatchArguments](/api/Sandbox.GpuBuffer.IndirectDispatchArguments).

## Remarks

`indirectBuffer` must be created with [Sandbox.GpuBuffer.UsageFlags.IndirectDrawArguments](/api/Sandbox.GpuBuffer.UsageFlags/IndirectDrawArguments)  
            and have an element size of 12 bytes.
            

`indirectElementOffset` is an element index into `indirectBuffer`, not a byte offset.
            


            When called outside a graphics context, the dispatch runs immediately.  
            When called inside a graphics context, the dispatch runs async.

### Parameters

- `indirectBuffer` (`GpuBuffer`): The GPU buffer containing one or more dispatch argument entries.
- `indirectElementOffset` (`uint`), default `0`: The index of the dispatch arguments element to use (each element = 12 bytes).

Declared in [Sandbox.ComputeShader](/api/Sandbox.ComputeShader).
Assembly: `Sandbox.Engine`.
