# GPURenderPassEncoder

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

*** ** * ** ***


```
public final class GPURenderPassEncoder implements AutoCloseable
```

<br />

*** ** * ** ***

An object used to record commands for a render pass.

## Summary

| ### Public methods |
|---|---|
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#beginOcclusionQuery(kotlin.Int)(int queryIndex)` Begins an occlusion query. |
| `external void` | `https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#close()()` Decrements the reference count of the object and frees resources when the count reaches zero. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#draw(kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int)( int vertexCount, int instanceCount, int firstVertex, int firstInstance )` Draws non-indexed primitives. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#drawIndexed(kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int)( int indexCount, int instanceCount, int firstIndex, int baseVertex, int firstInstance )` Draws indexed primitives. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#drawIndexedIndirect(androidx.webgpu.GPUBuffer,kotlin.Long)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/webgpu/GPUBuffer indirectBuffer, long indirectOffset )` Draws indexed primitives with parameters from a buffer. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#drawIndirect(androidx.webgpu.GPUBuffer,kotlin.Long)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/webgpu/GPUBuffer indirectBuffer, long indirectOffset)` Draws non-indexed primitives with parameters from a buffer. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#end()()` Ends the render pass. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#endOcclusionQuery()()` Ends an occlusion query. |
| `boolean` | `https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#executeBundles(kotlin.Array)(@https://developer.android.com/reference/androidx/annotation/NonNull GPURenderBundle[] bundles)` Executes a list of render bundles. |
| `final long` | `https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#getHandle()()` |
| `int` | `https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#hashCode()()` |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#insertDebugMarker(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html markerLabel)` Inserts a debug marker into the command stream. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#popDebugGroup()()` Pops the current debug group. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#pushDebugGroup(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html groupLabel)` Pushes a new debug group. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#setBindGroup(kotlin.Int,androidx.webgpu.GPUBindGroup,kotlin.IntArray)( int groupIndex, https://developer.android.com/reference/androidx/webgpu/GPUBindGroup group, @https://developer.android.com/reference/androidx/annotation/NonNull int[] dynamicOffsets )` Sets a bind group for the pipeline. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#setBlendConstant(androidx.webgpu.GPUColor)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/webgpu/GPUColor color)` Sets the blend constant color. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#setImmediates(kotlin.Int,java.nio.ByteBuffer)(int offset, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/nio/ByteBuffer.html data)` |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#setIndexBuffer(androidx.webgpu.GPUBuffer,kotlin.Int,kotlin.Long,kotlin.Long)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/webgpu/GPUBuffer buffer, int format, long offset, long size )` Sets the index buffer. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#setLabel(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html label)` Sets a human-readable label for debugging. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#setPipeline(androidx.webgpu.GPURenderPipeline)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/webgpu/GPURenderPipeline pipeline)` Sets the current render pipeline. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#setScissorRect(kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int)(int x, int y, int width, int height)` Sets the scissor rectangle. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#setStencilReference(kotlin.Int)(int reference)` Sets the stencil reference value. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#setVertexBuffer(kotlin.Int,androidx.webgpu.GPUBuffer,kotlin.Long,kotlin.Long)(int slot, https://developer.android.com/reference/androidx/webgpu/GPUBuffer buffer, long offset, long size)` Sets a vertex buffer for a specific slot. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPURenderPassEncoder#setViewport(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)( float x, float y, float width, float height, float minDepth, float maxDepth )` Sets the viewport rectangle. |

## Public methods

### beginOcclusionQuery

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

```
@FastNative
public final external void beginOcclusionQuery(int queryIndex)
```

Begins an occlusion query.

| Parameters |
|---|---|
| `int queryIndex` | The index of the query in the query set. |

### close

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

```
public external void close()
```

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
public final external void draw(
    int vertexCount,
    int instanceCount,
    int firstVertex,
    int firstInstance
)
```

Draws non-indexed primitives.

| Parameters |
|---|---|
| `int vertexCount` | The number of vertices to draw. |
| `int instanceCount` | The number of instances to draw. |
| `int firstVertex` | The index of the first vertex to draw. |
| `int firstInstance` | 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
public final external void drawIndexed(
    int indexCount,
    int instanceCount,
    int firstIndex,
    int baseVertex,
    int firstInstance
)
```

Draws indexed primitives.

| Parameters |
|---|---|
| `int indexCount` | The number of indices to draw. |
| `int instanceCount` | The number of instances to draw. |
| `int firstIndex` | The index of the first index to draw. |
| `int baseVertex` | A value added to each index before reading from the vertex buffer. |
| `int firstInstance` | 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
public final external void drawIndexedIndirect(
    @NonNull GPUBuffer indirectBuffer,
    long indirectOffset
)
```

Draws indexed primitives with parameters from a buffer.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/webgpu/GPUBuffer indirectBuffer` | The buffer containing the draw parameters. |
| `long indirectOffset` | 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
public final external void drawIndirect(@NonNull GPUBuffer indirectBuffer, long indirectOffset)
```

Draws non-indexed primitives with parameters from a buffer.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/webgpu/GPUBuffer indirectBuffer` | The buffer containing the draw parameters. |
| `long indirectOffset` | The offset in the indirect buffer. |

### end

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

```
@FastNative
public final external void end()
```

Ends the render pass.

### endOcclusionQuery

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

```
@FastNative
public final external void endOcclusionQuery()
```

Ends an occlusion query.

### equals

```
public boolean equals(Object other)
```

### executeBundles

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

```
@FastNative
public final external void executeBundles(@NonNull GPURenderBundle[] bundles)
```

Executes a list of render bundles.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull GPURenderBundle[] bundles` | An array of render bundles to execute. |

### getHandle

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

```
public final long getHandle()
```

### hashCode

```
public int hashCode()
```

### insertDebugMarker

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

```
@FastNative
public final external void insertDebugMarker(@NonNull String markerLabel)
```

Inserts a debug marker into the command stream.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html markerLabel` | 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
public final external void popDebugGroup()
```

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
public final external void pushDebugGroup(@NonNull String groupLabel)
```

Pushes a new debug group.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html groupLabel` | 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
public final external void setBindGroup(
    int groupIndex,
    GPUBindGroup group,
    @NonNull int[] dynamicOffsets
)
```

Sets a bind group for the pipeline.

| Parameters |
|---|---|
| `int groupIndex` | The index of the bind group. |
| `https://developer.android.com/reference/androidx/webgpu/GPUBindGroup group` | The bind group to set. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull int[] dynamicOffsets` | An array of dynamic offsets. |

### setBlendConstant

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

```
@FastNative
public final external void setBlendConstant(@NonNull GPUColor color)
```

Sets the blend constant color.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/webgpu/GPUColor color` | The RGBA blend constant. |

### setImmediates

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

```
@FastNative
public final external void setImmediates(int offset, @NonNull ByteBuffer data)
```

### setIndexBuffer

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

```
@FastNative
public final external void setIndexBuffer(
    @NonNull GPUBuffer buffer,
    int format,
    long offset,
    long size
)
```

Sets the index buffer.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/webgpu/GPUBuffer buffer` | The index buffer. |
| `int format` | The format of the indices. Value is one of the following: - `0` - `1` - `2` <br /> |
| `long offset` | The offset in the index buffer. |
| `long 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
public final external void setLabel(@NonNull String label)
```

Sets a human-readable label for debugging.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html label` | The label string. |

### setPipeline

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

```
@FastNative
public final external void setPipeline(@NonNull GPURenderPipeline pipeline)
```

Sets the current render pipeline.

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

### setScissorRect

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

```
@FastNative
public final external void setScissorRect(int x, int y, int width, int height)
```

Sets the scissor rectangle.

| Parameters |
|---|---|
| `int x` | The x-coordinate of the scissor rectangle. |
| `int y` | The y-coordinate of the scissor rectangle. |
| `int width` | The width of the scissor rectangle. |
| `int height` | The height of the scissor rectangle. |

### setStencilReference

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

```
@FastNative
public final external void setStencilReference(int reference)
```

Sets the stencil reference value.

| Parameters |
|---|---|
| `int reference` | The stencil reference value. |

### setVertexBuffer

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

```
@FastNative
public final external void setVertexBuffer(int slot, GPUBuffer buffer, long offset, long size)
```

Sets a vertex buffer for a specific slot.

| Parameters |
|---|---|
| `int slot` | The vertex buffer slot. |
| `https://developer.android.com/reference/androidx/webgpu/GPUBuffer buffer` | The vertex buffer. |
| `long offset` | The offset in the vertex buffer. |
| `long size` | The size of the vertex data to use. |

### setViewport

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

```
@FastNative
public final external void setViewport(
    float x,
    float y,
    float width,
    float height,
    float minDepth,
    float maxDepth
)
```

Sets the viewport rectangle.

| Parameters |
|---|---|
| `float x` | The x-coordinate of the viewport. |
| `float y` | The y-coordinate of the viewport. |
| `float width` | The width of the viewport. |
| `float height` | The height of the viewport. |
| `float minDepth` | The minimum depth of the viewport. |
| `float maxDepth` | The maximum depth of the viewport. |