# Sandbox.Rendering.CommandList.DrawInstancedIndirect

## Overload 1

```csharp
void DrawInstancedIndirect(GpuBuffer<T> vertexBuffer, Material material, GpuBuffer indirectBuffer, uint bufferOffset = 0, RenderAttributes attributes = null, PrimitiveType primitiveType = 5)
```

### Parameters

- `vertexBuffer` (`GpuBuffer<T>`)
- `material` (`Material`)
- `indirectBuffer` (`GpuBuffer`)
- `bufferOffset` (`uint`), default `0`
- `attributes` (`RenderAttributes`), default `null`
- `primitiveType` (`PrimitiveType`), default `5`

## Overload 2

```csharp
void DrawInstancedIndirect(GpuBuffer<T> vertexBuffer, Material material, GpuBuffer indirectBuffer, uint bufferOffset, RenderAttributes attributes, PrimitiveType primitiveType, uint drawCount, uint stride = 0)
```

### Parameters

- `vertexBuffer` (`GpuBuffer<T>`)
- `material` (`Material`)
- `indirectBuffer` (`GpuBuffer`)
- `bufferOffset` (`uint`)
- `attributes` (`RenderAttributes`)
- `primitiveType` (`PrimitiveType`)
- `drawCount` (`uint`)
- `stride` (`uint`), default `0`

## Overload 3

```csharp
void DrawInstancedIndirect(Material material, GpuBuffer indirectBuffer, uint bufferOffset = 0, RenderAttributes attributes = null, PrimitiveType primitiveType = 5)
```

Draws instanced geometry using indirect draw arguments stored in a GPU buffer.

## Remarks

Vertex data is accessed in shader through buffer attribute and SV_VertexID.

### Parameters

- `material` (`Material`): The material to use for rendering.
- `indirectBuffer` (`GpuBuffer`): The GPU buffer containing indirect draw arguments.
- `bufferOffset` (`uint`), default `0`: Optional element offset into the indirect buffer.
- `attributes` (`RenderAttributes`), default `null`: Optional render attributes to apply only for this draw call.
- `primitiveType` (`PrimitiveType`), default `5`: The type of primitives to render. Defaults to triangles.

## Overload 4

```csharp
void DrawInstancedIndirect(Material material, GpuBuffer indirectBuffer, uint bufferOffset, RenderAttributes attributes, PrimitiveType primitiveType, uint drawCount, uint stride = 0)
```

Draws instanced geometry, executing one or more indirect draw arguments stored in a GPU buffer.

## Remarks

Vertex data is accessed in shader through buffer attribute and SV_VertexID.

### Parameters

- `material` (`Material`): The material to use for rendering.
- `indirectBuffer` (`GpuBuffer`): The GPU buffer containing indirect draw arguments.
- `bufferOffset` (`uint`): Element offset into the indirect buffer.
- `attributes` (`RenderAttributes`): Render attributes to apply only for this draw call, or null.
- `primitiveType` (`PrimitiveType`): The type of primitives to render.
- `drawCount` (`uint`): Number of draw argument structs to read and execute.
- `stride` (`uint`), default `0`: Byte stride between draw argument structs. Use this when your indirect buffer packs extra per-draw userdata. Must be a multiple of 4 and at least the size of the draw argument struct. 0 uses the natural size.

Declared in [Sandbox.Rendering.CommandList](/api/Sandbox.Rendering.CommandList).
Assembly: `Sandbox.Engine`.
