# GPURenderBundleEncoder

Artifact: [androidx.webgpu:webgpu](https://developer.android.com/jetpack/androidx/releases/webgpu) [View Source](https://cs.android.com/search?q=file:androidx/webgpu/GPURenderBundleEncoder.kt+class:androidx.webgpu.GPURenderBundleEncoder) Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

*** ** * ** ***


```
class GPURenderBundleEncoder : AutoCloseable
```

<br />

*** ** * ** ***

An object used to record commands for a render bundle.

## Summary

| ### Public functions |
|---|---|
| `open external https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderBundleEncoder#close()()` Decrements the reference count of the object and frees resources when the count reaches zero. |
| `external https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderBundleEncoder#draw(kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int)( vertexCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, instanceCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, firstVertex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, firstInstance: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Draws non-indexed primitives. |
| `external https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderBundleEncoder#drawIndexed(kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int)( indexCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, instanceCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, firstIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, baseVertex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, firstInstance: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Draws indexed primitives. |
| `external https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderBundleEncoder#drawIndexedIndirect(androidx.webgpu.GPUBuffer,kotlin.Long)(indirectBuffer: https://developer.android.com/reference/kotlin/androidx/webgpu/GPUBuffer, indirectOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Draws indexed primitives with parameters from a buffer. |
| `external https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderBundleEncoder#drawIndirect(androidx.webgpu.GPUBuffer,kotlin.Long)(indirectBuffer: https://developer.android.com/reference/kotlin/androidx/webgpu/GPUBuffer, indirectOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Draws non-indexed primitives with parameters from a buffer. |
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderBundleEncoder#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `external https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderBundle` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderBundleEncoder#finish(androidx.webgpu.GPURenderBundleDescriptor)(descriptor: https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderBundleDescriptor?)` Finishes recording commands and creates a render bundle. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderBundleEncoder#hashCode()()` |
| `external https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderBundleEncoder#insertDebugMarker(kotlin.String)(markerLabel: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Inserts a debug marker into the command stream. |
| `external https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderBundleEncoder#popDebugGroup()()` Pops the current debug group. |
| `external https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderBundleEncoder#pushDebugGroup(kotlin.String)(groupLabel: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Pushes a new debug group. |
| `external https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderBundleEncoder#setBindGroup(kotlin.Int,androidx.webgpu.GPUBindGroup,kotlin.IntArray)( groupIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, group: https://developer.android.com/reference/kotlin/androidx/webgpu/GPUBindGroup?, dynamicOffsets: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html )` Sets a bind group for the pipeline. |
| `external https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderBundleEncoder#setImmediates(kotlin.Int,java.nio.ByteBuffer)(offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, data: https://developer.android.com/reference/java/nio/ByteBuffer.html)` |
| `external https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderBundleEncoder#setIndexBuffer(androidx.webgpu.GPUBuffer,kotlin.Int,kotlin.Long,kotlin.Long)(buffer: https://developer.android.com/reference/kotlin/androidx/webgpu/GPUBuffer, format: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, size: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Sets the index buffer. |
| `external https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderBundleEncoder#setLabel(kotlin.String)(label: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Sets a human-readable label for debugging. |
| `external https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderBundleEncoder#setPipeline(androidx.webgpu.GPURenderPipeline)(pipeline: https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderPipeline)` Sets the current render pipeline. |
| `external https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderBundleEncoder#setVertexBuffer(kotlin.Int,androidx.webgpu.GPUBuffer,kotlin.Long,kotlin.Long)(slot: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, buffer: https://developer.android.com/reference/kotlin/androidx/webgpu/GPUBuffer?, offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, size: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Sets a vertex buffer for a specific slot. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderBundleEncoder#handle()` |

## Public functions

### close

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
open external fun close(): Unit
```

Decrements the reference count of the object and frees resources when the count reaches zero.

This is the standard way to manage object lifetimes and should be used in `use` blocks. After calling this, the object is no longer usable.

### draw

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
external fun draw(
    vertexCount: Int,
    instanceCount: Int = 1,
    firstVertex: Int = 0,
    firstInstance: Int = 0
): Unit
```

Draws non-indexed primitives.

| Parameters |
|---|---|
| `vertexCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The number of vertices to draw. |
| `instanceCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 1` | The number of instances to draw. |
| `firstVertex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 0` | The index of the first vertex to draw. |
| `firstInstance: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 0` | The index of the first instance to draw. |

### drawIndexed

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
external fun drawIndexed(
    indexCount: Int,
    instanceCount: Int = 1,
    firstIndex: Int = 0,
    baseVertex: Int = 0,
    firstInstance: Int = 0
): Unit
```

Draws indexed primitives.

| Parameters |
|---|---|
| `indexCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The number of indices to draw. |
| `instanceCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 1` | The number of instances to draw. |
| `firstIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 0` | The index of the first index to draw. |
| `baseVertex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 0` | A value added to each index before reading from the vertex buffer. |
| `firstInstance: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 0` | The index of the first instance to draw. |

### drawIndexedIndirect

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
external fun drawIndexedIndirect(indirectBuffer: GPUBuffer, indirectOffset: Long): Unit
```

Draws indexed primitives with parameters from a buffer.

| Parameters |
|---|---|
| `indirectBuffer: https://developer.android.com/reference/kotlin/androidx/webgpu/GPUBuffer` | The buffer containing the draw parameters. |
| `indirectOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The offset in the indirect buffer. |

### drawIndirect

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
external fun drawIndirect(indirectBuffer: GPUBuffer, indirectOffset: Long): Unit
```

Draws non-indexed primitives with parameters from a buffer.

| Parameters |
|---|---|
| `indirectBuffer: https://developer.android.com/reference/kotlin/androidx/webgpu/GPUBuffer` | The buffer containing the draw parameters. |
| `indirectOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The offset in the indirect buffer. |

### equals

```
open operator fun equals(other: Any?): Boolean
```

### finish

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
external fun finish(descriptor: GPURenderBundleDescriptor? = null): GPURenderBundle
```

Finishes recording commands and creates a render bundle.

| Parameters |
|---|---|
| `descriptor: https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderBundleDescriptor? = null` | The descriptor for the render bundle. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderBundle` | The created render bundle. |

### hashCode

```
open fun hashCode(): Int
```

### insertDebugMarker

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
external fun insertDebugMarker(markerLabel: String): Unit
```

Inserts a debug marker into the command stream.

| Parameters |
|---|---|
| `markerLabel: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The label for the debug marker. |

### popDebugGroup

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
external fun popDebugGroup(): Unit
```

Pops the current debug group.

### pushDebugGroup

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
external fun pushDebugGroup(groupLabel: String): Unit
```

Pushes a new debug group.

| Parameters |
|---|---|
| `groupLabel: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The label for the debug group. |

### setBindGroup

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
external fun setBindGroup(
    groupIndex: Int,
    group: GPUBindGroup? = null,
    dynamicOffsets: IntArray = intArrayOf()
): Unit
```

Sets a bind group for the pipeline.

| Parameters |
|---|---|
| `groupIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The index of the bind group. |
| `group: https://developer.android.com/reference/kotlin/androidx/webgpu/GPUBindGroup? = null` | The bind group to set. |
| `dynamicOffsets: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html = intArrayOf()` | An array of dynamic offsets. |

### setImmediates

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
external fun setImmediates(offset: Int, data: ByteBuffer): Unit
```

### setIndexBuffer

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
external fun setIndexBuffer(
    buffer: GPUBuffer,
    format: Int = IndexFormat.Undefined,
    offset: Long = 0,
    size: Long = Constants.WHOLE_SIZE
): Unit
```

Sets the index buffer.

| Parameters |
|---|---|
| `buffer: https://developer.android.com/reference/kotlin/androidx/webgpu/GPUBuffer` | The index buffer. |
| `format: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = IndexFormat.Undefined` | The format of the indices. Value is one of the following: - `0` - `1` - `2` <br /> |
| `offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html = 0` | The offset in the index buffer. |
| `size: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html = Constants.WHOLE_SIZE` | The size of the index data to use. |

### setLabel

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
external fun setLabel(label: String): Unit
```

Sets a human-readable label for debugging.

| Parameters |
|---|---|
| `label: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The label string. |

### setPipeline

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
external fun setPipeline(pipeline: GPURenderPipeline): Unit
```

Sets the current render pipeline.

| Parameters |
|---|---|
| `pipeline: https://developer.android.com/reference/kotlin/androidx/webgpu/GPURenderPipeline` | The render pipeline to set. |

### setVertexBuffer

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
external fun setVertexBuffer(
    slot: Int,
    buffer: GPUBuffer? = null,
    offset: Long = 0,
    size: Long = Constants.WHOLE_SIZE
): Unit
```

Sets a vertex buffer for a specific slot.

| Parameters |
|---|---|
| `slot: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The vertex buffer slot. |
| `buffer: https://developer.android.com/reference/kotlin/androidx/webgpu/GPUBuffer? = null` | The vertex buffer. |
| `offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html = 0` | The offset in the vertex buffer. |
| `size: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html = Constants.WHOLE_SIZE` | The size of the vertex data to use. |

## Public properties

### handle

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
val handle: Long
```